@cortex-js/compute-engine 0.15.0 → 0.17.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 (100) hide show
  1. package/README.md +1 -1
  2. package/dist/compute-engine.esm.js +7319 -5823
  3. package/dist/compute-engine.js +7319 -5823
  4. package/dist/compute-engine.min.esm.js +47 -25822
  5. package/dist/compute-engine.min.js +19 -25805
  6. package/dist/math-json.esm.js +2 -2
  7. package/dist/math-json.js +2 -2
  8. package/dist/math-json.min.esm.js +2 -2
  9. package/dist/math-json.min.js +2 -281
  10. package/dist/types/common/ansi-codes.d.ts +15 -0
  11. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  12. package/dist/types/common/signals.d.ts +1 -1
  13. package/dist/types/common/utils.d.ts +1 -1
  14. package/dist/types/compute-engine/assume.d.ts +2 -2
  15. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +15 -19
  16. package/dist/types/compute-engine/boxed-expression/box.d.ts +8 -3
  17. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +9 -9
  18. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +16 -28
  19. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +27 -1
  20. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +9 -21
  21. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +6 -5
  22. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +4 -4
  23. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
  24. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +13 -12
  25. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +21 -15
  26. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  27. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  28. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +2 -2
  29. package/dist/types/compute-engine/boxed-expression/utils.d.ts +30 -9
  30. package/dist/types/compute-engine/boxed-expression/validate.d.ts +32 -12
  31. package/dist/types/compute-engine/compile.d.ts +18 -2
  32. package/dist/types/compute-engine/compute-engine.d.ts +77 -55
  33. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  34. package/dist/types/compute-engine/domain-utils.d.ts +4 -21
  35. package/dist/types/compute-engine/function-utils.d.ts +124 -0
  36. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  37. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  38. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  39. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  40. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  41. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +1 -1
  42. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  43. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  44. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  45. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  46. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  47. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  48. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  49. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +2 -2
  50. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
  51. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  52. package/dist/types/compute-engine/latex-syntax/public.d.ts +31 -13
  53. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  54. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  55. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  56. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  57. package/dist/types/compute-engine/library/arithmetic-add.d.ts +2 -2
  58. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
  59. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
  60. package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
  61. package/dist/types/compute-engine/library/arithmetic.d.ts +3 -2
  62. package/dist/types/compute-engine/library/calculus.d.ts +2 -2
  63. package/dist/types/compute-engine/library/collections.d.ts +2 -2
  64. package/dist/types/compute-engine/library/complex.d.ts +2 -2
  65. package/dist/types/compute-engine/library/control-structures.d.ts +2 -0
  66. package/dist/types/compute-engine/library/core.d.ts +2 -2
  67. package/dist/types/compute-engine/library/domains.d.ts +9 -9
  68. package/dist/types/compute-engine/library/library.d.ts +7 -5
  69. package/dist/types/compute-engine/library/linear-algebra.d.ts +2 -0
  70. package/dist/types/compute-engine/library/logic.d.ts +2 -2
  71. package/dist/types/compute-engine/library/polynomials.d.ts +2 -2
  72. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  73. package/dist/types/compute-engine/library/relational-operator.d.ts +2 -2
  74. package/dist/types/compute-engine/library/sets.d.ts +2 -2
  75. package/dist/types/compute-engine/library/statistics.d.ts +2 -2
  76. package/dist/types/compute-engine/library/trigonometry.d.ts +2 -2
  77. package/dist/types/compute-engine/library/utils.d.ts +1 -3
  78. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  79. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +3 -2
  80. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +2 -2
  81. package/dist/types/compute-engine/numerics/numeric.d.ts +61 -3
  82. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  83. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  84. package/dist/types/compute-engine/public.d.ts +281 -189
  85. package/dist/types/compute-engine/rules.d.ts +1 -1
  86. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  87. package/dist/types/compute-engine/solve.d.ts +1 -1
  88. package/dist/types/compute-engine/symbolic/derivative.d.ts +20 -0
  89. package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
  90. package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -2
  91. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  92. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  93. package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
  94. package/dist/types/compute-engine/symbolic/sum.d.ts +1 -1
  95. package/dist/types/compute-engine/symbolic/utils.d.ts +5 -3
  96. package/dist/types/compute-engine.d.ts +2 -2
  97. package/dist/types/math-json/math-json-format.d.ts +4 -3
  98. package/dist/types/math-json/utils.d.ts +1 -1
  99. package/dist/types/math-json.d.ts +2 -2
  100. package/package.json +25 -22
@@ -1,24 +1,7 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { Decimal } from 'decimal.js';
3
- import { BoxedExpression, Rational } from './public';
4
- /** Quickly determine the numeric domain of a number or constant
5
- * For the symbols, this is a hard-coded optimization that doesn't rely on the
6
- * dictionaries. The regular path is in `internalDomain()`
7
- */
8
- export declare function inferNumericDomain(value: number | Decimal | Complex | Rational): string;
3
+ import { DomainLiteral, Rational } from './public';
9
4
  /**
10
- * Simple description of a numeric domain as a base domain, a min and
11
- * max value, possibly open ends, and some excluded values.
5
+ * Determine the numeric domain of a number.
12
6
  */
13
- export type NumericDomainInfo = {
14
- domain?: string;
15
- min?: number;
16
- max?: number;
17
- open?: 'left' | 'right' | 'both';
18
- /** Values from _excludedValues_ are considered not in this domain */
19
- excludedValues?: number[];
20
- /** If defined, the values in this domain must follow the relation
21
- * _period_ * _n_ + _phase_ when _n_ is in _domain_.
22
- */
23
- multiple?: [period: number, domain: BoxedExpression, phase: number];
24
- };
7
+ export declare function inferNumericDomain(value: number | Decimal | Complex | Rational): DomainLiteral;
@@ -0,0 +1,124 @@
1
+ /* 0.17.0 */
2
+ /***
3
+ * ## THEORY OF OPERATIONS
4
+ *
5
+ * A `["Function"]` expression has its own scope.
6
+ * This scope includes the parameters and local variables.
7
+ *
8
+ * Some expressions with anonymous parameters (e.g. `["Add", "_", 1]`)
9
+ * are rewritten to a `["Function"]` expression with anonymous parameters
10
+ * (e.g. `["Function", ["Add", "_", 1], "_"]`).
11
+ *
12
+ * The **body** of a `["Function"]` expression may have its own scope
13
+ * (for example if it's a `["Block"]` expression) or may not have a scope
14
+ * at all (if it's a number, i.e. `["Function", 1]`). the function body may
15
+ * be a number, a symbol or (more commonly) an function expression.
16
+ *
17
+ *
18
+ * ### DURING BOXING (in makeLambda())
19
+ *
20
+ * During the boxing/canonicalization phase of a function
21
+ * (`["Function"]` expression or head expression):
22
+ *
23
+ * 1/ If not a `["Function"]` expression, the expression is rewritten
24
+ * to a `["Function"]` expression with anonymous parameters
25
+ * 2/ A new scope is created
26
+ * 3/ The function parameters are declared in the scope
27
+ * 4/ The function body is boxed in the context of the scope and the scope
28
+ * is associated with the function
29
+ *
30
+ *
31
+ * ### DURING EVALUATION (executing the result of makeLambda())
32
+ *
33
+ * 1/ The arguments are evaluated in the current scope
34
+ * 2/ The context is swapped to the function scope
35
+ * 3/ The values of all the ids in this scope are reset
36
+ * 4/ The parameters are set to the value of the arguments
37
+ * 5/ The function body is evaluated in the context of the function scope
38
+ * 6/ The context is swapped back to the current scope
39
+ * 7/ The result of the function body is returned
40
+ *
41
+ */
42
+ /**
43
+ * From an expression, create an iterator that can be used
44
+ * to enumerate values.
45
+ *
46
+ * `expr` can be a collection, a function, an expression, a string.
47
+ *
48
+ * - ["Range", 5]
49
+ * - ["List", 1, 2, 3]
50
+ * - "'hello world'"
51
+ *
52
+ */
53
+ export declare function iterable(expr: BoxedExpression): Iterator<BoxedExpression> | undefined;
54
+ /**
55
+ * indexable(expr) return a JS function with one argument.
56
+ *
57
+ * Evaluate expr.
58
+ * If expr is indexable function (def with at handler), return handler.
59
+ * Otherwise, call makeLambda, then return function that set scope
60
+ * with one arg, then evaluate result of makeLambda.
61
+ */
62
+ export declare function indexable(expr: BoxedExpression): ((index: number) => BoxedExpression | undefined) | undefined;
63
+ /**
64
+ * From an expression, return a predicate function, which can be used to filter.
65
+ */
66
+ export declare function predicate(_expr: BoxedExpression): (...args: BoxedExpression[]) => boolean;
67
+ /**
68
+ * From an expression, create an ordering function, which can be used to sort.
69
+ */
70
+ export declare function order(_expr: BoxedExpression): (a: BoxedExpression, b: BoxedExpression) => -1 | 0 | 1;
71
+ /**
72
+ * Given an expression, rewrite it to a canonical Function form.
73
+ *
74
+ *
75
+ * - explicit parameters (no change)
76
+ * ["Function", ["Add, "x", 1], "x"]
77
+ * -> ["Function", ["Add, "x", 1], "x"]
78
+ *
79
+ * - single anonymous parameters:
80
+ * ["Add", "_", 1]
81
+ * -> ["Function", ["Add", "_", 1], "_"]
82
+ *
83
+ * - multiple anonymous parameters:
84
+ * ["Add", "_1", "_2"]
85
+ * -> ["Function", ["Add", "_1", "_2"], "_1", "_2"]
86
+ *
87
+ */
88
+ export declare function canonicalFunctionExpression(expr: BoxedExpression): BoxedExpression | undefined;
89
+ /**
90
+ * Apply arguments to an expression which is either
91
+ * - a '["Function"]' expression
92
+ * - an expression with anonymous parameters, e.g. ["Add", "_", 1]
93
+ * - the identifier for a function, e.g. "Sin".
94
+ */
95
+ export declare function apply(fn: BoxedExpression, args: BoxedExpression[]): BoxedExpression;
96
+ /**
97
+ * Return a lambda function, assuming a scoped environment has been
98
+ * created and there is a single numeric argument
99
+ */
100
+ export declare function makeLambdaN1(expr: BoxedExpression): ((arg: number) => number) | undefined;
101
+ /**
102
+ * Given an expression such as:
103
+ * - ["Function", ["Add", 1, "x"], "x"]
104
+ * - ["Function", ["Divide", "_", 2]]
105
+ * - ["Multiply, "_", 3]
106
+ * - ["Add, "_1", "_2"]
107
+ * - "Sin"
108
+ *
109
+ * return a JS function that can be called with arguments.
110
+ */
111
+ export declare function applicable(fn: BoxedExpression): (args: BoxedExpression[]) => BoxedExpression | undefined;
112
+ /**
113
+ * Use applicableN when the function is known to be a function of a single
114
+ * variable and the argument is a number.
115
+ *
116
+ * Unlike "apply", applicable returns a function that can be called
117
+ * with an argument.
118
+ *
119
+ */
120
+ export declare function applicableN1(fn: BoxedExpression): (x: number) => number;
121
+ /**
122
+ * Give a string like "f(x,y)" return, ["f", ["x", "y"]]
123
+ */
124
+ export declare function parseFunctionSignature(s: string): [id: string, args: string[] | undefined];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_CALCULUS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_COMPLEX: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_CORE: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_INEQUALITIES: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_LOGIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_OTHERS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_SETS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_STATISTICS: LatexDictionary;
@@ -1,3 +1,3 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const SYMBOLS: [string, string, number][];
3
3
  export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { WarningSignal } from '../../../common/signals';
3
3
  export type CommonEntry = {
4
4
  /** Note: a name is required if a serialize handler is provided */
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { Serializer } from './serializer';
3
3
  import { Expression } from '../../math-json/math-json-format';
4
4
  import { WarningSignalHandler } from '../../common/signals';
@@ -19,7 +19,7 @@ export declare class LatexSyntax {
19
19
  get dictionary(): readonly LatexDictionaryEntry[];
20
20
  set dictionary(val: readonly LatexDictionaryEntry[]);
21
21
  updateOptions(opt: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions> & Partial<SerializeLatexOptions>): void;
22
- static getDictionary(category?: LibraryCategory | 'all'): Readonly<LatexDictionary>;
22
+ static getDictionary(category?: LibraryCategory | 'all'): readonly Readonly<object>[];
23
23
  parse(latex: LatexString): Expression;
24
24
  serialize(expr: Expression, options?: {
25
25
  canonical?: boolean;
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.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.15.0 */
1
+ /* 0.17.0 */
2
2
  import { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
3
3
  import { IComputeEngine } from '../public';
4
4
  import { Expression } from '../../math-json/math-json-format';
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { Expression } from '../../math-json/math-json-format';
3
3
  import type { IComputeEngine } from '../public';
4
4
  /**
@@ -19,35 +19,45 @@ export type LatexString = string;
19
19
  */
20
20
  export type Delimiter = ')' | '(' | ']' | '[' | '{' /** \lbrace */ | '}' /** \rbrace */ | '<' /** \langle */ | '>' /** \rangle */ | '|' | '||' | '\\lceil' | '\\rceil' | '\\lfloor' | '\\rfloor';
21
21
  export type LibraryCategory = 'algebra' | 'arithmetic' | 'calculus' | 'collections' | 'control-structures' | 'combinatorics' | 'complex' | 'core' | 'data-structures' | 'dimensions' | 'domains' | 'linear-algebra' | 'logic' | 'numeric' | 'other' | 'physics' | 'polynomials' | 'relop' | 'sets' | 'statistics' | 'styling' | 'symbols' | 'trigonometry' | 'units';
22
- /** Theory of operations:
22
+ /**
23
+ *
24
+ * ## THEORY OF OPERATIONS
23
25
  *
24
26
  * The precedence of an operator is a number that indicates the order in which
25
- * operators are applied. For example, in `1 + 2 * 3`, the `*` operator has
26
- * a higher precedence than the `+` operator, so it is applied first.
27
+ * operators are applied.
27
28
  *
28
- * The precendence range from 0 to 1000. The higher the number, the higher the
29
+ * For example, in `1 + 2 * 3`, the `*` operator has a **higher** precedence
30
+ * than the `+` operator, so it is applied first.
31
+ *
32
+ * The precedence range from 0 to 1000. The larger the number, the higher the
29
33
  * precedence, the more "binding" the operator is.
30
34
  *
31
35
  * Here are some rough ranges for the precedence:
32
36
  *
33
- * - 800: prefix and postfix operators,
34
- * e.g. `\lnot`, `!`, `'`, `\degree`, `++`, etc...
35
- * - 700: some relational operators: `<`
36
- * - 600: some binary operators: `\div`
37
+ * - 800: prefix and postfix operators: `\lnot` etc...
38
+ * - `POSTFIX_PRECEDENCE` = 810: `!`, `'`
39
+ * - 700: some arithmetic operators
40
+ * - `EXPONENTIATION_PRECEDENCE` = 700: `^`
41
+ * - 600: some binary operators
42
+ * - `DIVISION_PRECEDENCE` = 600: `\div`
37
43
  * - 500: not used
38
44
  * - 400: not used
39
45
  * - 300: some logic and arithmetic operators:
40
46
  * `\land`, `\lor`, `\times`, etc...
47
+ * - `MULTIPLICATION_PRECEDENCE` = 390: `\times`
41
48
  * - 200: arithmetic operators, inequalities:
42
- * `+`, `-`, `=`, `<`, etc...
43
- * - 260: `=`
44
- * - 245: `\lt`, `\gt`
49
+ * - `ADDITION_PRECEDENCE` = 275: `+` `-`
50
+ * - `ARROW_PRECEDENCE` = 270: `\to` `\rightarrow`
51
+ * - `ASSIGNMENT_PRECEDENCE` = 260: `:=`
52
+ * - `COMPARISON_PRECEDENCE` = 245: `\lt` `\gt`
45
53
  * - 241: `\leq`
46
54
  * - 100: not used
47
55
  * - 0: `,`, `;`, etc...
48
56
  *
57
+ * Some constants are defined below for common precedence values.
58
+ *
49
59
  *
50
- * Note: MathML defines some operator precendence, but it has some
60
+ * Note: MathML defines some operator precedence, but it has some
51
61
  * issues and inconsistencies. However, whenever possible we adopted the
52
62
  * MathML precedence. See https://www.w3.org/TR/2009/WD-MathML3-20090924/appendixc.html
53
63
  *
@@ -55,6 +65,14 @@ export type LibraryCategory = 'algebra' | 'arithmetic' | 'calculus' | 'collectio
55
65
  * here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence
56
66
  */
57
67
  export type Precedence = number;
68
+ export declare const COMPARISON_PRECEDENCE: Precedence;
69
+ export declare const ASSIGNMENT_PRECEDENCE: Precedence;
70
+ export declare const ARROW_PRECEDENCE: Precedence;
71
+ export declare const ADDITION_PRECEDENCE: Precedence;
72
+ export declare const MULTIPLICATION_PRECEDENCE: Precedence;
73
+ export declare const DIVISION_PRECEDENCE: Precedence;
74
+ export declare const EXPONENTIATION_PRECEDENCE: Precedence;
75
+ export declare const POSTFIX_PRECEDENCE: Precedence;
58
76
  /**
59
77
  * This indicates a condition under which parsing should stop:
60
78
  * - an operator of a precedence higher than specified has been encountered
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { NumberFormattingOptions } from './public';
3
3
  export declare function serializeNumber(expr: Expression | null, options: NumberFormattingOptions): string;
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare function getApplyFunctionStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
3
3
  export declare function getGroupStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
4
4
  export declare function getRootStyle(_expr: Expression | null, level: number): 'radical' | 'quotient' | 'solidus';
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { WarningSignalHandler } from '../../common/signals';
3
3
  import { NumberFormattingOptions, LatexString, SerializeLatexOptions } from './public';
4
4
  import { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.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}
@@ -1,10 +1,10 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  /** The canonical form of `Add`:
3
3
  * - removes `0`
4
4
  * - capture complex numbers (a + ib or ai +b)
5
5
  * */
6
6
  export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
7
- export declare function domainAdd(_ce: IComputeEngine, args: BoxedDomain[]): BoxedDomain | null;
7
+ export declare function domainAdd(_ce: IComputeEngine, args: (undefined | BoxedDomain)[]): BoxedDomain | null | undefined;
8
8
  export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression;
9
9
  export declare function evalAdd(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
10
10
  export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression, range: BoxedExpression | undefined): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  /**
3
3
  * Canonical form of 'Divide' (and 'Rational')
4
4
  * - remove denominator of 1
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  /** The canonical form of `Multiply`:
3
3
  * - remove `1`
4
4
  * - combine literal integers and rationals
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  /**
3
3
  *
4
4
  */
@@ -1,2 +1,3 @@
1
- /* 0.15.0 */
2
- export declare const ARITHMETIC_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export type CanonicalArithmeticFunctions = 'Add' | 'Negate' | 'Sqrt' | 'Multiply' | 'Divide' | 'Power' | 'Ln';
3
+ export declare const ARITHMETIC_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const CALCULUS_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const COLLECTIONS_LIBRARY: IdTable;
1
+ /* 0.17.0 */
2
+ export declare const COLLECTIONS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const COMPLEX_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
@@ -0,0 +1,2 @@
1
+ /* 0.17.0 */
2
+ export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const CORE_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const CORE_LIBRARY: IdentifierDefinitions[];
@@ -1,16 +1,16 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare const DOMAIN_CONSTRUCTORS: string[];
3
3
  export declare const DOMAIN_ALIAS: {
4
- NumericFunction: (string | string[])[];
5
- RealFunction: (string | string[])[];
6
- TrigonometricFunction: string[];
7
- LogicOperator: (string | string[])[];
8
- Predicate: (string | string[])[];
9
- RelationalOperator: string[];
4
+ Functions: (string | string[])[];
5
+ NumericFunctions: (string | string[])[];
6
+ RealFunctions: (string | string[])[];
7
+ LogicOperators: (string | string[])[];
8
+ Predicates: (string | string[])[];
9
+ RelationalOperators: string[];
10
10
  };
11
11
  export declare function isDomainLiteral(s: string | null): s is DomainLiteral;
12
12
  export declare function isSubdomainLiteral(lhs: string, rhs: string): boolean;
13
13
  /** Return all the domain literals that are an ancestor of `dom`
14
14
  */
15
- export declare function ancestors(dom: string): string[];
16
- export declare function domainSetsLibrary(): IdTable;
15
+ export declare function ancestors(dom: DomainLiteral): DomainLiteral[];
16
+ export declare function domainSetsLibrary(): IdentifierDefinitions;
@@ -1,8 +1,8 @@
1
- /* 0.15.0 */
2
- import { IComputeEngine, IdTable } from '../public';
3
- export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): Readonly<IdTable>[];
1
+ /* 0.17.0 */
2
+ import { FunctionDefinition, IComputeEngine, IdentifierDefinitions, SymbolDefinition } from '../public';
3
+ export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): readonly IdentifierDefinitions[];
4
4
  export declare const LIBRARIES: {
5
- [category in LibraryCategory]?: Readonly<IdTable> | Readonly<IdTable>[];
5
+ [category in LibraryCategory]?: IdentifierDefinitions | IdentifierDefinitions[];
6
6
  };
7
7
  /**
8
8
  * Set the symbol table of the current context (`engine.context`) to `table`
@@ -14,4 +14,6 @@ export declare const LIBRARIES: {
14
14
  * or function name that has not yet been added to the symbol table.
15
15
  *
16
16
  */
17
- export declare function setCurrentContextSymbolTable(engine: IComputeEngine, table: IdTable): void;
17
+ export declare function setIdentifierDefinitions(engine: IComputeEngine, table: IdentifierDefinitions): void;
18
+ export declare function isSymbolDefinition(def: any): def is SymbolDefinition;
19
+ export declare function isFunctionDefinition(def: any): def is FunctionDefinition;
@@ -0,0 +1,2 @@
1
+ /* 0.17.0 */
2
+ export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const LOGIC_LIBRARY: IdTable;
1
+ /* 0.17.0 */
2
+ export declare const LOGIC_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const POLYNOMIALS_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare function randomExpression(level?: number): Expression;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const RELOP_LIBRARY: IdTable;
1
+ /* 0.17.0 */
2
+ export declare const RELOP_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const SETS_LIBRARY: IdTable;
1
+ /* 0.17.0 */
2
+ export declare const SETS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const STATISTICS_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.15.0 */
2
- export declare const TRIGONOMETRY_LIBRARY: IdTable[];
1
+ /* 0.17.0 */
2
+ export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,2 @@
1
- /* 0.15.0 */
2
- export declare function isSymbolDefinition(def: BoxedSymbolDefinition | BoxedFunctionDefinition | SymbolDefinition | FunctionDefinition | undefined | null): def is BoxedSymbolDefinition;
3
- export declare function isFunctionDefinition(def: BoxedSymbolDefinition | BoxedFunctionDefinition | SymbolDefinition | FunctionDefinition | undefined | null): def is BoxedFunctionDefinition;
1
+ /* 0.17.0 */
4
2
  export declare function normalizeLimits(range: BoxedExpression): [index: string, lower: number, upper: number, isFinite: boolean];
@@ -1,4 +1,4 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare function bigint(a: Decimal | number | bigint | string): bigint;
3
3
  export declare function gcd(a: bigint, b: bigint): bigint;
4
4
  export declare function lcm(a: bigint, b: bigint): bigint;
@@ -1,9 +1,10 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  import { IComputeEngine } from '../public';
3
3
  export declare function gcd(a: Decimal, b: Decimal): Decimal;
4
4
  export declare function lcm(a: Decimal, b: Decimal): Decimal;
5
5
  export declare function factorial(ce: IComputeEngine, n: Decimal): Decimal;
6
- export declare function lngamma(ce: IComputeEngine, z: Decimal): Decimal;
6
+ export declare function factorial2(ce: IComputeEngine, n: Decimal): Decimal;
7
+ export declare function gammaln(ce: IComputeEngine, z: Decimal): Decimal;
7
8
  export declare function gamma(ce: IComputeEngine, z: Decimal): Decimal;
8
9
  /**
9
10
  * If the exponent of the bignum is in the range of the exponents
@@ -1,3 +1,3 @@
1
- /* 0.15.0 */
1
+ /* 0.17.0 */
2
2
  export declare function gamma(c: Complex): Complex;
3
- export declare function lngamma(c: Complex): Complex;
3
+ export declare function gammaln(c: Complex): Complex;