@cortex-js/compute-engine 0.27.0 → 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 +2055 -964
  2. package/dist/compute-engine.js +2055 -964
  3. package/dist/compute-engine.min.esm.js +54 -51
  4. package/dist/compute-engine.min.js +54 -51
  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 +2 -2
  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 +10 -8
  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 +10 -3
  38. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +11 -7
  39. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -3
  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 +6 -5
  44. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +3 -3
  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 +1 -1
  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 +64 -54
  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 +1 -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 +2 -2
  70. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  71. package/dist/types/compute-engine/compile.d.ts +1 -1
  72. package/dist/types/compute-engine/compute-engine.d.ts +25 -12
  73. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  74. package/dist/types/compute-engine/debug.d.ts +1 -1
  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 +1 -1
  95. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  96. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  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 +1 -1
  124. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  125. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  126. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  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 +1 -1
  132. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  133. package/dist/types/compute-engine/private.d.ts +1 -1
  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 +1 -1
  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.27.0 */
1
+ /* 0.28.0 */
2
2
  /** Convert two or more types into a more specific type that is a subtype of
3
3
  * all the input types. The resulting type is usually more constrained and
4
4
  * only encompasses values that belong to both input types.
@@ -27,13 +27,9 @@ export declare function narrow(...types: Readonly<Type>[]): Type;
27
27
  * widen('number', 'expression') => 'expression'
28
28
  * widen('number', 'string') => 'any'
29
29
  */
30
- export declare function widen(...types: Readonly<Type>[]): Type;
30
+ export declare function widen(...types: Readonly<Type>[]): Readonly<Type>;
31
31
  export declare function isSignatureType(type: Readonly<Type> | TypeString): type is FunctionSignature;
32
32
  export declare function functionSignature(type: Readonly<Type>): Type | undefined;
33
- export declare function functionResult(type: Readonly<Type>): Type | undefined;
33
+ export declare function functionResult(type: Readonly<Type> | undefined): Type | undefined;
34
34
  export declare function collectionElementType(type: Readonly<Type>): Type | undefined;
35
35
  export declare function isValidType(t: any): t is Readonly<Type>;
36
- /**
37
- * Add a `toString()` method to the type object
38
- */
39
- export declare function makeType(type: Type): Readonly<Type>;
@@ -1,2 +1,2 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export declare function hidePrivateProperties(obj: any): void;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * Add an assumption, in the form of a predicate, for example:
4
4
  *
@@ -1,9 +1,10 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Expression, MathJsonIdentifier } from '../../math-json/types';
3
3
  import type { BoxedBaseDefinition, BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSubstitution, BoxedSymbolDefinition, CanonicalOptions, EvaluateOptions, IComputeEngine, JsonSerializationOptions, Metadata, PatternMatchOptions, Rule, RuntimeScope, Sign, SimplifyOptions, Substitution } from './public';
4
4
  import type { LatexString } from '../public';
5
5
  import type { NumericValue } from '../numeric-value/public';
6
6
  import type { SmallInteger } from '../numerics/numeric';
7
+ import { CompiledType } from '../compile';
7
8
  import type { SerializeLatexOptions } from '../latex-syntax/public';
8
9
  import { AsciiMathOptions } from './ascii-math';
9
10
  /**
@@ -116,7 +117,7 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
116
117
  canonical: CanonicalOptions;
117
118
  recursive?: boolean;
118
119
  }): BoxedExpression;
119
- solve(_vars: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
120
+ solve(_vars?: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
120
121
  replace(_rules: BoxedRuleSet | Rule | Rule[]): null | BoxedExpression;
121
122
  has(_v: string | string[]): boolean;
122
123
  get isPositive(): boolean | undefined;
@@ -130,13 +131,13 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
130
131
  get baseDefinition(): BoxedBaseDefinition | undefined;
131
132
  get symbolDefinition(): BoxedSymbolDefinition | undefined;
132
133
  get functionDefinition(): BoxedFunctionDefinition | undefined;
133
- infer(t: Type): boolean;
134
+ infer(_t: Type): boolean;
134
135
  bind(): void;
135
136
  reset(): void;
136
137
  get value(): number | boolean | string | object | undefined;
137
138
  set value(_value: BoxedExpression | number | boolean | string | number[] | undefined);
138
- get type(): Type;
139
- set type(_type: Type);
139
+ get type(): BoxedType;
140
+ set type(_type: Type | TypeString | BoxedType);
140
141
  get isNumber(): boolean | undefined;
141
142
  get isInteger(): boolean | undefined;
142
143
  get isRational(): boolean | undefined;
@@ -144,15 +145,15 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
144
145
  simplify(_options?: Partial<SimplifyOptions>): BoxedExpression;
145
146
  expand(): BoxedExpression;
146
147
  evaluate(_options?: Partial<EvaluateOptions>): BoxedExpression;
148
+ evaluateAsync(_options?: Partial<EvaluateOptions>): Promise<BoxedExpression>;
147
149
  N(): BoxedExpression;
148
150
  compile(options?: {
149
151
  to?: 'javascript';
150
- optimize?: ('simplify' | 'evaluate')[];
151
152
  functions?: Record<MathJsonIdentifier, string | ((...any: any[]) => any)>;
152
153
  vars?: Record<MathJsonIdentifier, string>;
153
154
  imports?: Function[];
154
155
  preamble?: string;
155
- }): (args: Record<string, any>) => any | undefined;
156
+ }): (args: Record<string, any>) => CompiledType;
156
157
  get isCollection(): boolean;
157
158
  contains(_rhs: BoxedExpression): boolean;
158
159
  subsetOf(_target: BoxedExpression, _strict: boolean): boolean;
@@ -163,5 +164,6 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
163
164
  indexOf(_expr: BoxedExpression): number;
164
165
  }
165
166
  export declare function getSubexpressions(expr: BoxedExpression, name: MathJsonIdentifier): ReadonlyArray<BoxedExpression>;
166
- import { Type } from '../../common/type/types';
167
+ import type { Type, TypeString } from '../../common/type/types';
167
168
  import { AbstractTensor } from '../tensor/tensors';
169
+ import { BoxedType } from '../../common/type/boxed-type';
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import type { BoxedExpression } from '../public';
4
4
  export declare function apply(expr: BoxedExpression, fn: (x: number) => number | Complex, bigFn?: (x: Decimal) => Decimal | Complex | number, complexFn?: (x: Complex) => number | Complex): BoxedExpression | undefined;
@@ -1,5 +1,6 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Type } from '../../common/type/types';
3
+ import { BoxedType } from '../../common/type/boxed-type';
3
4
  /**
4
5
  *
5
6
  * The canonical form of `Add`:
@@ -10,6 +11,6 @@ import { Type } from '../../common/type/types';
10
11
  *
11
12
  */
12
13
  export declare function canonicalAdd(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
13
- export declare function addType(args: ReadonlyArray<BoxedExpression>): Type;
14
+ export declare function addType(args: ReadonlyArray<BoxedExpression>): Type | BoxedType;
14
15
  export declare function add(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
15
16
  export declare function addN(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * Canonical form of 'Divide' (and 'Rational')
4
4
  * - remove denominator of 1
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * The canonical form of `Multiply`:
4
4
  * - removes `1` anb `-1`
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { Rational } from '../numerics/rationals';
3
3
  export declare function asRadical(expr: BoxedExpression): Rational | null;
4
4
  export declare function canonicalPower(a: BoxedExpression, b: BoxedExpression): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export type AsciiMathSerializer = (expr: BoxedExpression, precedence?: number) => string;
3
3
  export type AsciiMathOptions = {
4
4
  symbols: Record<string, string>;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { IComputeEngine, SemiBoxedExpression, BoxedExpression, Metadata, CanonicalOptions } from './public';
4
4
  import { MathJsonIdentifier } from '../../math-json/types';
@@ -1,7 +1,8 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { BoxedExpression, CollectionHandlers, CompiledExpression, EvaluateOptions, Sign } from './public';
3
3
  import { Type, TypeString } from '../../common/type/types';
4
4
  import { OneOf } from '../../common/one-of';
5
+ import { BoxedType } from '../../common/type/boxed-type';
5
6
  export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition {
6
7
  engine: IComputeEngine;
7
8
  scope: RuntimeScope;
@@ -17,11 +18,11 @@ export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition
17
18
  pure: boolean;
18
19
  complexity: number;
19
20
  lazy: boolean;
20
- signature: Type;
21
+ signature: BoxedType;
21
22
  inferredSignature: boolean;
22
23
  type?: (ops: ReadonlyArray<BoxedExpression>, options: {
23
24
  engine: IComputeEngine;
24
- }) => Type | TypeString | undefined;
25
+ }) => BoxedType | Type | TypeString | undefined;
25
26
  sgn?: (ops: ReadonlyArray<BoxedExpression>, options: {
26
27
  engine: IComputeEngine;
27
28
  }) => Sign | undefined;
@@ -36,12 +37,18 @@ export declare class _BoxedFunctionDefinition implements BoxedFunctionDefinition
36
37
  evaluate?: (ops: ReadonlyArray<BoxedExpression>, options: Partial<EvaluateOptions> & {
37
38
  engine: IComputeEngine;
38
39
  }) => BoxedExpression | undefined;
40
+ evaluateAsync?: (ops: ReadonlyArray<BoxedExpression>, options?: Partial<EvaluateOptions> & {
41
+ engine?: IComputeEngine;
42
+ }) => Promise<BoxedExpression | undefined>;
39
43
  evalDimension?: (ops: ReadonlyArray<BoxedExpression>, options: {
40
44
  engine: IComputeEngine;
41
45
  }) => BoxedExpression;
42
46
  compile?: (expr: BoxedExpression) => CompiledExpression;
43
47
  collection?: Partial<CollectionHandlers>;
44
48
  constructor(ce: IComputeEngine, name: string, def: FunctionDefinition);
49
+ infer(sig: Type): void;
50
+ update(def: FunctionDefinition): void;
45
51
  reset(): void;
46
52
  }
47
53
  export declare function makeFunctionDefinition(engine: IComputeEngine, name: string, def: OneOf<[FunctionDefinition | BoxedFunctionDefinition]>): BoxedFunctionDefinition;
54
+ export declare function isBoxedFunctionDefinition(x: any): x is BoxedFunctionDefinition;
@@ -1,15 +1,16 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { BoxedFunctionDefinition, IComputeEngine, BoxedRuleSet, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOptions, RuntimeScope, BoxedSubstitution, EvaluateOptions, BoxedBaseDefinition, Rule, CanonicalOptions } from '../public';
3
3
  import type { BoxedExpression, Sign } from './public';
4
4
  import { NumericValue } from '../numeric-value/public';
5
5
  import { _BoxedExpression } from './abstract-boxed-expression';
6
6
  import { Type } from '../../common/type/types';
7
+ import { BoxedType } from '../../common/type/boxed-type';
7
8
  /**
8
- * A boxed function represent an expression that can be
9
- * represented by a function call.
9
+ * A boxed function represent an expression that can be represented by a
10
+ * function call.
10
11
  *
11
- * It is composed of an operator (the name of the function) and
12
- * a list of arguments.
12
+ * It is composed of an operator (the name of the function) and a list of
13
+ * arguments.
13
14
  *
14
15
  * It has a definition associated with it, based on the operator.
15
16
  * The definition contains the signature of the function, and the
@@ -98,11 +99,12 @@ export declare class BoxedFunction extends _BoxedExpression {
98
99
  get isReal(): boolean | undefined;
99
100
  get isFunctionExpression(): boolean;
100
101
  /** The type of the value of the function */
101
- get type(): Type;
102
+ get type(): BoxedType;
102
103
  simplify(options?: Partial<SimplifyOptions>): BoxedExpression;
103
104
  evaluate(options?: Partial<EvaluateOptions>): BoxedExpression;
105
+ evaluateAsync(options?: Partial<EvaluateOptions>): Promise<BoxedExpression>;
104
106
  N(): BoxedExpression;
105
- solve(vars: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
107
+ solve(vars?: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
106
108
  get isCollection(): boolean;
107
109
  contains(rhs: BoxedExpression): boolean;
108
110
  get size(): number;
@@ -111,4 +113,6 @@ export declare class BoxedFunction extends _BoxedExpression {
111
113
  get(index: BoxedExpression | string): BoxedExpression | undefined;
112
114
  indexOf(expr: BoxedExpression): number;
113
115
  subsetOf(rhs: BoxedExpression, strict: boolean): boolean;
116
+ _computeValue(options?: Partial<EvaluateOptions>): () => BoxedExpression;
117
+ _computeValueAsync(options?: Partial<EvaluateOptions>): () => Promise<BoxedExpression>;
114
118
  }
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import type { BoxedExpression, IComputeEngine, Metadata, PatternMatchOptions, BoxedSubstitution, EvaluateOptions, BoxedRuleSet, ReplaceOptions, Rule, Substitution, CanonicalOptions, SimplifyOptions, Sign } from '../public';
4
4
  import type { Expression, MathJsonNumber } from '../../math-json';
@@ -6,7 +6,7 @@ import { SmallInteger } from '../numerics/numeric';
6
6
  import { Rational } from '../numerics/rationals';
7
7
  import { ExactNumericValueData, NumericValue, NumericValueData } from '../numeric-value/public';
8
8
  import { _BoxedExpression } from './abstract-boxed-expression';
9
- import { Type } from '../../common/type/types';
9
+ import { BoxedType } from '../../common/type/boxed-type';
10
10
  /**
11
11
  * BoxedNumber
12
12
  *
@@ -54,7 +54,7 @@ export declare class BoxedNumber extends _BoxedExpression {
54
54
  root(exp: number | BoxedExpression): BoxedExpression;
55
55
  sqrt(): BoxedExpression;
56
56
  ln(semiBase?: number | BoxedExpression): BoxedExpression;
57
- get type(): Type;
57
+ get type(): BoxedType;
58
58
  get sgn(): Sign | undefined;
59
59
  get numerator(): BoxedExpression;
60
60
  get denominator(): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { BoxedExpression } from './public';
3
3
  export declare function isWildcard(expr: BoxedExpression): expr is BoxedSymbol;
4
4
  export declare function wildcardName(expr: BoxedExpression): string | null;
@@ -1,6 +1,6 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { _BoxedExpression } from './abstract-boxed-expression';
3
- import { Type } from '../../common/type/types';
3
+ import { BoxedType } from '../../common/type/boxed-type';
4
4
  /**
5
5
  * BoxedString
6
6
  *
@@ -15,7 +15,7 @@ export declare class BoxedString extends _BoxedExpression {
15
15
  get isPure(): boolean;
16
16
  get isCanonical(): boolean;
17
17
  set isCanonical(_va: boolean);
18
- get type(): Type;
18
+ get type(): BoxedType;
19
19
  get complexity(): number;
20
20
  get string(): string;
21
21
  match(pattern: BoxedExpression, _options?: PatternMatchOptions): BoxedSubstitution | null;
@@ -1,5 +1,6 @@
1
- /* 0.27.0 */
2
- import { Type } from '../../common/type/types';
1
+ /* 0.28.0 */
2
+ import { Type, TypeString } from '../../common/type/types';
3
+ import { BoxedType } from '../../common/type/boxed-type';
3
4
  /**
4
5
  * ### THEORY OF OPERATIONS
5
6
  *
@@ -51,8 +52,8 @@ export declare class _BoxedSymbolDefinition implements BoxedSymbolDefinition {
51
52
  reset(): void;
52
53
  get value(): BoxedExpression | undefined;
53
54
  set value(val: SemiBoxedExpression | number | undefined);
54
- get type(): Type;
55
- set type(type: Type);
55
+ get type(): BoxedType;
56
+ set type(type: Type | TypeString | BoxedType);
56
57
  get sgn(): Sign | undefined;
57
58
  set sgn(val: Sign | undefined);
58
59
  get even(): boolean | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { Expression } from '../../math-json/types';
3
3
  import type { Type, TypeString } from '../../common/type/types';
4
4
  import type { BoxedExpression, BoxedRuleSet, BoxedSymbolDefinition, IComputeEngine, EvaluateOptions, ReplaceOptions, SimplifyOptions, Substitution, Metadata, PatternMatchOptions, RuntimeScope, BoxedFunctionDefinition, BoxedBaseDefinition, BoxedSubstitution, Rule, CanonicalOptions, BoxedRule, Sign } from './public';
@@ -6,6 +6,7 @@ import { NumericValue } from '../numeric-value/public';
6
6
  import { _BoxedExpression } from './abstract-boxed-expression';
7
7
  import { BigNum } from '../numerics/bignum';
8
8
  import type { OneOf } from '../../common/one-of';
9
+ import { BoxedType } from '../../common/type/boxed-type';
9
10
  /**
10
11
  * BoxedSymbol
11
12
  *
@@ -64,7 +65,7 @@ export declare class BoxedSymbol extends _BoxedExpression {
64
65
  root(n: number | BoxedExpression): BoxedExpression;
65
66
  sqrt(): BoxedExpression;
66
67
  ln(semiBase?: number | BoxedExpression): BoxedExpression;
67
- solve(vars: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
68
+ solve(vars?: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
68
69
  get complexity(): number;
69
70
  get operator(): string;
70
71
  get symbol(): string;
@@ -72,7 +73,7 @@ export declare class BoxedSymbol extends _BoxedExpression {
72
73
  get symbolDefinition(): BoxedSymbolDefinition | undefined;
73
74
  get functionDefinition(): BoxedFunctionDefinition | undefined;
74
75
  /**
75
- * Subsequence inferences will narrow the domain of the symbol.
76
+ * Subsequent inferences will narrow the domain of the symbol.
76
77
  * f: integer -> real, g: real -> real
77
78
  * g(x) => x: real
78
79
  * f(x) => x: integer narrowed from integer to real
@@ -90,8 +91,8 @@ export declare class BoxedSymbol extends _BoxedExpression {
90
91
  },
91
92
  BoxedExpression
92
93
  ]> | number | object | undefined);
93
- get type(): Type;
94
- set type(t: Type | TypeString);
94
+ get type(): BoxedType;
95
+ set type(t: Type | TypeString | BoxedType);
95
96
  get sgn(): Sign | undefined;
96
97
  has(x: string | string[]): boolean;
97
98
  match(pattern: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
@@ -1,10 +1,10 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { BoxedExpression, IComputeEngine, EvaluateOptions, SimplifyOptions, Metadata, BoxedSubstitution, PatternMatchOptions, BoxedBaseDefinition, BoxedFunctionDefinition } from '../public';
3
3
  import { TensorDataType } from './tensor-fields';
4
4
  import { NumericValue } from '../numeric-value/public';
5
5
  import { _BoxedExpression } from './abstract-boxed-expression';
6
6
  import { AbstractTensor, TensorData } from '../tensor/tensors';
7
- import { Type } from '../../common/type/types';
7
+ import { BoxedType } from '../../common/type/boxed-type';
8
8
  /**
9
9
  * A boxed tensor represents an expression that can be represented by a tensor.
10
10
  * This could be a vector, matrix or multi-dimensional array.
@@ -66,7 +66,7 @@ export declare class BoxedTensor extends _BoxedExpression {
66
66
  sqrt(): BoxedExpression;
67
67
  get shape(): number[];
68
68
  get rank(): number;
69
- get type(): Type;
69
+ get type(): BoxedType;
70
70
  get json(): Expression;
71
71
  /** Mathematical equality */
72
72
  isEqual(rhs: number | BoxedExpression): boolean | undefined;
@@ -1,6 +1,7 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  value: T | null;
3
3
  generation: number | undefined;
4
4
  };
5
5
  /** The cache v will get updated if necessary */
6
6
  export declare function cachedValue<T>(v: CachedValue<T>, generation: number | undefined, fn: () => T): T;
7
+ export declare function cachedValueAsync<T>(v: CachedValue<T>, generation: number | undefined, fn: () => Promise<T>): Promise<T>;
@@ -1,2 +1,2 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export declare function canonicalForm(expr: BoxedExpression, forms: CanonicalOptions): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * Structural equality of boxed expressions.
4
4
  */
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export declare function expandProducts(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null;
3
3
  export declare function choose(n: number, k: number): number;
4
4
  /** Attempt to transform the expression (h, ops) into a sum */
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export declare class ExpressionMap<U> implements ExpressionMapInterface<U> {
3
3
  readonly _items: Map<BoxedExpression, U>;
4
4
  constructor(source?: ExpressionMapInterface<U> | readonly (readonly [BoxedExpression, U])[]);
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { NumericValue } from '../numeric-value/public';
3
3
  /** Combine rational expressions into a single fraction */
4
4
  export declare function together(op: BoxedExpression): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  *
4
4
  * Make all the arguments canonical.
@@ -1,9 +1,10 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /** Apply the function `f` to each operand of the expression `expr`,
3
- * account for the 'hold' property of the function definition:
3
+ * account for the 'lazy' property of the function definition:
4
4
  *
5
5
  * Account for `Hold`, `ReleaseHold`, `Sequence`, `Symbol` and `Nothing`.
6
6
  *
7
7
  * If `f` returns `null`, the element is not added to the result
8
8
  */
9
9
  export declare function holdMap(expr: BoxedExpression, f: (x: BoxedExpression) => BoxedExpression | null): ReadonlyArray<BoxedExpression>;
10
+ export declare function holdMapAsync(expr: BoxedExpression, f: (x: BoxedExpression) => Promise<BoxedExpression | null>): Promise<ReadonlyArray<BoxedExpression>>;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * The function attempts to match a subject expression to a
4
4
  * [pattern](/compute-engine/guides/patterns-and-rules/).
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export declare function canonicalNegate(expr: BoxedExpression): BoxedExpression;
3
3
  /**
4
4
  * Distribute `Negate` (multiply by -1) if expr is a number literal, an
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import type { Rational } from '../numerics/rationals';
3
3
  import type { BoxedExpression } from './public';
4
4
  export declare function asRational(expr: BoxedExpression): Rational | undefined;
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  export type Order = 'lex' | 'dexlex' | 'grevlex' | 'elim';
3
3
  export declare const DEFAULT_COMPLEXITY = 100000;
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  /**
3
3
  * Coefficient of a univariate (single variable) polynomial.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.27.0 */
1
+ /* 0.28.0 */
2
2
  import { Rational } from '../numerics/rationals';
3
3
  import { NumericValue } from '../numeric-value/public';
4
4
  /**