@cortex-js/compute-engine 0.35.6 → 0.50.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/README.md +121 -5
- package/dist/compute-engine.esm.js +50435 -44944
- package/dist/compute-engine.min.esm.js +1072 -69
- package/dist/compute-engine.min.umd.js +1072 -69
- package/dist/compute-engine.umd.js +50540 -45049
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.js +2 -2
- package/dist/math-json.umd.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +8 -1
- package/dist/types/common/type/primitive.d.ts +2 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +3 -2
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +4 -22
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +63 -76
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +15 -6
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +72 -6
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +5 -8
- package/dist/types/compute-engine/boxed-expression/box.d.ts +63 -8
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +13 -12
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +44 -43
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +31 -30
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +18 -18
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +5 -37
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +5 -4
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +34 -33
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +34 -33
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/constants.d.ts +6 -0
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +4 -5
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +9 -9
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +7 -7
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +4 -13
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +21 -0
- package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +4 -0
- package/dist/types/compute-engine/boxed-expression/match.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/order.d.ts +14 -14
- package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +41 -0
- package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +18 -0
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +12 -35
- package/dist/types/compute-engine/boxed-expression/predicates.d.ts +2 -0
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +51 -51
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +8 -8
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +3 -11
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +7 -7
- package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +31 -0
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +13 -13
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +10 -10
- package/dist/types/compute-engine/collection-utils.d.ts +4 -4
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +3 -3
- package/dist/types/compute-engine/compilation/compile-expression.d.ts +25 -0
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +12 -41
- package/dist/types/compute-engine/compilation/gpu-target.d.ts +50 -0
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +11 -11
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +7 -7
- package/dist/types/compute-engine/compilation/interval-wgsl-target.d.ts +54 -0
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +6 -6
- package/dist/types/compute-engine/compilation/python-target.d.ts +61 -0
- package/dist/types/compute-engine/compilation/types.d.ts +27 -22
- package/dist/types/compute-engine/compilation/wgsl-target.d.ts +41 -0
- package/dist/types/compute-engine/cost-function.d.ts +3 -3
- package/dist/types/compute-engine/engine-assumptions.d.ts +6 -0
- package/dist/types/compute-engine/engine-cache.d.ts +6 -0
- package/dist/types/compute-engine/engine-common-symbols.d.ts +6 -0
- package/dist/types/compute-engine/engine-compilation-targets.d.ts +17 -0
- package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +15 -0
- package/dist/types/compute-engine/engine-declarations.d.ts +19 -0
- package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +44 -0
- package/dist/types/compute-engine/engine-extension-contracts.d.ts +9 -0
- package/dist/types/compute-engine/engine-latex-dictionary-state.d.ts +13 -0
- package/dist/types/compute-engine/engine-library-bootstrap.d.ts +6 -0
- package/dist/types/compute-engine/engine-numeric-configuration.d.ts +34 -0
- package/dist/types/compute-engine/engine-parse-entrypoint.d.ts +7 -0
- package/dist/types/compute-engine/engine-runtime-state.d.ts +19 -0
- package/dist/types/compute-engine/engine-scope.d.ts +13 -0
- package/dist/types/compute-engine/engine-sequences.d.ts +14 -0
- package/dist/types/compute-engine/engine-simplification-rules.d.ts +15 -0
- package/dist/types/compute-engine/engine-startup-coordinator.d.ts +28 -0
- package/dist/types/compute-engine/engine-type-resolver.d.ts +12 -0
- package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +13 -0
- package/dist/types/compute-engine/free-functions.d.ts +20 -0
- package/dist/types/compute-engine/function-utils.d.ts +10 -10
- package/dist/types/compute-engine/global-types.d.ts +5 -3301
- package/dist/types/compute-engine/index.d.ts +155 -112
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
- package/dist/types/compute-engine/interval/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
- package/dist/types/compute-engine/interval/types.d.ts +1 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- 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 +4 -80
- package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +83 -0
- package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +28 -0
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +23 -33
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +8 -8
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +15 -15
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +73 -53
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -2
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +4 -4
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -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 -1
- package/dist/types/compute-engine/library/library.d.ts +19 -6
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +19 -32
- package/dist/types/compute-engine/library/logic.d.ts +1 -5
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +2 -2
- 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/type-handlers.d.ts +4 -0
- package/dist/types/compute-engine/library/utils.d.ts +12 -12
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +5 -5
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +5 -5
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +5 -5
- package/dist/types/compute-engine/numeric-value/types.d.ts +2 -3
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +3 -3
- package/dist/types/compute-engine/numerics/interval.d.ts +2 -2
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +4 -4
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +120 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -2
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +3 -1
- package/dist/types/compute-engine/oeis.d.ts +3 -3
- package/dist/types/compute-engine/sequence.d.ts +13 -13
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/derivative.d.ts +3 -3
- package/dist/types/compute-engine/symbolic/distribute.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +6 -6
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +46 -46
- package/dist/types/compute-engine/symbolic/fu.d.ts +4 -4
- package/dist/types/compute-engine/symbolic/logic-utils.d.ts +54 -0
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +4 -4
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +5 -0
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +65 -4
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +2 -2
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +42 -42
- package/dist/types/compute-engine/tensor/tensors.d.ts +4 -4
- package/dist/types/compute-engine/types-definitions.d.ts +900 -0
- package/dist/types/compute-engine/types-engine.d.ts +375 -0
- package/dist/types/compute-engine/types-evaluation.d.ts +67 -0
- package/dist/types/compute-engine/types-expression.d.ts +1655 -0
- package/dist/types/compute-engine/types-kernel-evaluation.d.ts +164 -0
- package/dist/types/compute-engine/types-kernel-serialization.d.ts +147 -0
- package/dist/types/compute-engine/types-serialization.d.ts +23 -0
- package/dist/types/compute-engine/types.d.ts +2 -2
- package/dist/types/compute-engine.d.ts +16 -3
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +3 -3
- package/dist/types/math-json/utils.d.ts +31 -31
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +8 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +0 -66
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +0 -10
- package/dist/types/compute-engine/library/invisible-operator.d.ts +0 -4
- package/dist/types/compute-engine/library/logic-utils.d.ts +0 -54
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
* Leaf module for wildcard pattern utility functions.
|
|
3
|
+
*
|
|
4
|
+
* These are extracted from boxed-patterns.ts to break circular dependencies:
|
|
5
|
+
* boxed-tensor.ts and match.ts need these functions, but boxed-patterns.ts
|
|
6
|
+
* has dependencies that create cycles through boxed-symbol.ts.
|
|
7
|
+
*/
|
|
8
|
+
import type { Expression } from '../global-types';
|
|
9
|
+
/**
|
|
10
|
+
* Check if an expression is a wildcard (universal, sequence, or optional sequence).
|
|
11
|
+
*
|
|
12
|
+
* @param expr - The expression to check
|
|
13
|
+
* @returns `true` if the expression is any type of wildcard
|
|
14
|
+
*/
|
|
15
|
+
export declare function isWildcard(expr: Expression): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Get the string representation of a wildcard expression.
|
|
18
|
+
*
|
|
19
|
+
* Returns the wildcard symbol including its name (if any):
|
|
20
|
+
* - `'_'` for anonymous universal wildcard
|
|
21
|
+
* - `'_a'` for named universal wildcard
|
|
22
|
+
* - `'__'` for anonymous sequence wildcard
|
|
23
|
+
* - `'__args'` for named sequence wildcard
|
|
24
|
+
* - `'___'` for anonymous optional sequence wildcard
|
|
25
|
+
* - `'___rest'` for named optional sequence wildcard
|
|
26
|
+
*
|
|
27
|
+
* @param expr - The expression to get the wildcard name from
|
|
28
|
+
* @returns The wildcard string, or `null` if not a wildcard
|
|
29
|
+
*/
|
|
30
|
+
export declare function wildcardName(expr: Expression): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Determine the type of wildcard.
|
|
33
|
+
*
|
|
34
|
+
* @param expr - A Expression or wildcard symbol string
|
|
35
|
+
* @returns
|
|
36
|
+
* - `'Wildcard'` - Universal wildcard (`_` or `_name`), matches exactly one element
|
|
37
|
+
* - `'Sequence'` - Sequence wildcard (`__` or `__name`), matches one or more elements
|
|
38
|
+
* - `'OptionalSequence'` - Optional sequence (`___` or `___name`), matches zero or more elements
|
|
39
|
+
* - `null` - Not a wildcard
|
|
40
|
+
*/
|
|
41
|
+
export declare function wildcardType(expr: Expression | string): 'Wildcard' | 'Sequence' | 'OptionalSequence' | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
/**
|
|
3
|
+
* The total degree of an expression is the sum of the
|
|
4
|
+
* positive integer degrees of the factors in the expression:
|
|
5
|
+
*
|
|
6
|
+
* `3√2x^5y^3` -> 5 + 3 = 8
|
|
7
|
+
*/
|
|
8
|
+
export declare function totalDegree(expr: Expression): number;
|
|
9
|
+
/**
|
|
10
|
+
* The max degree of a polynomial is the largest positive integer degree
|
|
11
|
+
* in the factors (monomials) of the expression
|
|
12
|
+
*
|
|
13
|
+
* `3√2x^5y^3` -> 5
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare function maxDegree(expr: Expression): number;
|
|
17
|
+
export declare function lex(expr: Expression): string;
|
|
18
|
+
export declare function revlex(expr: Expression): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
export { totalDegree, maxDegree, lex, revlex } from './polynomial-degree';
|
|
2
3
|
/**
|
|
3
4
|
* Coefficient of a univariate (single variable) polynomial.
|
|
4
5
|
*
|
|
@@ -12,40 +13,16 @@
|
|
|
12
13
|
* If a coefficient does not apply (there are no corresponding term), it is `null`.
|
|
13
14
|
*
|
|
14
15
|
*/
|
|
15
|
-
export type UnivariateCoefficients = (null |
|
|
16
|
-
export type MultivariateCoefficients = (null | (null |
|
|
16
|
+
export type UnivariateCoefficients = (null | Expression)[];
|
|
17
|
+
export type MultivariateCoefficients = (null | (null | Expression)[])[];
|
|
17
18
|
/**
|
|
18
19
|
* Return a list of coefficient of powers of `vars` in `poly`,
|
|
19
20
|
* starting with power 0.
|
|
20
21
|
*
|
|
21
22
|
* If `poly` is not a polynomial, return `null`.
|
|
22
23
|
*/
|
|
23
|
-
export declare function coefficients(poly:
|
|
24
|
-
export declare function coefficients(poly:
|
|
25
|
-
/**
|
|
26
|
-
* The total degree of an expression is the sum of the
|
|
27
|
-
* positive integer degrees of the factors in the expression:
|
|
28
|
-
*
|
|
29
|
-
* `3√2x^5y^3` -> 5 + 3 = 8
|
|
30
|
-
*/
|
|
31
|
-
export declare function totalDegree(expr: BoxedExpression): number;
|
|
32
|
-
/**
|
|
33
|
-
* The max degree of a polynomial is the largest positive integer degree
|
|
34
|
-
* in the factors (monomials) of the expression
|
|
35
|
-
*
|
|
36
|
-
* `3√2x^5y^3` -> 5
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export declare function maxDegree(expr: BoxedExpression): number;
|
|
40
|
-
/**
|
|
41
|
-
* Return a lexicographic key of the expression, for example
|
|
42
|
-
* `xy^2` -> `x y`
|
|
43
|
-
* `x\frac{1}{y}` -> `x y`
|
|
44
|
-
* `2xy + y^2` -> `x y y`
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
export declare function lex(expr: BoxedExpression): string;
|
|
48
|
-
export declare function revlex(expr: BoxedExpression): string;
|
|
24
|
+
export declare function coefficients(poly: Expression, vars: string): UnivariateCoefficients | null;
|
|
25
|
+
export declare function coefficients(poly: Expression, vars: string[]): MultivariateCoefficients | null;
|
|
49
26
|
/**
|
|
50
27
|
* Get the degree of a polynomial in a specific variable.
|
|
51
28
|
* Returns -1 if the expression is not a polynomial in the variable.
|
|
@@ -55,7 +32,7 @@ export declare function revlex(expr: BoxedExpression): string;
|
|
|
55
32
|
* - `polynomialDegree(x*y + y^2, 'x')` → 1
|
|
56
33
|
* - `polynomialDegree(sin(x), 'x')` → -1 (not a polynomial)
|
|
57
34
|
*/
|
|
58
|
-
export declare function polynomialDegree(expr:
|
|
35
|
+
export declare function polynomialDegree(expr: Expression, variable: string): number;
|
|
59
36
|
/**
|
|
60
37
|
* Extract coefficients of a univariate polynomial.
|
|
61
38
|
* Returns an array where index i contains the coefficient of x^i.
|
|
@@ -65,7 +42,7 @@ export declare function polynomialDegree(expr: BoxedExpression, variable: string
|
|
|
65
42
|
* - `getPolynomialCoefficients(x^3 + 2x + 1, 'x')` → [1, 2, 0, 1]
|
|
66
43
|
* - `getPolynomialCoefficients(3x^2 - x + 5, 'x')` → [5, -1, 3]
|
|
67
44
|
*/
|
|
68
|
-
export declare function getPolynomialCoefficients(expr:
|
|
45
|
+
export declare function getPolynomialCoefficients(expr: Expression, variable: string): Expression[] | null;
|
|
69
46
|
/**
|
|
70
47
|
* Construct a polynomial expression from its coefficients.
|
|
71
48
|
* coeffs[i] is the coefficient of x^i.
|
|
@@ -74,7 +51,7 @@ export declare function getPolynomialCoefficients(expr: BoxedExpression, variabl
|
|
|
74
51
|
* - `fromCoefficients([1, 2, 0, 1], 'x')` → x^3 + 2x + 1
|
|
75
52
|
* - `fromCoefficients([5, -1, 3], 'x')` → 3x^2 - x + 5
|
|
76
53
|
*/
|
|
77
|
-
export declare function fromCoefficients(coeffs:
|
|
54
|
+
export declare function fromCoefficients(coeffs: Expression[], variable: string): Expression;
|
|
78
55
|
/**
|
|
79
56
|
* Polynomial long division.
|
|
80
57
|
* Returns [quotient, remainder] such that dividend = divisor * quotient + remainder.
|
|
@@ -84,7 +61,7 @@ export declare function fromCoefficients(coeffs: BoxedExpression[], variable: st
|
|
|
84
61
|
* - `polynomialDivide(x^3-1, x-1, 'x')` → [x^2+x+1, 0]
|
|
85
62
|
* - `polynomialDivide(x^3+2x+1, x+1, 'x')` → [x^2-x+3, -2]
|
|
86
63
|
*/
|
|
87
|
-
export declare function polynomialDivide(dividend:
|
|
64
|
+
export declare function polynomialDivide(dividend: Expression, divisor: Expression, variable: string): [Expression, Expression] | null;
|
|
88
65
|
/**
|
|
89
66
|
* Compute the GCD of two polynomials using the Euclidean algorithm.
|
|
90
67
|
* Returns a monic polynomial (leading coefficient = 1).
|
|
@@ -93,7 +70,7 @@ export declare function polynomialDivide(dividend: BoxedExpression, divisor: Box
|
|
|
93
70
|
* - `polynomialGCD(x^2-1, x-1, 'x')` → x-1
|
|
94
71
|
* - `polynomialGCD(x^3-1, x^2-1, 'x')` → x-1
|
|
95
72
|
*/
|
|
96
|
-
export declare function polynomialGCD(a:
|
|
73
|
+
export declare function polynomialGCD(a: Expression, b: Expression, variable: string): Expression;
|
|
97
74
|
/**
|
|
98
75
|
* Cancel common polynomial factors in a rational expression (Divide).
|
|
99
76
|
* Returns the simplified expression.
|
|
@@ -102,4 +79,4 @@ export declare function polynomialGCD(a: BoxedExpression, b: BoxedExpression, va
|
|
|
102
79
|
* - `cancelCommonFactors((x^2-1)/(x-1), 'x')` → x+1
|
|
103
80
|
* - `cancelCommonFactors((x+1)/(x^2+3x+2), 'x')` → 1/(x+2)
|
|
104
81
|
*/
|
|
105
|
-
export declare function cancelCommonFactors(expr:
|
|
82
|
+
export declare function cancelCommonFactors(expr: Expression, variable: string): Expression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
export declare const ConditionParent: {
|
|
3
3
|
boolean: string;
|
|
4
4
|
string: string;
|
|
@@ -49,54 +49,54 @@ export declare const ConditionParent: {
|
|
|
49
49
|
polynomial: string;
|
|
50
50
|
};
|
|
51
51
|
export declare const CONDITIONS: {
|
|
52
|
-
boolean: (x:
|
|
53
|
-
string: (x:
|
|
54
|
-
number: (x:
|
|
55
|
-
symbol: (x:
|
|
56
|
-
expression: (
|
|
57
|
-
numeric: (x:
|
|
58
|
-
integer: (x:
|
|
59
|
-
rational: (x:
|
|
60
|
-
irrational: (x:
|
|
61
|
-
real: (x:
|
|
62
|
-
notreal: (x:
|
|
63
|
-
complex: (x:
|
|
64
|
-
imaginary: (x:
|
|
65
|
-
positive: (x:
|
|
66
|
-
negative: (x:
|
|
67
|
-
nonnegative: (x:
|
|
68
|
-
nonpositive: (x:
|
|
69
|
-
even: (x:
|
|
70
|
-
odd: (x:
|
|
71
|
-
prime: (x:
|
|
72
|
-
composite: (x:
|
|
73
|
-
notzero: (x:
|
|
74
|
-
notone: (x:
|
|
75
|
-
finite: (x:
|
|
76
|
-
infinite: (x:
|
|
77
|
-
constant: (x:
|
|
78
|
-
variable: (x:
|
|
79
|
-
function: (x:
|
|
80
|
-
relation: (x:
|
|
81
|
-
equation: (x:
|
|
82
|
-
inequality: (x:
|
|
83
|
-
collection: (x:
|
|
84
|
-
list: (x:
|
|
85
|
-
set: (x:
|
|
86
|
-
tuple: (x:
|
|
87
|
-
single: (x:
|
|
88
|
-
pair: (x:
|
|
89
|
-
triple: (x:
|
|
90
|
-
scalar: (x:
|
|
91
|
-
tensor: (x:
|
|
92
|
-
vector: (x:
|
|
93
|
-
matrix: (x:
|
|
94
|
-
unit: (x:
|
|
95
|
-
dimension: (x:
|
|
96
|
-
angle: (x:
|
|
97
|
-
polynomial: (x:
|
|
52
|
+
boolean: (x: Expression) => boolean;
|
|
53
|
+
string: (x: Expression) => x is Expression & import("../types-expression").StringInterface;
|
|
54
|
+
number: (x: Expression) => x is Expression & import("../types-expression").NumberLiteralInterface;
|
|
55
|
+
symbol: (x: Expression) => x is Expression & import("../types-expression").SymbolInterface;
|
|
56
|
+
expression: (_x: Expression) => boolean;
|
|
57
|
+
numeric: (x: Expression) => boolean;
|
|
58
|
+
integer: (x: Expression) => boolean;
|
|
59
|
+
rational: (x: Expression) => boolean;
|
|
60
|
+
irrational: (x: Expression) => boolean;
|
|
61
|
+
real: (x: Expression) => boolean;
|
|
62
|
+
notreal: (x: Expression) => boolean;
|
|
63
|
+
complex: (x: Expression) => boolean;
|
|
64
|
+
imaginary: (x: Expression) => boolean;
|
|
65
|
+
positive: (x: Expression) => boolean;
|
|
66
|
+
negative: (x: Expression) => boolean;
|
|
67
|
+
nonnegative: (x: Expression) => boolean;
|
|
68
|
+
nonpositive: (x: Expression) => boolean;
|
|
69
|
+
even: (x: Expression) => boolean;
|
|
70
|
+
odd: (x: Expression) => boolean;
|
|
71
|
+
prime: (x: Expression) => boolean;
|
|
72
|
+
composite: (x: Expression) => boolean;
|
|
73
|
+
notzero: (x: Expression) => boolean;
|
|
74
|
+
notone: (x: Expression) => boolean;
|
|
75
|
+
finite: (x: Expression) => boolean;
|
|
76
|
+
infinite: (x: Expression) => boolean;
|
|
77
|
+
constant: (x: Expression) => boolean;
|
|
78
|
+
variable: (x: Expression) => boolean;
|
|
79
|
+
function: (x: Expression) => boolean;
|
|
80
|
+
relation: (x: Expression) => boolean;
|
|
81
|
+
equation: (x: Expression) => boolean;
|
|
82
|
+
inequality: (x: Expression) => boolean;
|
|
83
|
+
collection: (x: Expression) => boolean;
|
|
84
|
+
list: (x: Expression) => boolean;
|
|
85
|
+
set: (x: Expression) => boolean;
|
|
86
|
+
tuple: (x: Expression) => boolean;
|
|
87
|
+
single: (x: Expression) => boolean;
|
|
88
|
+
pair: (x: Expression) => boolean;
|
|
89
|
+
triple: (x: Expression) => boolean;
|
|
90
|
+
scalar: (x: Expression) => boolean;
|
|
91
|
+
tensor: (x: Expression) => boolean;
|
|
92
|
+
vector: (x: Expression) => boolean;
|
|
93
|
+
matrix: (x: Expression) => boolean;
|
|
94
|
+
unit: (x: Expression) => boolean;
|
|
95
|
+
dimension: (x: Expression) => boolean;
|
|
96
|
+
angle: (x: Expression) => boolean;
|
|
97
|
+
polynomial: (x: Expression) => boolean;
|
|
98
98
|
};
|
|
99
|
-
export declare function checkConditions(x:
|
|
99
|
+
export declare function checkConditions(x: Expression, conditions: string[]): boolean;
|
|
100
100
|
/**
|
|
101
101
|
* Create a boxed rule set from a collection of non-boxed rules
|
|
102
102
|
*/
|
|
@@ -111,7 +111,7 @@ export declare function boxRules(ce: ComputeEngine, rs: Rule | ReadonlyArray<Rul
|
|
|
111
111
|
* @param options
|
|
112
112
|
* @returns A transformed expression, if the rule matched. `null` otherwise.
|
|
113
113
|
*/
|
|
114
|
-
export declare function applyRule(rule: Readonly<BoxedRule>, expr:
|
|
114
|
+
export declare function applyRule(rule: Readonly<BoxedRule>, expr: Expression, substitution: BoxedSubstitution, options?: Readonly<Partial<ReplaceOptions>>): RuleStep | null;
|
|
115
115
|
/**
|
|
116
116
|
* Apply the rules in the ruleset and return a modified expression
|
|
117
117
|
* and the set of rules that were applied.
|
|
@@ -120,10 +120,10 @@ export declare function applyRule(rule: Readonly<BoxedRule>, expr: BoxedExpressi
|
|
|
120
120
|
* expression.
|
|
121
121
|
*
|
|
122
122
|
*/
|
|
123
|
-
export declare function replace(expr:
|
|
123
|
+
export declare function replace(expr: Expression, rules: Rule | (Rule | BoxedRule)[] | BoxedRuleSet, options?: Partial<ReplaceOptions>): RuleSteps;
|
|
124
124
|
/**
|
|
125
125
|
* For each rules in the rule set that match, return the `replace` of the rule
|
|
126
126
|
*
|
|
127
127
|
* @param rules
|
|
128
128
|
*/
|
|
129
|
-
export declare function matchAnyRules(expr:
|
|
129
|
+
export declare function matchAnyRules(expr: Expression, rules: BoxedRuleSet, sub: BoxedSubstitution, options?: Partial<ReplaceOptions>): Expression[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type { ComputeEngine,
|
|
3
|
-
export declare function serializeJson(ce: ComputeEngine, expr:
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
import type { IComputeEngine as ComputeEngine, Expression, JsonSerializationOptions } from '../global-types';
|
|
3
|
+
export declare function serializeJson(ce: ComputeEngine, expr: Expression, options: Readonly<JsonSerializationOptions>): MathJsonExpression;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
type InternalSimplifyOptions = SimplifyOptions & {
|
|
3
3
|
useVariations: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare function simplify(expr:
|
|
5
|
+
export declare function simplify(expr: Expression, options?: Partial<InternalSimplifyOptions>, steps?: RuleSteps): RuleSteps;
|
|
6
6
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Solve a system of linear equations.
|
|
4
4
|
*
|
|
5
|
-
* @param equations - Array of
|
|
5
|
+
* @param equations - Array of Expression representing equations (Equal expressions)
|
|
6
6
|
* @param variables - Array of variable names to solve for
|
|
7
7
|
* @returns Object mapping variable names to their solutions, or null if unsolvable
|
|
8
8
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* // Unique solution
|
|
15
15
|
* const e = ce.parse('\\begin{cases}x+y=70\\\\2x-4y=80\\end{cases}');
|
|
16
16
|
* const result = e.solve(['x', 'y']);
|
|
17
|
-
* // result = { x:
|
|
17
|
+
* // result = { x: Expression(60), y: Expression(10) }
|
|
18
18
|
*
|
|
19
19
|
* // Parametric solution (under-determined)
|
|
20
20
|
* const e2 = ce.parse('\\begin{cases}x+y=5\\end{cases}');
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
* // result2 = { x: 5 - y, y: y }
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
export declare function solveLinearSystem(equations:
|
|
25
|
+
export declare function solveLinearSystem(equations: Expression[], variables: string[]): Record<string, Expression> | null;
|
|
26
26
|
/**
|
|
27
27
|
* Solve a system of polynomial equations that may be non-linear.
|
|
28
28
|
* Currently supports:
|
|
29
29
|
* 1. Product + sum pattern: xy = p, x + y = s (2 equations, 2 variables)
|
|
30
30
|
* 2. Substitution-reducible: one equation is linear in one variable
|
|
31
31
|
*
|
|
32
|
-
* @param equations - Array of
|
|
32
|
+
* @param equations - Array of Expression representing equations (Equal expressions)
|
|
33
33
|
* @param variables - Array of variable names to solve for
|
|
34
34
|
* @returns Array of solution objects, or null if unsolvable
|
|
35
35
|
*
|
|
@@ -41,12 +41,12 @@ export declare function solveLinearSystem(equations: BoxedExpression[], variable
|
|
|
41
41
|
* // result = [{ x: 2, y: 3 }, { x: 3, y: 2 }]
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare function solvePolynomialSystem(equations:
|
|
44
|
+
export declare function solvePolynomialSystem(equations: Expression[], variables: string[]): Array<Record<string, Expression>> | null;
|
|
45
45
|
/**
|
|
46
46
|
* Solve a system of linear inequalities in 2 variables.
|
|
47
47
|
* Returns the vertices of the feasible region (convex polygon).
|
|
48
48
|
*
|
|
49
|
-
* @param inequalities - Array of
|
|
49
|
+
* @param inequalities - Array of Expression representing inequalities
|
|
50
50
|
* @param variables - Array of exactly 2 variable names
|
|
51
51
|
* @returns Array of vertex coordinate objects, or null if unsolvable/unbounded
|
|
52
52
|
*
|
|
@@ -57,4 +57,4 @@ export declare function solvePolynomialSystem(equations: BoxedExpression[], vari
|
|
|
57
57
|
* // result = [{ x: 0, y: 0 }, { x: 10, y: 0 }, { x: 0, y: 10 }]
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
export declare function solveLinearInequalitySystem(inequalities:
|
|
60
|
+
export declare function solveLinearInequalitySystem(inequalities: Expression[], variables: string[]): Array<Record<string, Expression>> | null;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
export declare const UNIVARIATE_ROOTS: Rule[];
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* MathJsonExpression is a function of a single variable (`x`) or an Equality
|
|
5
5
|
*
|
|
6
6
|
* Return the roots of that variable
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
export declare function findUnivariateRoots(expr:
|
|
10
|
-
/** Expr is an equation with an operator of
|
|
11
|
-
* - `Equal`, `Less`, `Greater`, `LessEqual`, `GreaterEqual`
|
|
12
|
-
*
|
|
13
|
-
* Return an expression with the same operator, but with the first argument
|
|
14
|
-
* a variable, if possible:
|
|
15
|
-
* `2x < 4` => `x < 2`
|
|
16
|
-
*/
|
|
17
|
-
export declare function univariateSolve(expr: BoxedExpression, x: string): ReadonlyArray<BoxedExpression> | null;
|
|
9
|
+
export declare function findUnivariateRoots(expr: Expression, x: string): ReadonlyArray<Expression>;
|
|
18
10
|
/** Harmonization rules transform an expr into one or more equivalent
|
|
19
11
|
* expressions that are easier to solve */
|
|
20
12
|
export declare const HARMONIZATION_RULES: Rule[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
/** Assuming x in an expression in radians, convert to current angular unit. */
|
|
3
|
-
export declare function radiansToAngle(x:
|
|
4
|
-
export declare function evalTrig(name: string, op:
|
|
5
|
-
export declare function processInverseFunction(ce: ComputeEngine, xs: ReadonlyArray<
|
|
6
|
-
export declare function trigSign(operator: string, x:
|
|
7
|
-
export declare function isConstructible(x: string |
|
|
8
|
-
export declare function constructibleValues(operator: string, x:
|
|
3
|
+
export declare function radiansToAngle(x: Expression | undefined): Expression | undefined;
|
|
4
|
+
export declare function evalTrig(name: string, op: Expression | undefined): Expression | undefined;
|
|
5
|
+
export declare function processInverseFunction(ce: ComputeEngine, xs: ReadonlyArray<Expression>): Expression | undefined;
|
|
6
|
+
export declare function trigSign(operator: string, x: Expression): Sign | undefined;
|
|
7
|
+
export declare function isConstructible(x: string | Expression): boolean;
|
|
8
|
+
export declare function constructibleValues(operator: string, x: Expression | undefined): undefined | Expression;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
/** Preferred guard for runtime expressions. */
|
|
3
|
+
export declare function isExpression(x: unknown): x is Expression;
|
|
4
|
+
export declare function isNumber(expr: Expression | null | undefined): expr is Expression & NumberLiteralInterface;
|
|
5
|
+
export declare function isSymbol(expr: Expression | null | undefined): expr is Expression & SymbolInterface;
|
|
6
|
+
export declare function isFunction(expr: Expression | null | undefined): expr is Expression & FunctionInterface;
|
|
7
|
+
export declare function isString(expr: Expression | null | undefined): expr is Expression & StringInterface;
|
|
8
|
+
export declare function isTensor(expr: Expression | null | undefined): expr is Expression & TensorInterface;
|
|
9
|
+
/** @deprecated Use `isExpression()` instead. */
|
|
10
|
+
export declare function isBoxedExpression(x: unknown): x is Expression;
|
|
11
|
+
/** @deprecated Use `isNumber()` instead. */
|
|
12
|
+
export declare function isBoxedNumber(expr: Expression | null | undefined): expr is Expression & NumberLiteralInterface;
|
|
13
|
+
/** @deprecated Use `isSymbol()` instead. */
|
|
14
|
+
export declare function isBoxedSymbol(expr: Expression | null | undefined): expr is Expression & SymbolInterface;
|
|
15
|
+
/** @deprecated Use `isFunction()` instead. */
|
|
16
|
+
export declare function isBoxedFunction(expr: Expression | null | undefined): expr is Expression & FunctionInterface;
|
|
17
|
+
/** @deprecated Use `isString()` instead. */
|
|
18
|
+
export declare function isBoxedString(expr: Expression | null | undefined): expr is Expression & StringInterface;
|
|
19
|
+
/** @deprecated Use `isTensor()` instead. */
|
|
20
|
+
export declare function isBoxedTensor(expr: Expression | null | undefined): expr is Expression & TensorInterface;
|
|
21
|
+
export declare function isDictionary(expr: Expression | null | undefined): expr is Expression & DictionaryInterface;
|
|
22
|
+
export declare function isCollection(expr: Expression | null | undefined): expr is Expression & CollectionInterface;
|
|
23
|
+
export declare function isIndexedCollection(expr: Expression | null | undefined): expr is Expression & IndexedCollectionInterface;
|
|
24
|
+
/**
|
|
25
|
+
* Get the symbol name if `expr` is a symbol expression, otherwise `undefined`.
|
|
26
|
+
*
|
|
27
|
+
* Convenience helper that combines `isSymbol()` with `.symbol` access
|
|
28
|
+
* so callers can write `sym(expr) === 'Pi'` instead of the more verbose
|
|
29
|
+
* `isSymbol(expr) && expr.symbol === 'Pi'`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function sym(expr: Expression | null | undefined): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
import { Type } from '../../common/type/types';
|
|
3
3
|
import { NumericValue } from '../numeric-value/types';
|
|
4
4
|
/**
|
|
@@ -10,31 +10,31 @@ import { NumericValue } from '../numeric-value/types';
|
|
|
10
10
|
* - sin(0) -> 0
|
|
11
11
|
* - cos(0) -> 1
|
|
12
12
|
*/
|
|
13
|
-
export declare function hasSymbolicTranscendental(expr:
|
|
14
|
-
export declare function isDictionary(expr:
|
|
15
|
-
export declare function
|
|
13
|
+
export declare function hasSymbolicTranscendental(expr: Expression): boolean;
|
|
14
|
+
export declare function isDictionary(expr: unknown): expr is DictionaryInterface;
|
|
15
|
+
export declare function isExpression(x: unknown): x is Expression;
|
|
16
16
|
/**
|
|
17
17
|
* For any numeric result, if `bignumPreferred()` is true, calculate using
|
|
18
18
|
* bignums. If `bignumPreferred()` is false, calculate using machine numbers
|
|
19
19
|
*/
|
|
20
20
|
export declare function bignumPreferred(ce: ComputeEngine): boolean;
|
|
21
21
|
export declare function hashCode(s: string): number;
|
|
22
|
-
export declare function normalizedUnknownsForSolve(syms: string | Iterable<string> |
|
|
22
|
+
export declare function normalizedUnknownsForSolve(syms: string | Iterable<string> | Expression | Iterable<Expression> | null | undefined): string[];
|
|
23
23
|
/** Return the local variables in the expression.
|
|
24
24
|
*
|
|
25
25
|
* A local variable is a symbol that is declared with a `Declare`
|
|
26
26
|
* expression in a `Block` expression.
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
|
-
export declare function getLocalVariables(expr:
|
|
30
|
-
export declare function domainToType(expr:
|
|
29
|
+
export declare function getLocalVariables(expr: Expression): string[];
|
|
30
|
+
export declare function domainToType(expr: Expression): Type;
|
|
31
31
|
/**
|
|
32
32
|
* Return the angle in the range [0, 2π) that is equivalent to the given angle.
|
|
33
33
|
*
|
|
34
34
|
* @param x
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
|
-
export declare function canonicalAngle(x:
|
|
37
|
+
export declare function canonicalAngle(x: Expression | undefined): Expression | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Return a multiple of the imaginary unit, e.g.
|
|
40
40
|
* - 'ImaginaryUnit' -> 1
|
|
@@ -45,7 +45,7 @@ export declare function canonicalAngle(x: BoxedExpression | undefined): BoxedExp
|
|
|
45
45
|
* - ['Divide', 'ImaginaryUnit', 2] -> 0.5
|
|
46
46
|
*
|
|
47
47
|
*/
|
|
48
|
-
export declare function getImaginaryFactor(expr: number |
|
|
48
|
+
export declare function getImaginaryFactor(expr: number | Expression): Expression | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* `true` if expr is a number with imaginary part 1 and real part 0, or a symbol with a definition
|
|
51
51
|
* matching this. Does not bind expr if a symbol.
|
|
@@ -54,10 +54,10 @@ export declare function getImaginaryFactor(expr: number | BoxedExpression): Boxe
|
|
|
54
54
|
* @param expr
|
|
55
55
|
* @returns
|
|
56
56
|
*/
|
|
57
|
-
export declare function isImaginaryUnit(expr:
|
|
58
|
-
export declare function getPiTerm(expr:
|
|
59
|
-
export declare function isValidOperatorDef(def:
|
|
60
|
-
export declare function isValidValueDef(def:
|
|
57
|
+
export declare function isImaginaryUnit(expr: Expression): boolean;
|
|
58
|
+
export declare function getPiTerm(expr: Expression): [k: NumericValue, t: NumericValue];
|
|
59
|
+
export declare function isValidOperatorDef(def: unknown): def is Partial<OperatorDefinition>;
|
|
60
|
+
export declare function isValidValueDef(def: unknown): def is Partial<ValueDefinition>;
|
|
61
61
|
export declare function isValueDef(def: BoxedDefinition | undefined): def is TaggedValueDefinition;
|
|
62
62
|
export declare function isOperatorDef(def: BoxedDefinition | undefined): def is TaggedOperatorDefinition;
|
|
63
63
|
export declare function updateDef(ce: ComputeEngine, name: string, def: BoxedDefinition, newDef: Partial<OperatorDefinition> | BoxedOperatorDefinition | Partial<ValueDefinition> | BoxedValueDefinition): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import type {
|
|
1
|
+
/* 0.50.0 */
|
|
2
|
+
import type { Expression, IComputeEngine as ComputeEngine } from '../global-types';
|
|
3
3
|
/**
|
|
4
4
|
* Check that the number of arguments is as expected.
|
|
5
5
|
*
|
|
6
6
|
* Converts the arguments to canonical, and flattens the sequence.
|
|
7
7
|
*/
|
|
8
|
-
export declare function checkArity(ce: ComputeEngine, ops: ReadonlyArray<
|
|
8
|
+
export declare function checkArity(ce: ComputeEngine, ops: ReadonlyArray<Expression>, count: number): ReadonlyArray<Expression>;
|
|
9
9
|
/**
|
|
10
10
|
* Validation of arguments is normally done by checking the signature of the
|
|
11
11
|
* function vs the arguments of the expression. However, we have a fastpath
|
|
@@ -22,21 +22,21 @@ export declare function checkArity(ce: ComputeEngine, ops: ReadonlyArray<BoxedEx
|
|
|
22
22
|
*
|
|
23
23
|
* Flattens sequence expressions.
|
|
24
24
|
*/
|
|
25
|
-
export declare function checkNumericArgs(ce: ComputeEngine, ops: ReadonlyArray<
|
|
25
|
+
export declare function checkNumericArgs(ce: ComputeEngine, ops: ReadonlyArray<Expression>, options?: number | {
|
|
26
26
|
count?: number;
|
|
27
27
|
flatten?: string;
|
|
28
|
-
}): ReadonlyArray<
|
|
28
|
+
}): ReadonlyArray<Expression>;
|
|
29
29
|
/**
|
|
30
30
|
* Check that an argument is of the expected type.
|
|
31
31
|
*
|
|
32
32
|
* Converts the arguments to canonical
|
|
33
33
|
*/
|
|
34
|
-
export declare function checkType(ce: ComputeEngine, arg:
|
|
35
|
-
export declare function checkTypes(ce: ComputeEngine, args: ReadonlyArray<
|
|
34
|
+
export declare function checkType(ce: ComputeEngine, arg: Expression | undefined | null, type: Type | undefined): Expression;
|
|
35
|
+
export declare function checkTypes(ce: ComputeEngine, args: ReadonlyArray<Expression>, types: Type[]): ReadonlyArray<Expression>;
|
|
36
36
|
/**
|
|
37
37
|
* Check that the argument is pure.
|
|
38
38
|
*/
|
|
39
|
-
export declare function checkPure(ce: ComputeEngine, arg:
|
|
39
|
+
export declare function checkPure(ce: ComputeEngine, arg: Expression | Expression | undefined | null): Expression;
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
42
42
|
* If the arguments match the parameters, return null.
|
|
@@ -54,5 +54,5 @@ export declare function checkPure(ce: ComputeEngine, arg: BoxedExpression | Boxe
|
|
|
54
54
|
* -->
|
|
55
55
|
*
|
|
56
56
|
*/
|
|
57
|
-
export declare function validateArguments(ce: ComputeEngine, ops: ReadonlyArray<
|
|
58
|
-
export declare function spellCheckMessage(expr:
|
|
57
|
+
export declare function validateArguments(ce: ComputeEngine, ops: ReadonlyArray<Expression>, signature: Type, lazy?: boolean, threadable?: boolean): ReadonlyArray<Expression> | null;
|
|
58
|
+
export declare function spellCheckMessage(expr: Expression): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
/** If a collection has fewer than this many elements, eagerly evaluate it.
|
|
3
3
|
*
|
|
4
4
|
* For example, evaluate the Union of two sets with 10 elements each will
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
export declare const MAX_SIZE_EAGER_COLLECTION = 100;
|
|
12
|
-
export declare function isFiniteIndexedCollection(col:
|
|
13
|
-
export declare function repeat(value:
|
|
12
|
+
export declare function isFiniteIndexedCollection(col: Expression): boolean;
|
|
13
|
+
export declare function repeat(value: Expression, count?: number): Iterator<Expression>;
|
|
14
14
|
/**
|
|
15
15
|
* Zips together multiple collections into a single iterator.
|
|
16
16
|
*
|
|
@@ -24,7 +24,7 @@ export declare function repeat(value: BoxedExpression, count?: number): Iterator
|
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare function zip(items: ReadonlyArray<
|
|
27
|
+
export declare function zip(items: ReadonlyArray<Expression>): Iterator<Expression[]>;
|
|
28
28
|
/**
|
|
29
29
|
* Default collection handlers suitable for collections that store their
|
|
30
30
|
* elements as operands.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.50.0 */
|
|
2
2
|
import type { CompileTarget, TargetSource } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Base compiler class containing language-agnostic compilation logic
|
|
@@ -7,11 +7,11 @@ export declare class BaseCompiler {
|
|
|
7
7
|
/**
|
|
8
8
|
* Compile an expression to target language source code
|
|
9
9
|
*/
|
|
10
|
-
static compile(expr:
|
|
10
|
+
static compile(expr: Expression | undefined, target: CompileTarget<Expression>, prec?: number): TargetSource;
|
|
11
11
|
/**
|
|
12
12
|
* Compile a function expression
|
|
13
13
|
*/
|
|
14
|
-
static compileExpr(engine: ComputeEngine, h: string, args: ReadonlyArray<
|
|
14
|
+
static compileExpr(engine: ComputeEngine, h: string, args: ReadonlyArray<Expression>, prec: number, target: CompileTarget<Expression>): TargetSource;
|
|
15
15
|
/**
|
|
16
16
|
* Compile a block expression
|
|
17
17
|
*/
|