@cortex-js/compute-engine 0.25.0 → 0.26.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.
- package/dist/compute-engine.esm.js +27153 -25341
- package/dist/compute-engine.js +27124 -25300
- package/dist/compute-engine.min.esm.js +88 -23
- package/dist/compute-engine.min.js +88 -23
- package/dist/math-json.esm.js +42 -196
- package/dist/math-json.js +42 -196
- package/dist/math-json.min.esm.js +42 -196
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +30 -4
- package/dist/types/common/buffer.d.ts +9 -0
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +9 -0
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/styled-text.d.ts +28 -0
- package/dist/types/common/suggest.d.ts +1 -0
- package/dist/types/common/syntax-highlighter.d.ts +40 -0
- package/dist/types/common/terminal.d.ts +19 -0
- package/dist/types/common/type/parse.d.ts +4 -0
- package/dist/types/common/type/primitive.d.ts +8 -0
- package/dist/types/common/type/serialize.d.ts +2 -0
- package/dist/types/common/type/subtype.d.ts +6 -0
- package/dist/types/common/type/types.d.ts +249 -0
- package/dist/types/common/type/utils.d.ts +39 -0
- package/dist/types/common/utils.d.ts +2 -1
- package/dist/types/compute-engine/assume.d.ts +13 -13
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +71 -47
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +5 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +15 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +12 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +16 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +20 -0
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +11 -0
- package/dist/types/compute-engine/boxed-expression/box.d.ts +13 -71
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +31 -13
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +66 -45
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +41 -37
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +13 -9
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +34 -66
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +63 -41
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +44 -27
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +6 -0
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +13 -0
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +20 -0
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +7 -6
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +25 -0
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +9 -0
- package/dist/types/compute-engine/boxed-expression/match.d.ts +2 -4
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +10 -0
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +5 -39
- package/dist/types/compute-engine/boxed-expression/order.d.ts +26 -14
- package/dist/types/compute-engine/{symbolic → boxed-expression}/polynomials.d.ts +11 -15
- package/dist/types/compute-engine/{symbolic → boxed-expression}/product.d.ts +18 -24
- package/dist/types/compute-engine/boxed-expression/public.d.ts +947 -656
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +129 -0
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +6 -0
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +6 -0
- package/dist/types/compute-engine/{solve.d.ts → boxed-expression/solve.d.ts} +5 -5
- package/dist/types/compute-engine/{symbolic → boxed-expression}/tensor-fields.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +10 -0
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +10 -0
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +22 -16
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +10 -7
- package/dist/types/compute-engine/collection-utils.d.ts +24 -2
- package/dist/types/compute-engine/compile.d.ts +3 -3
- package/dist/types/compute-engine/compute-engine.d.ts +133 -165
- package/dist/types/compute-engine/cost-function.d.ts +11 -1
- package/dist/types/compute-engine/function-utils.d.ts +5 -5
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +25 -30
- package/dist/types/compute-engine/latex-syntax/public.d.ts +22 -18
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +5 -8
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +4 -2
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +24 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -3
- package/dist/types/compute-engine/library/invisible-operator.d.ts +4 -0
- package/dist/types/compute-engine/library/library.d.ts +2 -4
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +5 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +46 -40
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +59 -0
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +77 -0
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +58 -0
- package/dist/types/compute-engine/numeric-value/public.d.ts +110 -0
- package/dist/types/compute-engine/numerics/bigint.d.ts +2 -0
- package/dist/types/compute-engine/numerics/bignum.d.ts +12 -0
- package/dist/types/compute-engine/numerics/expression.d.ts +4 -0
- package/dist/types/compute-engine/numerics/interval.d.ts +12 -0
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +19 -0
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +4 -14
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +6 -9
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +9 -59
- package/dist/types/compute-engine/numerics/primes.d.ts +3 -3
- package/dist/types/compute-engine/numerics/rationals.d.ts +29 -13
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +28 -0
- package/dist/types/compute-engine/numerics/strings.d.ts +2 -0
- package/dist/types/compute-engine/public.d.ts +8 -4
- package/dist/types/compute-engine/symbolic/derivative.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/distribute.d.ts +5 -0
- package/dist/types/compute-engine/{simplify-rules.d.ts → symbolic/simplify-rules.d.ts} +1 -1
- package/dist/types/compute-engine/{symbolic → tensor}/tensors.d.ts +3 -3
- package/dist/types/compute-engine.d.ts +4 -2
- package/dist/types/math-json/identifiers.d.ts +11 -0
- package/dist/types/math-json/{math-json-format.d.ts → types.d.ts} +4 -9
- package/dist/types/math-json/utils.d.ts +15 -23
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +11 -11
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +0 -48
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +0 -40
- package/dist/types/compute-engine/domain-utils.d.ts +0 -19
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +0 -21
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +0 -17
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +0 -16
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +0 -11
- package/dist/types/compute-engine/library/domains.d.ts +0 -16
- package/dist/types/compute-engine/numerics/terms.d.ts +0 -17
- package/dist/types/compute-engine/rules.d.ts +0 -20
- package/dist/types/compute-engine/symbolic/expand.d.ts +0 -23
- package/dist/types/compute-engine/symbolic/flatten.d.ts +0 -9
- package/dist/types/compute-engine/symbolic/negate.d.ts +0 -11
- package/dist/types/compute-engine/symbolic/utils.d.ts +0 -22
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
* A primitive type is a simple type that represents a concrete value.
|
|
3
|
+
*
|
|
4
|
+
* - `any`: the top type
|
|
5
|
+
* - `expression`
|
|
6
|
+
* - `error`: an invalid value, such as `["Error", "missing"]`
|
|
7
|
+
* - `nothing`: the type of the `Nothing` symbol, the unit type
|
|
8
|
+
* - `never`: the bottom type
|
|
9
|
+
* - `unknown`: a value whose type is not known
|
|
10
|
+
*
|
|
11
|
+
* - `expression`:
|
|
12
|
+
* - a symbolic expression, such as `["Add", "x", 1]`
|
|
13
|
+
* - <value>
|
|
14
|
+
* - `symbol`: a symbol, such as `x`.
|
|
15
|
+
* - `function`: a function expression
|
|
16
|
+
* such as `["Function", ["Add", "x", 1], "x"]`.
|
|
17
|
+
*
|
|
18
|
+
* - `value`
|
|
19
|
+
* - `scalar`
|
|
20
|
+
* - <number>
|
|
21
|
+
* - `boolean`: a boolean value: `True` or `False`.
|
|
22
|
+
* - `string`: a string of characters.
|
|
23
|
+
* - `collection`
|
|
24
|
+
* - `list`: a collection of expressions, possibly recursive,
|
|
25
|
+
* with optional dimensions, e.g. `[number]`, `[boolean^32]`,
|
|
26
|
+
* `[number^(2x3)]`. Used to represent a vector, a matrix or a
|
|
27
|
+
* tensor when the type of its elements is a number
|
|
28
|
+
* - `set`: a collection of unique expressions, e.g. `set<string>`.
|
|
29
|
+
* - `tuple`: a fixed-size collection of named or unnamed elements, e.g.
|
|
30
|
+
* `tuple<number, boolean>`, `tuple<x: number, y: boolean>`.
|
|
31
|
+
* - `map`: a set key-value pairs, e.g. `map<x: number, y: boolean>`.
|
|
32
|
+
*
|
|
33
|
+
* - `number`: any numeric value:
|
|
34
|
+
* - `finite_number`: <finite_complex> or <finite_imaginary> or
|
|
35
|
+
* <finite_real> or <finite_rational> or <finite_integer>
|
|
36
|
+
* - `non_finite_number`: `NaN`, `PositiveInfinity`, `NegativeInfinity` or
|
|
37
|
+
* `ComplexInfinity`
|
|
38
|
+
* - `complex` and `finite_complex`: a complex number, with non-zero real
|
|
39
|
+
* and imaginary parts.
|
|
40
|
+
* - `imaginary` and `finite_imaginary`: a complex number with a real part
|
|
41
|
+
* of 0 (pure imaginary).
|
|
42
|
+
* - `real` and `finite_real`: a complex number with an imaginary part of 0.
|
|
43
|
+
* - `rational` and `finite_rational`: a pure rational number
|
|
44
|
+
* (not an integer)
|
|
45
|
+
* - `integer` and `finite_integer`: a whole number
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export type PrimitiveType = NumericType | 'collection' | 'list' | 'set' | 'map' | 'tuple' | 'value' | 'scalar' | 'function' | 'symbol' | 'boolean' | 'string' | 'expression' | 'unknown' | 'error' | 'nothing' | 'never' | 'any';
|
|
50
|
+
export type NumericType = 'number' | 'finite_number' | 'complex' | 'finite_complex' | 'imaginary' | 'finite_imaginary' | 'real' | 'finite_real' | 'rational' | 'finite_rational' | 'integer' | 'finite_integer' | 'non_finite_number';
|
|
51
|
+
export type NamedElement = {
|
|
52
|
+
name?: string;
|
|
53
|
+
type: Type;
|
|
54
|
+
};
|
|
55
|
+
export type FunctionSignature = {
|
|
56
|
+
kind: 'signature';
|
|
57
|
+
args?: NamedElement[];
|
|
58
|
+
optArgs?: NamedElement[];
|
|
59
|
+
restArg?: NamedElement;
|
|
60
|
+
result: Type;
|
|
61
|
+
};
|
|
62
|
+
export type AlgebraicType = {
|
|
63
|
+
kind: 'union' | 'intersection';
|
|
64
|
+
types: Type[];
|
|
65
|
+
};
|
|
66
|
+
export type NegationType = {
|
|
67
|
+
kind: 'negation';
|
|
68
|
+
type: Type;
|
|
69
|
+
};
|
|
70
|
+
export type ValueType = {
|
|
71
|
+
kind: 'value';
|
|
72
|
+
value: any;
|
|
73
|
+
};
|
|
74
|
+
/** Map is not a collection. It is a set of key/value pairs.
|
|
75
|
+
* An element of a map whose type is a subtype of `nothing` is optional.
|
|
76
|
+
* For example, in `{x: number, y: boolean | nothing}` the element `y` is optional.
|
|
77
|
+
*/
|
|
78
|
+
export type MapType = {
|
|
79
|
+
kind: 'map';
|
|
80
|
+
elements: Record<string, Type>;
|
|
81
|
+
};
|
|
82
|
+
/** Collection, List, Set, Tuple and Map are collections.
|
|
83
|
+
*
|
|
84
|
+
* `CollectionType` is a generic collection of elements of a certain type.
|
|
85
|
+
*/
|
|
86
|
+
export type CollectionType = {
|
|
87
|
+
kind: 'collection';
|
|
88
|
+
elements: Type;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The elements of a list are ordered.
|
|
92
|
+
*
|
|
93
|
+
* All elements of a list have the same type (but it can be a broad type,
|
|
94
|
+
* up to `any`).
|
|
95
|
+
*
|
|
96
|
+
* The same element can be present in the list more than once.
|
|
97
|
+
*
|
|
98
|
+
* A list can be multi-dimensional. For example, a list of integers with
|
|
99
|
+
* dimensions 2x3x4 is a 3D tensor with 2 layers, 3 rows and 4 columns.
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
export type ListType = {
|
|
103
|
+
kind: 'list';
|
|
104
|
+
elements: Type;
|
|
105
|
+
dimensions?: number[];
|
|
106
|
+
};
|
|
107
|
+
/** Each element of a set is unique (is not present in the set more than once).
|
|
108
|
+
* The elements of a set are not ordered.
|
|
109
|
+
*/
|
|
110
|
+
export type SetType = {
|
|
111
|
+
kind: 'set';
|
|
112
|
+
elements: Type;
|
|
113
|
+
};
|
|
114
|
+
export type TupleType = {
|
|
115
|
+
kind: 'tuple';
|
|
116
|
+
elements: NamedElement[];
|
|
117
|
+
};
|
|
118
|
+
/** Nominal typing */
|
|
119
|
+
export type TypeReference = {
|
|
120
|
+
kind: 'reference';
|
|
121
|
+
ref: string;
|
|
122
|
+
};
|
|
123
|
+
export type Type = PrimitiveType | AlgebraicType | NegationType | CollectionType | ListType | SetType | MapType | TupleType | FunctionSignature | ValueType | TypeReference;
|
|
124
|
+
/**
|
|
125
|
+
* The type of a boxed expression indicates the kind of expression it is and
|
|
126
|
+
* the value it represents.
|
|
127
|
+
*
|
|
128
|
+
* The type is represented either by a primitive type (e.g. number, complex, collection, etc.), or a compound type (e.g. tuple, function signature, etc.).
|
|
129
|
+
*
|
|
130
|
+
* Types are described using the following BNF grammar:
|
|
131
|
+
|
|
132
|
+
```bnf
|
|
133
|
+
<type> ::= <union_type>
|
|
134
|
+
|
|
135
|
+
<union_type> ::= <intersection_type> (" | " <intersection_type>)*
|
|
136
|
+
|
|
137
|
+
<intersection_type> ::= <primary_type> (" & " <primary_type>)*
|
|
138
|
+
|
|
139
|
+
<primary_type> ::= <primitive>
|
|
140
|
+
| <tuple_type>
|
|
141
|
+
| <function_type>
|
|
142
|
+
| <list_type>
|
|
143
|
+
| <wrapped_primary_type>
|
|
144
|
+
|
|
145
|
+
<wrapped_primary_type> ::= "(" <primary_type> ")"
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
<primitive> ::= "any" | "unknown" | <value-type> | <symbolic-type> | <numeric-type>
|
|
149
|
+
|
|
150
|
+
<numeric-type> ::= "number" | "complex" | "imaginary" | "real" | "rational" | "integer"
|
|
151
|
+
|
|
152
|
+
<value-type> ::= "value" | <numeric-type> | "collection" | "boolean" | "string"
|
|
153
|
+
|
|
154
|
+
<symbolic-type> ::= "expression" | "function" | "symbol"
|
|
155
|
+
|
|
156
|
+
<tuple_type> ::= "(" (<name> <type> "," <named_tuple_elements>*) ")"
|
|
157
|
+
| "(" (<type> "," <unnamed_tuple_elements>*) ")" |
|
|
158
|
+
| "tuple(" <tuple_elements> ")"
|
|
159
|
+
|
|
160
|
+
<tuple_elements> ::= <unnamed_tuple_elements> | <named_tuple_elements>
|
|
161
|
+
|
|
162
|
+
<unnamed_tuple_elements> ::= <type> ("," <type>)*
|
|
163
|
+
|
|
164
|
+
<named_tuple_elements> ::= <name> <type> ("," <name> <type>)*
|
|
165
|
+
|
|
166
|
+
<function_type> ::= <arguments> " -> " <type>
|
|
167
|
+
|
|
168
|
+
<arguments> ::= "()"
|
|
169
|
+
| <argument>
|
|
170
|
+
| "(" <argument-list> ")"
|
|
171
|
+
| <deferred_evaluation>
|
|
172
|
+
|
|
173
|
+
<deferred_evaluation> ::= "???" <argument>
|
|
174
|
+
| "???" "(" <argument-list> ")"
|
|
175
|
+
|
|
176
|
+
<argument> ::= <type>
|
|
177
|
+
| <name> <type>
|
|
178
|
+
|
|
179
|
+
<rest_argument> ::= "..." <type>
|
|
180
|
+
| <name> "..." <type>
|
|
181
|
+
|
|
182
|
+
<optional_argument> ::= <argument> "?"
|
|
183
|
+
|
|
184
|
+
<optional_arguments> ::= <optional_argument> ("," <optional_argument>)*
|
|
185
|
+
|
|
186
|
+
<required_arguments> ::= <argument> ("," <argument>)*
|
|
187
|
+
|
|
188
|
+
<argument-list> ::= <required_arguments> ("," <rest_argument>)?
|
|
189
|
+
| <required_arguments> <optional_arguments>?
|
|
190
|
+
| <optional_arguments>?
|
|
191
|
+
| <rest_argument>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<list_type> ::= "[" <type> <dimensions>? "]"
|
|
195
|
+
|
|
196
|
+
<dimensions> ::= "^" <fixed_size>
|
|
197
|
+
| "^(" <multi_dimensional_size> ")"
|
|
198
|
+
|
|
199
|
+
<fixed_size> ::= <positive-integer_literal>
|
|
200
|
+
|
|
201
|
+
<multi_dimensional_size> ::= <positive-integer_literal> "x" <positive-integer_literal> ("x" <positive-integer_literal>)*
|
|
202
|
+
|
|
203
|
+
<map> ::= "{}"
|
|
204
|
+
|"{" <map_elements> "}"
|
|
205
|
+
| "map(" <map_elements> ")"
|
|
206
|
+
|
|
207
|
+
<map_elements> ::= <name> <type> ("," <name> <type>)*
|
|
208
|
+
|
|
209
|
+
<set> ::= "set<" <type> ">"
|
|
210
|
+
|
|
211
|
+
<collection ::= "collection<" <type> ">"
|
|
212
|
+
|
|
213
|
+
<name> ::= <identifier> ":"
|
|
214
|
+
|
|
215
|
+
<identifier> ::= [a-zA-Z_][a-zA-Z0-9_]*
|
|
216
|
+
|
|
217
|
+
<positive-integer_literal> ::= [1-9][0-9]*
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
Examples of types:
|
|
222
|
+
"number" -- a simple type primitive
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
"(number, boolean)" -- a tuple type
|
|
226
|
+
"(x: number, y:boolean)" -- a named tuple/record type. Either all arguments are named, or none are
|
|
227
|
+
|
|
228
|
+
"[any]" -- an arbitrary collection type, with no length or element type restrictions
|
|
229
|
+
"[integer]" -- a collection type where all the elements are integers
|
|
230
|
+
"[(number, boolean)]" -- a collection of tuples
|
|
231
|
+
"[(value:number, seen:boolean)]" -- a collection of named tuples
|
|
232
|
+
"[boolean]^32" -- a collection type with a fixed size of 32 elements
|
|
233
|
+
"[integer]^(2x3)" -- an integer matrix of 2 columns and 3 rows
|
|
234
|
+
"[integer]^(2x3x4)" -- a tensor of dimensions 2x3x4
|
|
235
|
+
|
|
236
|
+
"number -> number" -- a function type with a single argument
|
|
237
|
+
"(x: number, number) -> number" -- a function type with a named argument
|
|
238
|
+
"(number, y:number?) -> number" -- a function type with an optional named argument (can have several optional arguments, at the end)
|
|
239
|
+
"(number, ...number) -> number" -- a function type with a rest argument (can have only one, and no optional arguments if there is a rest argument).
|
|
240
|
+
"() -> number" -- a function type with an empty argument list
|
|
241
|
+
|
|
242
|
+
"number | boolean" -- a union type
|
|
243
|
+
"(x: number) & (y: number)" -- an intersection type
|
|
244
|
+
"number | ((x: number) & (y: number))" -- a union type with an intersection type
|
|
245
|
+
"(number -> number) | number" -- a union type with a function type
|
|
246
|
+
*/
|
|
247
|
+
export type TypeString = string;
|
|
248
|
+
export type TypeCompatibility = 'covariant' | 'contravariant' | 'bivariant' | 'invariant';
|
|
249
|
+
export type TypeResolver = (name: string) => Type | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
/** Convert two or more types into a more specific type that is a subtype of
|
|
3
|
+
* all the input types. The resulting type is usually more constrained and
|
|
4
|
+
* only encompasses values that belong to both input types.
|
|
5
|
+
*
|
|
6
|
+
* Examples:
|
|
7
|
+
* narrow('integer', 'rational') => 'integer'
|
|
8
|
+
* narrow('number', 'complex') => 'complex'
|
|
9
|
+
* narrow('number', 'collection') => 'nothing'
|
|
10
|
+
* narrow('number', 'value') => 'value'
|
|
11
|
+
* narrow('number', 'expression') => 'expression'
|
|
12
|
+
* narrow('number', 'string') => 'nothing'
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare function narrow(...types: Readonly<Type>[]): Type;
|
|
17
|
+
/**
|
|
18
|
+
* Convert two or more types into a broader, more general type that can
|
|
19
|
+
* accommodate all the input types. The resulting type is usually a supertype
|
|
20
|
+
* that encompasses the possible values of the input types
|
|
21
|
+
*
|
|
22
|
+
* Examples:
|
|
23
|
+
* widen('integer', 'rational') => 'rational'
|
|
24
|
+
* widen('number', 'complex') => 'complex'
|
|
25
|
+
* widen('number', 'collection') => 'collection'
|
|
26
|
+
* widen('number', 'value') => 'value'
|
|
27
|
+
* widen('number', 'expression') => 'expression'
|
|
28
|
+
* widen('number', 'string') => 'any'
|
|
29
|
+
*/
|
|
30
|
+
export declare function widen(...types: Readonly<Type>[]): Type;
|
|
31
|
+
export declare function isSignatureType(type: Readonly<Type> | TypeString): type is FunctionSignature;
|
|
32
|
+
export declare function functionSignature(type: Readonly<Type>): Type | undefined;
|
|
33
|
+
export declare function functionResult(type: Readonly<Type>): Type | undefined;
|
|
34
|
+
export declare function collectionElementType(type: Readonly<Type>): Type | undefined;
|
|
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 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
export declare function hidePrivateProperties(obj: any): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.26.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Add an assumption, in the form of a predicate, for example:
|
|
4
4
|
*
|
|
@@ -7,20 +7,20 @@
|
|
|
7
7
|
* - `x > 3`
|
|
8
8
|
* - `x + y = 5`
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* (and an entry for the symbol is created if necessary).
|
|
15
|
-
*
|
|
16
|
-
* New assumptions can 'refine' previous assumptions, that is they are valid
|
|
17
|
-
* if they don't contradict previous assumptions. To set new assumptions
|
|
18
|
-
* that contradict previous ones, you must first `forget` about any symbols
|
|
19
|
-
* in the new assumption.
|
|
10
|
+
* Assumptions that represent a symbol definition (equality to an expression,
|
|
11
|
+
* membership to a type, >0, <=0, etc...) are stored directly in the current
|
|
12
|
+
* scope's symbols dictionary, and an entry for the symbol is created if
|
|
13
|
+
* necessary.
|
|
20
14
|
*
|
|
21
15
|
* Predicates that involve multiple symbols are simplified (for example
|
|
22
|
-
* `x + y = 5` becomes `x + y - 5 = 0
|
|
23
|
-
* current context
|
|
16
|
+
* `x + y = 5` becomes `x + y - 5 = 0`), then stored in the `assumptions`
|
|
17
|
+
* record of the current context.
|
|
18
|
+
*
|
|
19
|
+
* New assumptions can 'refine' previous assumptions, if they don't contradict
|
|
20
|
+
* previous assumptions.
|
|
21
|
+
*
|
|
22
|
+
* To set new assumptions that contradict previous ones, you must first
|
|
23
|
+
* `forget` about any symbols in the new assumption.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
export declare function assume(proposition: BoxedExpression): AssumeResult;
|
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { LatexString } from '../public';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { SerializeLatexOptions } from '../latex-syntax/public';
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
import { Expression, MathJsonIdentifier } from '../../math-json/types';
|
|
3
|
+
import type { BoxedBaseDefinition, BoxedExpression, BoxedFunctionDefinition, BoxedRuleSet, BoxedSubstitution, BoxedSymbolDefinition, CanonicalOptions, EvaluateOptions, IComputeEngine, JsonSerializationOptions, Metadata, PatternMatchOptions, Rule, RuntimeScope, Sign, SimplifyOptions, Substitution } from './public';
|
|
4
|
+
import type { LatexString } from '../public';
|
|
5
|
+
import type { NumericValue } from '../numeric-value/public';
|
|
6
|
+
import type { SmallInteger } from '../numerics/numeric';
|
|
7
|
+
import type { SerializeLatexOptions } from '../latex-syntax/public';
|
|
8
|
+
import { AsciiMathOptions } from './ascii-math';
|
|
8
9
|
/**
|
|
9
10
|
* _BoxedExpression
|
|
10
11
|
*/
|
|
11
12
|
export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
12
13
|
abstract readonly hash: number;
|
|
13
14
|
abstract readonly json: Expression;
|
|
14
|
-
abstract readonly
|
|
15
|
+
abstract readonly operator: string;
|
|
16
|
+
/** @deprecated */
|
|
17
|
+
get head(): string;
|
|
15
18
|
abstract get isCanonical(): boolean;
|
|
16
19
|
abstract set isCanonical(_val: boolean);
|
|
17
|
-
abstract
|
|
18
|
-
abstract isEqual(rhs: BoxedExpression): boolean;
|
|
19
|
-
abstract match(pattern: Decimal | Complex | [num: number, denom: number] | SemiBoxedExpression | BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
20
|
+
abstract match(pattern: BoxedExpression, options?: PatternMatchOptions): BoxedSubstitution | null;
|
|
20
21
|
readonly engine: IComputeEngine;
|
|
21
22
|
/** Verbatim LaTeX, obtained from a source, i.e. from parsing,
|
|
22
23
|
* not generated synthetically
|
|
23
24
|
*/
|
|
24
25
|
verbatimLatex?: string;
|
|
25
26
|
constructor(ce: IComputeEngine, metadata?: Metadata);
|
|
27
|
+
isSame(rhs: BoxedExpression): boolean;
|
|
28
|
+
isEqual(rhs: number | BoxedExpression): boolean | undefined;
|
|
29
|
+
isLess(_rhs: number | BoxedExpression): boolean | undefined;
|
|
30
|
+
isLessEqual(_rhs: number | BoxedExpression): boolean | undefined;
|
|
31
|
+
isGreater(_rhs: number | BoxedExpression): boolean | undefined;
|
|
32
|
+
isGreaterEqual(_rhs: number | BoxedExpression): boolean | undefined;
|
|
26
33
|
/**
|
|
27
34
|
*
|
|
28
35
|
* `Object.valueOf()`: return a JavaScript primitive value for the expression
|
|
@@ -30,7 +37,8 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
30
37
|
* Primitive values are: boolean, number, bigint, string, null, undefined
|
|
31
38
|
*
|
|
32
39
|
*/
|
|
33
|
-
valueOf(): number |
|
|
40
|
+
valueOf(): number | object | string | boolean;
|
|
41
|
+
toAsciiMath(options?: Partial<AsciiMathOptions>): string;
|
|
34
42
|
/** Object.toString() */
|
|
35
43
|
toString(): string;
|
|
36
44
|
print(): void;
|
|
@@ -43,43 +51,62 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
43
51
|
toJSON(): Expression;
|
|
44
52
|
toMathJson(options?: Readonly<Partial<JsonSerializationOptions>>): Expression;
|
|
45
53
|
toLatex(options?: Partial<SerializeLatexOptions>): LatexString;
|
|
54
|
+
toNumericValue(): [NumericValue, BoxedExpression];
|
|
46
55
|
get scope(): RuntimeScope | null;
|
|
47
|
-
/** Object.is() */
|
|
48
56
|
is(rhs: any): boolean;
|
|
49
57
|
get canonical(): BoxedExpression;
|
|
58
|
+
get structural(): BoxedExpression;
|
|
59
|
+
get isStructural(): boolean;
|
|
50
60
|
get latex(): LatexString;
|
|
51
61
|
set latex(val: LatexString);
|
|
52
62
|
get symbol(): string | null;
|
|
63
|
+
get tensor(): null | AbstractTensor<'expression'>;
|
|
53
64
|
get string(): string | null;
|
|
54
|
-
getSubexpressions(
|
|
65
|
+
getSubexpressions(operator: MathJsonIdentifier): ReadonlyArray<BoxedExpression>;
|
|
55
66
|
get subexpressions(): ReadonlyArray<BoxedExpression>;
|
|
56
67
|
get symbols(): ReadonlyArray<string>;
|
|
57
68
|
get unknowns(): ReadonlyArray<string>;
|
|
58
69
|
get freeVariables(): ReadonlyArray<string>;
|
|
59
70
|
get errors(): ReadonlyArray<BoxedExpression>;
|
|
60
71
|
get ops(): null | ReadonlyArray<BoxedExpression>;
|
|
61
|
-
get nops():
|
|
72
|
+
get nops(): SmallInteger;
|
|
62
73
|
get op1(): BoxedExpression;
|
|
63
74
|
get op2(): BoxedExpression;
|
|
64
75
|
get op3(): BoxedExpression;
|
|
65
76
|
get isValid(): boolean;
|
|
66
77
|
get isPure(): boolean;
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
/** Literals (number, string, boolean) are constants. Some symbols
|
|
79
|
+
* may also be constants (e.g. Pi, E, True, False). Expressions of constant
|
|
80
|
+
* symbols are also constants (if the function is pure).
|
|
81
|
+
*/
|
|
69
82
|
get isConstant(): boolean;
|
|
70
83
|
get isNaN(): boolean | undefined;
|
|
71
|
-
get isZero(): boolean | undefined;
|
|
72
|
-
get isNotZero(): boolean | undefined;
|
|
73
|
-
get isOne(): boolean | undefined;
|
|
74
|
-
get isNegativeOne(): boolean | undefined;
|
|
75
84
|
get isInfinity(): boolean | undefined;
|
|
76
85
|
get isFinite(): boolean | undefined;
|
|
77
86
|
get isEven(): boolean | undefined;
|
|
78
87
|
get isOdd(): boolean | undefined;
|
|
79
|
-
get
|
|
80
|
-
get
|
|
81
|
-
get
|
|
82
|
-
get
|
|
88
|
+
get numericValue(): number | NumericValue | null;
|
|
89
|
+
get isNumberLiteral(): boolean;
|
|
90
|
+
get isFunctionExpression(): boolean;
|
|
91
|
+
get re(): number;
|
|
92
|
+
get im(): number;
|
|
93
|
+
get bignumRe(): Decimal | undefined;
|
|
94
|
+
get bignumIm(): Decimal | undefined;
|
|
95
|
+
get numerator(): BoxedExpression;
|
|
96
|
+
get denominator(): BoxedExpression;
|
|
97
|
+
get numeratorDenominator(): [BoxedExpression, BoxedExpression];
|
|
98
|
+
neg(): BoxedExpression;
|
|
99
|
+
inv(): BoxedExpression;
|
|
100
|
+
abs(): BoxedExpression;
|
|
101
|
+
add(rhs: number | BoxedExpression): BoxedExpression;
|
|
102
|
+
sub(rhs: BoxedExpression): BoxedExpression;
|
|
103
|
+
mul(rhs: NumericValue | number | BoxedExpression): BoxedExpression;
|
|
104
|
+
div(rhs: number | BoxedExpression): BoxedExpression;
|
|
105
|
+
pow(exp: number | BoxedExpression): BoxedExpression;
|
|
106
|
+
root(exp: number | BoxedExpression): BoxedExpression;
|
|
107
|
+
sqrt(): BoxedExpression;
|
|
108
|
+
ln(base?: number | BoxedExpression): BoxedExpression;
|
|
109
|
+
get sgn(): Sign | undefined;
|
|
83
110
|
get shape(): number[];
|
|
84
111
|
get rank(): number;
|
|
85
112
|
subs(_sub: Substitution, options?: {
|
|
@@ -87,19 +114,15 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
87
114
|
}): BoxedExpression;
|
|
88
115
|
map(fn: (x: BoxedExpression) => BoxedExpression, options?: {
|
|
89
116
|
canonical: CanonicalOptions;
|
|
117
|
+
recursive?: boolean;
|
|
90
118
|
}): BoxedExpression;
|
|
91
119
|
solve(_vars: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
|
|
92
120
|
replace(_rules: BoxedRuleSet | Rule | Rule[]): null | BoxedExpression;
|
|
93
121
|
has(_v: string | string[]): boolean;
|
|
94
|
-
isLess(_rhs: BoxedExpression): boolean | undefined;
|
|
95
|
-
isLessEqual(_rhs: BoxedExpression): boolean | undefined;
|
|
96
|
-
isGreater(_rhs: BoxedExpression): boolean | undefined;
|
|
97
|
-
isGreaterEqual(_rhs: BoxedExpression): boolean | undefined;
|
|
98
122
|
get isPositive(): boolean | undefined;
|
|
99
123
|
get isNonNegative(): boolean | undefined;
|
|
100
124
|
get isNegative(): boolean | undefined;
|
|
101
125
|
get isNonPositive(): boolean | undefined;
|
|
102
|
-
isCompatible(_dom: BoxedDomain | DomainLiteral, _kind?: DomainCompatibility): boolean;
|
|
103
126
|
get description(): string[] | undefined;
|
|
104
127
|
get url(): string | undefined;
|
|
105
128
|
get wikidata(): string | undefined;
|
|
@@ -107,31 +130,32 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
107
130
|
get baseDefinition(): BoxedBaseDefinition | undefined;
|
|
108
131
|
get symbolDefinition(): BoxedSymbolDefinition | undefined;
|
|
109
132
|
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
110
|
-
infer(
|
|
133
|
+
infer(t: Type): boolean;
|
|
111
134
|
bind(): void;
|
|
112
135
|
reset(): void;
|
|
113
|
-
get
|
|
114
|
-
get keysCount(): number;
|
|
115
|
-
getKey(_key: string): BoxedExpression | undefined;
|
|
116
|
-
hasKey(_key: string): boolean;
|
|
117
|
-
get value(): number | boolean | string | Object | undefined;
|
|
136
|
+
get value(): number | boolean | string | object | undefined;
|
|
118
137
|
set value(_value: BoxedExpression | number | boolean | string | number[] | undefined);
|
|
119
|
-
get
|
|
120
|
-
set
|
|
138
|
+
get type(): Type;
|
|
139
|
+
set type(_type: Type);
|
|
121
140
|
get isNumber(): boolean | undefined;
|
|
122
141
|
get isInteger(): boolean | undefined;
|
|
123
142
|
get isRational(): boolean | undefined;
|
|
124
|
-
get isAlgebraic(): boolean | undefined;
|
|
125
143
|
get isReal(): boolean | undefined;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
get isExtendedComplex(): boolean | undefined;
|
|
130
|
-
simplify(_options?: SimplifyOptions): BoxedExpression;
|
|
131
|
-
evaluate(_options?: EvaluateOptions): BoxedExpression;
|
|
132
|
-
N(_options?: NOptions): BoxedExpression;
|
|
144
|
+
simplify(_options?: Partial<SimplifyOptions>): BoxedExpression;
|
|
145
|
+
evaluate(_options?: Partial<EvaluateOptions>): BoxedExpression;
|
|
146
|
+
N(): BoxedExpression;
|
|
133
147
|
compile(to?: string, options?: {
|
|
134
148
|
optimize: ('simplify' | 'evaluate')[];
|
|
135
149
|
}): ((args: Record<string, any>) => any | undefined) | undefined;
|
|
150
|
+
get isCollection(): boolean;
|
|
151
|
+
contains(_rhs: BoxedExpression): boolean;
|
|
152
|
+
subsetOf(_target: BoxedExpression, _strict: boolean): boolean;
|
|
153
|
+
get size(): number;
|
|
154
|
+
each(_start?: number, _count?: number): Iterator<BoxedExpression, undefined>;
|
|
155
|
+
at(_index: number): BoxedExpression | undefined;
|
|
156
|
+
get(_key: string | BoxedExpression): BoxedExpression | undefined;
|
|
157
|
+
indexOf(_expr: BoxedExpression): number;
|
|
136
158
|
}
|
|
137
|
-
export declare function getSubexpressions(expr: BoxedExpression,
|
|
159
|
+
export declare function getSubexpressions(expr: BoxedExpression, name: MathJsonIdentifier): ReadonlyArray<BoxedExpression>;
|
|
160
|
+
import { Type } from '../../common/type/types';
|
|
161
|
+
import { AbstractTensor } from '../tensor/tensors';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
import { Decimal } from 'decimal.js';
|
|
3
|
+
import type { BoxedExpression } from '../public';
|
|
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;
|
|
5
|
+
export declare function apply2(expr1: BoxedExpression, expr2: BoxedExpression, fn: (x1: number, x2: number) => number | Complex, bigFn?: (x1: Decimal, x2: Decimal) => Decimal | Complex | number, complexFn?: (x1: Complex, x2: number | Complex) => Complex | number): BoxedExpression | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
import { Type } from '../../common/type/types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* The canonical form of `Add`:
|
|
6
|
+
* - canonicalize the arguments
|
|
7
|
+
* - remove `0`
|
|
8
|
+
* - capture complex numbers (`a + ib` or `ai + b`)
|
|
9
|
+
* - sort the terms
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare function canonicalAdd(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
13
|
+
export declare function addType(args: ReadonlyArray<BoxedExpression>): Type;
|
|
14
|
+
export declare function add(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
15
|
+
export declare function addN(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
/**
|
|
3
|
+
* Canonical form of 'Divide' (and 'Rational')
|
|
4
|
+
* - remove denominator of 1
|
|
5
|
+
* - simplify the signs
|
|
6
|
+
* - factor out negate (make the numerator and denominator positive)
|
|
7
|
+
* - if numerator and denominator are integer literals, return a rational number
|
|
8
|
+
* or Rational expression
|
|
9
|
+
* - evaluate number literals
|
|
10
|
+
*/
|
|
11
|
+
export declare function canonicalDivide(op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
|
|
12
|
+
export declare function div(num: BoxedExpression, denom: number | BoxedExpression): BoxedExpression;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
/**
|
|
3
|
+
* The canonical form of `Multiply`:
|
|
4
|
+
* - removes `1` anb `-1`
|
|
5
|
+
* - simplifies the signs:
|
|
6
|
+
* - i.e. `-y \times -x` -> `x \times y`
|
|
7
|
+
* - `2 \times -x` -> `-2 \times x`
|
|
8
|
+
* - arguments are sorted
|
|
9
|
+
* - complex numbers promoted (['Multiply', 2, 'ImaginaryUnit'] -> 2i)
|
|
10
|
+
* - Numeric values are promoted (['Multiply', 2, 'Sqrt', 3] -> 2√3)
|
|
11
|
+
*
|
|
12
|
+
* The input ops may not be canonical, the result is canonical.
|
|
13
|
+
*/
|
|
14
|
+
export declare function canonicalMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
15
|
+
export declare function mul(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
16
|
+
export declare function mulN(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
import type { Rational } from '../numerics/rationals';
|
|
3
|
+
export declare function asRadical(expr: BoxedExpression): Rational | null;
|
|
4
|
+
export declare function canonicalPower(a: BoxedExpression, b: BoxedExpression): BoxedExpression;
|
|
5
|
+
export declare function canonicalRoot(a: BoxedExpression, b: BoxedExpression | number): BoxedExpression;
|
|
6
|
+
/**
|
|
7
|
+
* The power function.
|
|
8
|
+
*
|
|
9
|
+
* It follows the same conventions as SymPy, which do not always
|
|
10
|
+
* conform to IEEE 754 floating point arithmetic.
|
|
11
|
+
*
|
|
12
|
+
* See https://docs.sympy.org/latest/modules/core.html#sympy.core.power.Pow
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare function pow(x: BoxedExpression, exp: number | BoxedExpression, { numericApproximation }: {
|
|
16
|
+
numericApproximation: boolean;
|
|
17
|
+
}): BoxedExpression;
|
|
18
|
+
export declare function root(a: BoxedExpression, b: BoxedExpression, { numericApproximation }: {
|
|
19
|
+
numericApproximation: boolean;
|
|
20
|
+
}): BoxedExpression;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* 0.26.0 */
|
|
2
|
+
export type AsciiMathSerializer = (expr: BoxedExpression, precedence?: number) => string;
|
|
3
|
+
export type AsciiMathOptions = {
|
|
4
|
+
symbols: Record<string, string>;
|
|
5
|
+
operators: Record<string, [
|
|
6
|
+
string | ((expr: BoxedExpression) => string),
|
|
7
|
+
number
|
|
8
|
+
]>;
|
|
9
|
+
functions: Record<string, string | ((expr: BoxedExpression, serialize: AsciiMathSerializer) => string)>;
|
|
10
|
+
};
|
|
11
|
+
export declare function toAsciiMath(expr: BoxedExpression, options?: Partial<AsciiMathOptions>, precedence?: number): string;
|