@cortex-js/compute-engine 0.26.4 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/compute-engine.esm.js +9785 -8316
  2. package/dist/compute-engine.js +9785 -8316
  3. package/dist/compute-engine.min.esm.js +57 -50
  4. package/dist/compute-engine.min.js +57 -50
  5. package/dist/math-json.esm.js +287 -7
  6. package/dist/math-json.js +287 -7
  7. package/dist/math-json.min.esm.js +287 -7
  8. package/dist/math-json.min.js +4 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/buffer.d.ts +1 -1
  11. package/dist/types/common/fuzzy-string-match.d.ts +2 -0
  12. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  13. package/dist/types/common/interruptible.d.ts +20 -0
  14. package/dist/types/common/json5.d.ts +3 -0
  15. package/dist/types/common/one-of.d.ts +1 -1
  16. package/dist/types/common/signals.d.ts +1 -1
  17. package/dist/types/common/styled-text.d.ts +1 -1
  18. package/dist/types/common/syntax-highlighter.d.ts +1 -1
  19. package/dist/types/common/terminal.d.ts +1 -1
  20. package/dist/types/common/type/boxed-type.d.ts +13 -0
  21. package/dist/types/common/type/parse.d.ts +1 -1
  22. package/dist/types/common/type/primitive.d.ts +2 -1
  23. package/dist/types/common/type/serialize.d.ts +1 -1
  24. package/dist/types/common/type/subtype.d.ts +1 -1
  25. package/dist/types/common/type/types.d.ts +39 -49
  26. package/dist/types/common/type/utils.d.ts +3 -7
  27. package/dist/types/common/utils.d.ts +1 -1
  28. package/dist/types/compute-engine/assume.d.ts +1 -1
  29. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +16 -9
  30. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  31. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +3 -2
  32. package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +1 -1
  33. package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +1 -1
  34. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  35. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  36. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  37. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +13 -6
  38. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +12 -8
  39. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +4 -4
  40. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  41. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
  42. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +5 -4
  43. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +7 -6
  44. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +4 -4
  45. package/dist/types/compute-engine/boxed-expression/cache.d.ts +2 -1
  46. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  47. package/dist/types/compute-engine/boxed-expression/compare.d.ts +3 -3
  48. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  49. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  50. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  51. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  52. package/dist/types/compute-engine/boxed-expression/hold.d.ts +3 -2
  53. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  54. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  55. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  56. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
  59. package/dist/types/compute-engine/boxed-expression/public.d.ts +109 -64
  60. package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/tensor-fields.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +7 -1
  68. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/validate.d.ts +3 -3
  70. package/dist/types/compute-engine/collection-utils.d.ts +3 -1
  71. package/dist/types/compute-engine/compile.d.ts +9 -8
  72. package/dist/types/compute-engine/compute-engine.d.ts +29 -16
  73. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  74. package/dist/types/compute-engine/debug.d.ts +3 -0
  75. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  76. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  77. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  78. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  79. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  80. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  81. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  82. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  83. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  84. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  85. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  86. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  87. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  88. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  89. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  90. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
  91. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  92. package/dist/types/compute-engine/latex-syntax/public.d.ts +11 -6
  93. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  94. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -1
  95. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +3 -3
  96. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +2 -2
  97. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  98. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  99. package/dist/types/compute-engine/library/collections.d.ts +3 -2
  100. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  101. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  102. package/dist/types/compute-engine/library/core.d.ts +1 -1
  103. package/dist/types/compute-engine/library/invisible-operator.d.ts +1 -1
  104. package/dist/types/compute-engine/library/library.d.ts +1 -1
  105. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  106. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  107. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  108. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  109. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  110. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  111. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  112. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  113. package/dist/types/compute-engine/library/utils.d.ts +3 -5
  114. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  115. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
  116. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  117. package/dist/types/compute-engine/numeric-value/public.d.ts +1 -1
  118. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  119. package/dist/types/compute-engine/numerics/bignum.d.ts +1 -1
  120. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  121. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  122. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  123. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +9 -1
  124. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -2
  125. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  126. package/dist/types/compute-engine/numerics/numeric.d.ts +2 -3
  127. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  128. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  129. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  130. package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
  131. package/dist/types/compute-engine/numerics/statistics.d.ts +24 -0
  132. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  133. package/dist/types/compute-engine/private.d.ts +29 -0
  134. package/dist/types/compute-engine/public.d.ts +1 -1
  135. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  136. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  137. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  138. package/dist/types/compute-engine/tensor/tensors.d.ts +2 -2
  139. package/dist/types/compute-engine.d.ts +3 -2
  140. package/dist/types/math-json/identifiers.d.ts +1 -1
  141. package/dist/types/math-json/types.d.ts +6 -6
  142. package/dist/types/math-json/utils.d.ts +3 -3
  143. package/dist/types/math-json.d.ts +3 -3
  144. package/package.json +3 -3
  145. package/dist/types/common/suggest.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression, MathJsonIdentifier, MathJsonNumber } from '../math-json/types';
4
4
  import type { LibraryCategory, LatexDictionaryEntry, LatexString, ParseLatexOptions } from './latex-syntax/public';
@@ -11,6 +11,9 @@ import { ExactNumericValueData, NumericValue, NumericValueData } from './numeric
11
11
  import { Type, TypeString } from '../common/type/types';
12
12
  import { OneOf } from '../common/one-of';
13
13
  import { BigNum } from './numerics/bignum';
14
+ import { BoxedType } from '../common/type/boxed-type';
15
+ export type * from '../common/type/types';
16
+ export * from '../common/type/subtype';
14
17
  /**
15
18
  *
16
19
  * To use the Compute Engine, create a `ComputeEngine` instance:
@@ -195,9 +198,8 @@ export declare class ComputeEngine implements IComputeEngine {
195
198
  *
196
199
  * The order of the dictionaries matter: the definitions from the later ones
197
200
  * override the definitions from earlier ones. The first dictionary should
198
- * be the `'core'` dictionary which include some basic definitions such
199
- * as domains (`Booleans`, `Numbers`, etc...) that are used by later
200
- * dictionaries.
201
+ * be the `'core'` dictionary which include basic definitions that are used
202
+ * by later dictionaries.
201
203
  *
202
204
  *
203
205
  * @param options.precision Specific how many digits of precision
@@ -212,6 +214,7 @@ export declare class ComputeEngine implements IComputeEngine {
212
214
  precision?: number | 'machine';
213
215
  tolerance?: number | 'auto';
214
216
  });
217
+ toString(): string;
215
218
  get latexDictionary(): Readonly<LatexDictionaryEntry[]>;
216
219
  set latexDictionary(dic: Readonly<LatexDictionaryEntry[]>);
217
220
  get indexedLatexDictionary(): IndexedLatexDictionary;
@@ -231,30 +234,39 @@ export declare class ComputeEngine implements IComputeEngine {
231
234
  get stats(): ComputeEngineStats;
232
235
  get precision(): number;
233
236
  /** The precision, or number of significant digits, of numeric
234
- * calculations when the numeric mode is `"auto"` or `"bignum"`.
237
+ * calculations.
235
238
  *
236
239
  * To make calculations using more digits, at the cost of expanded memory
237
240
  * usage and slower computations, set the `precision` higher.
238
241
  *
239
- * If the numeric mode is not `"auto"` or `"bignum"`, it is set to `"auto"`.
240
- *
241
242
  * Trigonometric operations are accurate for precision up to 1,000.
242
243
  *
243
244
  */
244
245
  set precision(p: number | 'machine' | 'auto');
245
246
  /**
246
- * The unit used for angles in trigonometric functions.
247
+ * The unit used for unitless angles in trigonometric functions.
248
+ *
249
+ * - `rad`: radian, $2\pi$ radians is a full circle
250
+ * - `deg`: degree, 360 degrees is a full circle
251
+ * - `grad`: gradians, 400 gradians is a full circle
252
+ * - `turn`: turn, 1 turn is a full circle
247
253
  *
248
254
  * Default is `"rad"` (radians).
249
255
  */
250
256
  get angularUnit(): AngularUnit;
251
257
  set angularUnit(u: AngularUnit);
252
- /** @experimental */
253
258
  get timeLimit(): number;
254
- /** @experimental */
259
+ set timeLimit(t: number);
260
+ private _timeLimit;
261
+ /** The time after which the time limit has been exceeded */
262
+ _deadline: number | undefined;
263
+ get _timeRemaining(): number;
255
264
  get iterationLimit(): number;
256
- /** @experimental */
265
+ set iterationLimit(t: number);
266
+ private _iterationLimit;
257
267
  get recursionLimit(): number;
268
+ set recursionLimit(t: number);
269
+ private _recursionLimit;
258
270
  get tolerance(): number;
259
271
  /**
260
272
  * Values smaller than the tolerance are considered to be zero for the
@@ -488,8 +500,8 @@ export declare class ComputeEngine implements IComputeEngine {
488
500
  *
489
501
  * @internal
490
502
  */
491
- _assign(id: string, value: BoxedExpression | ((ops: ReadonlyArray<BoxedExpression>, options: EvaluateOptions & {
492
- engine: IComputeEngine;
503
+ _assign(id: string, value: BoxedExpression | ((ops: ReadonlyArray<BoxedExpression>, options: Partial<EvaluateOptions> & {
504
+ engine?: IComputeEngine;
493
505
  }) => BoxedExpression | undefined)): void;
494
506
  /**
495
507
  * Return false if the execution should stop.
@@ -524,17 +536,18 @@ export declare class ComputeEngine implements IComputeEngine {
524
536
  * The result is canonical.
525
537
  */
526
538
  error(message: string | string[], where?: string): BoxedExpression;
527
- typeError(expected: Type, actual: undefined | Type, where?: string): BoxedExpression;
539
+ typeError(expected: Type, actual: undefined | Type | BoxedType, where?: string): BoxedExpression;
528
540
  /**
529
- * Add a`["Hold"]` wrapper to `expr.
541
+ * Add a `["Hold"]` wrapper to `expr`.
530
542
  */
531
- hold(expr: BoxedExpression): BoxedExpression;
543
+ hold(expr: SemiBoxedExpression): BoxedExpression;
532
544
  /** Shortcut for `this.box(["Tuple", ...])`
533
545
  *
534
546
  * The result is canonical.
535
547
  */
536
548
  tuple(...elements: ReadonlyArray<number>): BoxedExpression;
537
549
  tuple(...elements: ReadonlyArray<BoxedExpression>): BoxedExpression;
550
+ type(type: Type | TypeString | BoxedType): BoxedType;
538
551
  string(s: string, metadata?: Metadata): BoxedExpression;
539
552
  /** Return a boxed symbol */
540
553
  symbol(name: string, options?: {
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * The default cost function, used to determine if a new expression is simpler
4
4
  * than the old one.
@@ -0,0 +1,3 @@
1
+ /* 0.28.0 */
2
+ /** Return a string representing the stack trace from context */
3
+ export declare function trace(_context: RuntimeScope): string;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  /***
3
3
  * ### THEORY OF OPERATIONS
4
4
  *
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_CALCULUS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_COMPLEX: LatexDictionary;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_CORE: LatexDictionary;
3
3
  export declare const DELIMITERS_SHORTHAND: {
4
4
  '(': string;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_LOGIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_OTHERS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_INEQUALITIES: LatexDictionaryEntry[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_SETS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_STATISTICS: LatexDictionary;
@@ -1,3 +1,3 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const SYMBOLS: [string, string, number][];
3
3
  export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { Delimiter, EnvironmentParseHandler, ExpressionParseHandler, InfixParseHandler, LatexDictionary, LatexDictionaryEntry, LatexString, LatexToken, LibraryCategory, MatchfixParseHandler, PostfixParseHandler, Precedence, SerializeHandler } from '../public';
3
3
  export type CommonEntry = {
4
4
  /** Note: a name is required if a serialize handler is provided */
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { Parser } from './public';
3
3
  /** For error handling, if we have a identifier prefix, assume
4
4
  * the identifier is invalid (it would have been captured by
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { ParseLatexOptions, LatexToken, Terminator, Parser, SymbolTable, SymbolType } from './public';
3
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
4
4
  /**
@@ -1,4 +1,5 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
+ import type { Expression, MathJsonIdentifier } from '../../math-json/types';
2
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
3
4
  export type SymbolType = 'symbol' | 'function' | 'unknown';
4
5
  export type SymbolTable = {
@@ -100,6 +101,8 @@ export declare const MULTIPLICATION_PRECEDENCE: Precedence;
100
101
  /** @hidden */
101
102
  export declare const DIVISION_PRECEDENCE: Precedence;
102
103
  /** @hidden */
104
+ export declare const INVISIBLE_OP_PRECEDENCE: Precedence;
105
+ /** @hidden */
103
106
  export declare const EXPONENTIATION_PRECEDENCE: Precedence;
104
107
  /** @hidden */
105
108
  export declare const POSTFIX_PRECEDENCE: Precedence;
@@ -220,14 +223,14 @@ export type BaseEntry = {
220
223
  * @category Latex Parsing and Serialization
221
224
  */
222
225
  export type DefaultEntry = BaseEntry & Trigger & {
223
- parse: Expression | ExpressionParseHandler;
226
+ parse?: Expression | ExpressionParseHandler;
224
227
  };
225
228
  /**
226
229
  * @category Latex Parsing and Serialization
227
230
  */
228
231
  export type ExpressionEntry = BaseEntry & Trigger & {
229
232
  kind: 'expression';
230
- parse: Expression | ExpressionParseHandler;
233
+ parse?: Expression | ExpressionParseHandler;
231
234
  precedence?: Precedence;
232
235
  };
233
236
  /**
@@ -341,7 +344,9 @@ export type FunctionEntry = BaseEntry & Trigger & {
341
344
  * @category Latex Parsing and Serialization
342
345
  *
343
346
  */
344
- export type LatexDictionaryEntry = DefaultEntry | ExpressionEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | FunctionEntry | EnvironmentEntry;
347
+ export type LatexDictionaryEntry = OneOf<[
348
+ ExpressionEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | FunctionEntry | EnvironmentEntry | DefaultEntry
349
+ ]>;
345
350
  /** @internal */
346
351
  export declare function isExpressionEntry(entry: LatexDictionaryEntry): entry is ExpressionEntry;
347
352
  /** @internal */
@@ -475,7 +480,7 @@ export type ParseLatexOptions = NumberFormat & {
475
480
  * This handler is invoked when the parser encounters an identifier
476
481
  * that has not yet been declared.
477
482
  *
478
- * The `identifier` argument is a (valid identifier)[/math-json/#identifiers].
483
+ * The `identifier` argument is a [valid identifier](/math-json/#identifiers).
479
484
  *
480
485
  * The handler can return:
481
486
  *
@@ -575,7 +580,7 @@ export interface Parser {
575
580
  */
576
581
  matchChar(): string | null;
577
582
  /**
578
- * Parse an expression in aLaTeX group enclosed in curly brackets `{}`.
583
+ * Parse an expression in a LaTeX group enclosed in curly brackets `{}`.
579
584
  * These are often used as arguments to LaTeX commands, for example
580
585
  * `\frac{1}{2}`.
581
586
  *
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { NumberSerializationFormat } from './public';
3
3
  /**
4
4
  * @param expr - A number, can be represented as a string
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { DelimiterScale } from './public';
3
3
  export declare function getApplyFunctionStyle(_expr: Expression, _level: number): DelimiterScale;
4
4
  export declare function getGroupStyle(_expr: Expression, _level: number): DelimiterScale;
@@ -7,3 +7,4 @@ export declare function getFractionStyle(expr: Expression, level: number): 'quot
7
7
  export declare function getLogicStyle(_expr: Expression, _level: number): 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
8
8
  export declare function getPowerStyle(_expr: Expression, _level: number): 'root' | 'solidus' | 'quotient';
9
9
  export declare function getNumericSetStyle(_expr: Expression, _level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
10
+ export declare function latexTemplate(s: string, lhs: string, rhs: string): string;
@@ -1,8 +1,8 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { LatexString, SerializeLatexOptions, DelimiterScale } from './public';
3
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
4
4
  export declare class Serializer {
5
- options: SerializeLatexOptions;
5
+ options: Readonly<SerializeLatexOptions>;
6
6
  readonly dictionary: IndexedLatexDictionary;
7
7
  level: number;
8
8
  constructor(dictionary: IndexedLatexDictionary, options: SerializeLatexOptions);
@@ -34,4 +34,4 @@ export declare class Serializer {
34
34
  numericSetStyle(expr: Expression, level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
35
35
  }
36
36
  export declare function appendLatex(src: string, s: string): string;
37
- export declare function serializeLatex(expr: Expression | null, dict: IndexedLatexDictionary, options: SerializeLatexOptions): string;
37
+ export declare function serializeLatex(expr: Expression | null, dict: IndexedLatexDictionary, options: Readonly<SerializeLatexOptions>): string;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  * ## Reference
3
3
  * TeX source code:
4
4
  * {@link http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web | Tex.web}
@@ -14,5 +14,5 @@ export type Token = string;
14
14
  export declare function tokenize(s: string, args?: string[]): Token[];
15
15
  export declare function countTokens(s: string): number;
16
16
  export declare function joinLatex(segments: Iterable<string>): string;
17
- export declare function supsub(c: '_' | '^', x: string): string;
17
+ export declare function supsub(c: '_' | '^', body: string, x: string): string;
18
18
  export declare function tokensToString(tokens: Token | Token[] | [Token[] | Token][]): string;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { BoxedExpression } from '../boxed-expression/public';
3
3
  export type CanonicalArithmeticOperators = 'Add' | 'Negate' | 'Multiply' | 'Divide' | 'Power' | 'Sqrt' | 'Root' | 'Ln';
4
4
  export declare const ARITHMETIC_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const DEFAULT_LINSPACE_COUNT = 50;
3
3
  export declare const COLLECTIONS_LIBRARY: IdentifierDefinitions;
4
4
  /**
@@ -22,5 +22,6 @@ export declare function rangeLast(r: [lower: number, upper: number, step: number
22
22
  * is returned. Otherwise, the result of the function is used as the new accumulator.
23
23
  * If the iteration completes, the final accumulator is returned.
24
24
  */
25
- export declare function reduceCollection<T>(collection: BoxedExpression, fn: (acc: T, next: BoxedExpression) => T | null, initial: T): T | undefined;
25
+ export declare function reduceCollection<T>(collection: BoxedExpression, fn: (acc: T, next: BoxedExpression) => T | null, initial: T): Generator<T | undefined>;
26
26
  export declare function fromRange(start: number, end: number): number[];
27
+ export declare function canonicalDictionary(engine: IComputeEngine, dict: BoxedExpression): BoxedExpression;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const CORE_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function canonicalInvisibleOperator(ops: ReadonlyArray<BoxedExpression>, { engine: ce }: {
3
3
  engine: IComputeEngine;
4
4
  }): BoxedExpression | null;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { IComputeEngine, IdentifierDefinitions } from '../public';
3
3
  export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): readonly IdentifierDefinitions[];
4
4
  export declare const LIBRARIES: {
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const LOGIC_LIBRARY: IdentifierDefinitions;
3
3
  export declare function simplifyLogicFunction(x: BoxedExpression): {
4
4
  value: BoxedExpression;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function randomExpression(level?: number): Expression;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const RELOP_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const SETS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export type IndexingSet = {
3
3
  index: string | undefined;
4
4
  lower: number;
@@ -23,7 +23,7 @@ export type IndexingSet = {
23
23
  */
24
24
  export declare function normalizeIndexingSet(indexingSet: BoxedExpression): IndexingSet;
25
25
  export declare function normalizeIndexingSets(ops: ReadonlyArray<BoxedExpression>): IndexingSet[];
26
- export declare function indexingSetCartestianProduct(indexingSets: IndexingSet[]): number[][];
26
+ export declare function indexingSetCartesianProduct(indexingSets: IndexingSet[]): number[][];
27
27
  /**
28
28
  * Calculates the cartesian product of two arrays.
29
29
  * ```ts
@@ -49,9 +49,7 @@ export declare function canonicalBigop(operator: string, body: BoxedExpression,
49
49
  * - ['Operator', collection]
50
50
  *
51
51
  * `fn()` is the processing done on each element
52
- */
53
- /**
54
52
  * Apply the function `fn` to the body of a big operator, according to the
55
53
  * indexing sets.
56
54
  */
57
- export declare function reduceBigOp<T>(body: BoxedExpression, indexes: ReadonlyArray<BoxedExpression>, fn: (acc: T, x: BoxedExpression) => T | null, initial: T): T | undefined;
55
+ export declare function reduceBigOp<T>(body: BoxedExpression, indexes: ReadonlyArray<BoxedExpression>, fn: (acc: T, x: BoxedExpression) => T | null, initial: T): Generator<T | undefined>;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { NumericValue, NumericValueData } from './public';
3
3
  import { ExactNumericValue } from './exact-numeric-value';
4
4
  import { Expression } from '../../math-json/types';
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { SmallInteger } from '../numerics/numeric';
3
3
  import { Rational } from '../numerics/rationals';
4
4
  import { ExactNumericValueData, NumericValue, NumericValueFactory } from './public';
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { NumericValue, NumericValueData } from './public';
3
3
  import type { Expression } from '../../math-json/types';
4
4
  import { SmallInteger } from '../numerics/numeric';
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  *
3
3
  * ## THEORY OF OPERATIONS
4
4
  *
@@ -1,2 +1,2 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function bigint(a: Decimal | number | bigint | string): bigint | null;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export type BigNum = Decimal;
3
3
  export interface IBigNum {
4
4
  readonly _BIGNUM_NAN: BigNum;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function bigintValue(expr: Expression | null | undefined): bigint | null;
3
3
  /** Output a shorthand if possible */
4
4
  export declare function numberToExpression(num: number | bigint, fractionalDigits?: string | number): Expression;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  /** An interval is a continuous set of real numbers */
3
3
  export type Interval = {
4
4
  start: number;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  * Return a numerical approximation of the integral
3
3
  * of the function `f` from `a` to `b` using Monte Carlo integration.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function lcm(a: bigint, b: bigint): bigint;
3
3
  /** Return `[factor, root]` such that
4
4
  * pow(n, 1/exponent) = factor * pow(root, 1/exponent)
@@ -8,3 +8,11 @@ export declare function lcm(a: bigint, b: bigint): bigint;
8
8
  */
9
9
  export declare function canonicalInteger(n: bigint, exponent: number): [factor: bigint, root: bigint];
10
10
  export declare function reducedInteger(n: bigint): bigint | number;
11
+ /**
12
+ * Computes the factorial of a number as a generator to allow interruptibility.
13
+ * Yields intermediate values periodically, but these are not intended to be the primary result.
14
+ *
15
+ * @param n - The number to compute the factorial of (as a BigInt).
16
+ * @returns A generator that can be iterated for intermediate values, with the final value returned when the computation completes.
17
+ */
18
+ export declare function factorial(n: bigint): Generator<bigint, bigint>;
@@ -1,7 +1,6 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function gcd(a: BigNum, b: BigNum): BigNum;
3
3
  export declare function lcm(a: BigNum, b: BigNum): BigNum;
4
- export declare function factorial(ce: IBigNum, n: BigNum): BigNum;
5
4
  export declare function factorial2(ce: IBigNum, n: BigNum): BigNum;
6
5
  /**
7
6
  * If the exponent of the bignum is in the range of the exponents
@@ -1,3 +1,3 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function gamma(c: Complex): Complex;
3
3
  export declare function gammaln(c: Complex): Complex;
@@ -1,8 +1,7 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare const MACHINE_PRECISION_BITS = 53;
3
3
  export declare const MACHINE_PRECISION: number;
4
- export declare const MACHINE_TOLERANCE_BITS = 7;
5
- export declare const MACHINE_TOLERANCE: number;
4
+ export declare const DEFAULT_TOLERANCE = 1e-10;
6
5
  export declare const SMALL_INTEGER = 1000000;
7
6
  type IsInteger<N extends number> = `${N}` extends `${string}.${string}` ? never : `${N}` extends `-${string}.${string}` ? never : number;
8
7
  export type SmallInteger = IsInteger<number>;
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  export declare function primeFactors(n: number): {
3
3
  [factor: number]: number;
4
4
  };
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * @category Boxed Expression
4
4
  */
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
 
3
3
  Translated from https://github.com/JuliaMath/Richardson.jl/blob/master/src/Richardson.jl
4
4
 
@@ -1,4 +1,4 @@
1
- /* 0.26.4 */
1
+ /* 0.28.0 */
2
2
  import { BigNum } from './bignum';
3
3
  export declare function gammaln(z: number): number;
4
4
  export declare function gamma(z: number): number;