@cortex-js/compute-engine 0.31.0 → 0.32.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/package.json +1 -1
- package/dist/compute-engine.esm.js +0 -41311
- package/dist/compute-engine.min.esm.js +0 -125
- package/dist/compute-engine.min.umd.js +0 -127
- package/dist/compute-engine.umd.js +0 -41336
- package/dist/math-json.esm.js +0 -130
- package/dist/math-json.min.esm.js +0 -130
- package/dist/math-json.min.umd.js +0 -4
- package/dist/math-json.umd.js +0 -155
- package/dist/types/common/ansi-codes.d.ts +0 -41
- package/dist/types/common/configuration-change.d.ts +0 -28
- package/dist/types/common/fuzzy-string-match.d.ts +0 -2
- package/dist/types/common/grapheme-splitter.d.ts +0 -15
- package/dist/types/common/interruptible.d.ts +0 -20
- package/dist/types/common/one-of.d.ts +0 -10
- package/dist/types/common/signals.d.ts +0 -96
- package/dist/types/common/type/ast-nodes.d.ts +0 -146
- package/dist/types/common/type/boxed-type.d.ts +0 -30
- package/dist/types/common/type/lexer.d.ts +0 -51
- package/dist/types/common/type/parse.d.ts +0 -211
- package/dist/types/common/type/parser.d.ts +0 -45
- package/dist/types/common/type/primitive.d.ts +0 -10
- package/dist/types/common/type/serialize.d.ts +0 -2
- package/dist/types/common/type/subtype.d.ts +0 -6
- package/dist/types/common/type/type-builder.d.ts +0 -32
- package/dist/types/common/type/types.d.ts +0 -300
- package/dist/types/common/type/utils.d.ts +0 -36
- package/dist/types/common/utils.d.ts +0 -23
- package/dist/types/compute-engine/assume.d.ts +0 -26
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +0 -165
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +0 -5
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +0 -16
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +0 -27
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +0 -38
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +0 -11
- package/dist/types/compute-engine/boxed-expression/box.d.ts +0 -47
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +0 -44
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +0 -136
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +0 -103
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +0 -53
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +0 -107
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +0 -27
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +0 -170
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +0 -83
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +0 -46
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +0 -7
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +0 -5
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +0 -2
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +0 -13
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +0 -20
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +0 -12
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +0 -10
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +0 -25
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +0 -10
- package/dist/types/compute-engine/boxed-expression/match.d.ts +0 -19
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +0 -11
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +0 -34
- package/dist/types/compute-engine/boxed-expression/order.d.ts +0 -71
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +0 -105
- package/dist/types/compute-engine/boxed-expression/product.d.ts +0 -66
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +0 -129
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +0 -3
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +0 -46
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +0 -6
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +0 -20
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +0 -10
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +0 -9
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +0 -64
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +0 -58
- package/dist/types/compute-engine/collection-utils.d.ts +0 -35
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +0 -31
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +0 -68
- package/dist/types/compute-engine/compilation/types.d.ts +0 -83
- package/dist/types/compute-engine/cost-function.d.ts +0 -13
- package/dist/types/compute-engine/function-utils.d.ts +0 -120
- package/dist/types/compute-engine/global-types.d.ts +0 -2930
- package/dist/types/compute-engine/index.d.ts +0 -660
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +0 -27
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +0 -3
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +0 -2
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +0 -88
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +0 -21
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +0 -303
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +0 -29
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +0 -10
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +0 -37
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +0 -18
- package/dist/types/compute-engine/latex-syntax/types.d.ts +0 -845
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +0 -5
- package/dist/types/compute-engine/library/arithmetic.d.ts +0 -4
- package/dist/types/compute-engine/library/calculus.d.ts +0 -2
- package/dist/types/compute-engine/library/collections.d.ts +0 -27
- package/dist/types/compute-engine/library/combinatorics.d.ts +0 -2
- package/dist/types/compute-engine/library/complex.d.ts +0 -2
- package/dist/types/compute-engine/library/control-structures.d.ts +0 -2
- package/dist/types/compute-engine/library/core.d.ts +0 -2
- package/dist/types/compute-engine/library/invisible-operator.d.ts +0 -4
- package/dist/types/compute-engine/library/library.d.ts +0 -17
- package/dist/types/compute-engine/library/linear-algebra.d.ts +0 -2
- package/dist/types/compute-engine/library/logic.d.ts +0 -6
- package/dist/types/compute-engine/library/number-theory.d.ts +0 -2
- package/dist/types/compute-engine/library/polynomials.d.ts +0 -2
- package/dist/types/compute-engine/library/random-expression.d.ts +0 -2
- package/dist/types/compute-engine/library/relational-operator.d.ts +0 -2
- package/dist/types/compute-engine/library/sets.d.ts +0 -2
- package/dist/types/compute-engine/library/statistics.d.ts +0 -2
- package/dist/types/compute-engine/library/trigonometry.d.ts +0 -2
- package/dist/types/compute-engine/library/utils.d.ts +0 -77
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +0 -57
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +0 -75
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +0 -56
- package/dist/types/compute-engine/numeric-value/types.d.ts +0 -116
- package/dist/types/compute-engine/numerics/bigint.d.ts +0 -2
- package/dist/types/compute-engine/numerics/expression.d.ts +0 -4
- package/dist/types/compute-engine/numerics/interval.d.ts +0 -12
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +0 -4
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +0 -18
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +0 -9
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +0 -3
- package/dist/types/compute-engine/numerics/numeric.d.ts +0 -60
- package/dist/types/compute-engine/numerics/primes.d.ts +0 -7
- package/dist/types/compute-engine/numerics/rationals.d.ts +0 -43
- package/dist/types/compute-engine/numerics/richardson.d.ts +0 -80
- package/dist/types/compute-engine/numerics/special-functions.d.ts +0 -28
- package/dist/types/compute-engine/numerics/statistics.d.ts +0 -24
- package/dist/types/compute-engine/numerics/strings.d.ts +0 -2
- package/dist/types/compute-engine/numerics/types.d.ts +0 -30
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +0 -3
- package/dist/types/compute-engine/symbolic/derivative.d.ts +0 -18
- package/dist/types/compute-engine/symbolic/distribute.d.ts +0 -5
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +0 -27
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +0 -128
- package/dist/types/compute-engine/tensor/tensors.d.ts +0 -93
- package/dist/types/compute-engine/types.d.ts +0 -8
- package/dist/types/compute-engine.d.ts +0 -3
- package/dist/types/math-json/symbols.d.ts +0 -11
- package/dist/types/math-json/types.d.ts +0 -122
- package/dist/types/math-json/utils.d.ts +0 -87
- package/dist/types/math-json.d.ts +0 -3
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import { NumericValue } from '../numeric-value/types';
|
|
3
|
-
import type { Rational } from '../numerics/types';
|
|
4
|
-
/**
|
|
5
|
-
* Group terms in a product by common term.
|
|
6
|
-
*
|
|
7
|
-
* All the terms should be canonical.
|
|
8
|
-
* - the arguments should have been flattened for `Multiply`
|
|
9
|
-
*
|
|
10
|
-
* - any argument of power been distributed, i.e.
|
|
11
|
-
* (ab)^2 -> a^2 b^2
|
|
12
|
-
* *
|
|
13
|
-
* 3 + √5 + √(x+1) + x^2 + (a+b)^2 + d
|
|
14
|
-
* -> [ [[3, "d"], [1, 1]],
|
|
15
|
-
* [[5, "x+1"], [1, 2]],
|
|
16
|
-
* [[1, "a+b"], [2, 1]]
|
|
17
|
-
* ]
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export declare class Product {
|
|
21
|
-
readonly options?: {
|
|
22
|
-
canonical?: boolean;
|
|
23
|
-
};
|
|
24
|
-
engine: ComputeEngine;
|
|
25
|
-
coefficient: NumericValue;
|
|
26
|
-
terms: {
|
|
27
|
-
term: BoxedExpression;
|
|
28
|
-
exponent: Rational;
|
|
29
|
-
}[];
|
|
30
|
-
private _isCanonical;
|
|
31
|
-
static from(expr: BoxedExpression): Product;
|
|
32
|
-
constructor(ce: ComputeEngine, xs?: ReadonlyArray<BoxedExpression>, options?: {
|
|
33
|
-
canonical?: boolean;
|
|
34
|
-
});
|
|
35
|
-
/**
|
|
36
|
-
* Add a term to the product.
|
|
37
|
-
*
|
|
38
|
-
* If `this._isCanonical` a running product of exact terms is kept.
|
|
39
|
-
* Otherwise, terms and their exponent are tallied.
|
|
40
|
-
*/
|
|
41
|
-
mul(term: BoxedExpression, exp?: Rational): void;
|
|
42
|
-
/** Divide the product by a term of coefficient */
|
|
43
|
-
div(term: NumericValue | BoxedExpression): void;
|
|
44
|
-
/** The terms of the product, grouped by degrees.
|
|
45
|
-
*
|
|
46
|
-
* If `mode` is `rational`, rationals are split into separate numerator and
|
|
47
|
-
* denominator, so that a rational expression can be created later
|
|
48
|
-
* If `mode` is `expression`, a boxed expression is returned, without
|
|
49
|
-
* splitting rationals
|
|
50
|
-
* If `mode` is `numeric`, the literals are combined into one expression
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
groupedByDegrees(options?: {
|
|
54
|
-
mode?: 'rational' | 'expression' | 'numeric';
|
|
55
|
-
}): {
|
|
56
|
-
exponent: Rational;
|
|
57
|
-
terms: BoxedExpression[];
|
|
58
|
-
}[] | null;
|
|
59
|
-
asExpression(options?: {
|
|
60
|
-
numericApproximation: boolean;
|
|
61
|
-
}): BoxedExpression;
|
|
62
|
-
/** The product, expressed as a numerator and denominator */
|
|
63
|
-
asNumeratorDenominator(): [BoxedExpression, BoxedExpression];
|
|
64
|
-
asRationalExpression(): BoxedExpression;
|
|
65
|
-
}
|
|
66
|
-
export declare function commonTerms(lhs: Product, rhs: Product): [NumericValue, BoxedExpression];
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
export declare const ConditionParent: {
|
|
3
|
-
boolean: string;
|
|
4
|
-
string: string;
|
|
5
|
-
expression: string;
|
|
6
|
-
numeric: string;
|
|
7
|
-
number: string;
|
|
8
|
-
symbol: string;
|
|
9
|
-
complex: string;
|
|
10
|
-
imaginary: string;
|
|
11
|
-
real: string;
|
|
12
|
-
notreal: string;
|
|
13
|
-
integer: string;
|
|
14
|
-
rational: string;
|
|
15
|
-
irrational: string;
|
|
16
|
-
notzero: string;
|
|
17
|
-
notone: string;
|
|
18
|
-
finite: string;
|
|
19
|
-
infinite: string;
|
|
20
|
-
positive: string;
|
|
21
|
-
negative: string;
|
|
22
|
-
nonnegative: string;
|
|
23
|
-
nonpositive: string;
|
|
24
|
-
even: string;
|
|
25
|
-
odd: string;
|
|
26
|
-
prime: string;
|
|
27
|
-
composite: string;
|
|
28
|
-
constant: string;
|
|
29
|
-
variable: string;
|
|
30
|
-
function: string;
|
|
31
|
-
operator: string;
|
|
32
|
-
relation: string;
|
|
33
|
-
equation: string;
|
|
34
|
-
inequality: string;
|
|
35
|
-
collection: string;
|
|
36
|
-
list: string;
|
|
37
|
-
set: string;
|
|
38
|
-
tuple: string;
|
|
39
|
-
single: string;
|
|
40
|
-
pair: string;
|
|
41
|
-
triple: string;
|
|
42
|
-
tensor: string;
|
|
43
|
-
vector: string;
|
|
44
|
-
matrix: string;
|
|
45
|
-
scalar: string;
|
|
46
|
-
unit: string;
|
|
47
|
-
dimension: string;
|
|
48
|
-
angle: string;
|
|
49
|
-
polynomial: string;
|
|
50
|
-
};
|
|
51
|
-
export declare const CONDITIONS: {
|
|
52
|
-
boolean: (x: BoxedExpression) => boolean;
|
|
53
|
-
string: (x: BoxedExpression) => boolean;
|
|
54
|
-
number: (x: BoxedExpression) => boolean;
|
|
55
|
-
symbol: (x: BoxedExpression) => boolean;
|
|
56
|
-
expression: (x: BoxedExpression) => boolean;
|
|
57
|
-
numeric: (x: BoxedExpression) => boolean;
|
|
58
|
-
integer: (x: BoxedExpression) => boolean;
|
|
59
|
-
rational: (x: BoxedExpression) => boolean;
|
|
60
|
-
irrational: (x: BoxedExpression) => boolean;
|
|
61
|
-
real: (x: BoxedExpression) => boolean;
|
|
62
|
-
notreal: (x: BoxedExpression) => boolean;
|
|
63
|
-
complex: (x: BoxedExpression) => boolean;
|
|
64
|
-
imaginary: (x: BoxedExpression) => boolean;
|
|
65
|
-
positive: (x: BoxedExpression) => boolean;
|
|
66
|
-
negative: (x: BoxedExpression) => boolean;
|
|
67
|
-
nonnegative: (x: BoxedExpression) => boolean;
|
|
68
|
-
nonpositive: (x: BoxedExpression) => boolean;
|
|
69
|
-
even: (x: BoxedExpression) => boolean;
|
|
70
|
-
odd: (x: BoxedExpression) => boolean;
|
|
71
|
-
prime: (x: BoxedExpression) => boolean;
|
|
72
|
-
composite: (x: BoxedExpression) => boolean;
|
|
73
|
-
notzero: (x: BoxedExpression) => boolean;
|
|
74
|
-
notone: (x: BoxedExpression) => boolean;
|
|
75
|
-
finite: (x: BoxedExpression) => boolean;
|
|
76
|
-
infinite: (x: BoxedExpression) => boolean;
|
|
77
|
-
constant: (x: BoxedExpression) => boolean;
|
|
78
|
-
variable: (x: BoxedExpression) => boolean;
|
|
79
|
-
function: (x: BoxedExpression) => boolean;
|
|
80
|
-
relation: (x: BoxedExpression) => boolean;
|
|
81
|
-
equation: (x: BoxedExpression) => boolean;
|
|
82
|
-
inequality: (x: BoxedExpression) => boolean;
|
|
83
|
-
collection: (x: BoxedExpression) => boolean;
|
|
84
|
-
list: (x: BoxedExpression) => boolean;
|
|
85
|
-
set: (x: BoxedExpression) => boolean;
|
|
86
|
-
tuple: (x: BoxedExpression) => boolean;
|
|
87
|
-
single: (x: BoxedExpression) => boolean;
|
|
88
|
-
pair: (x: BoxedExpression) => boolean;
|
|
89
|
-
triple: (x: BoxedExpression) => boolean;
|
|
90
|
-
scalar: (x: BoxedExpression) => boolean;
|
|
91
|
-
tensor: (x: BoxedExpression) => boolean;
|
|
92
|
-
vector: (x: BoxedExpression) => boolean;
|
|
93
|
-
matrix: (x: BoxedExpression) => boolean;
|
|
94
|
-
unit: (x: BoxedExpression) => boolean;
|
|
95
|
-
dimension: (x: BoxedExpression) => boolean;
|
|
96
|
-
angle: (x: BoxedExpression) => boolean;
|
|
97
|
-
polynomial: (x: BoxedExpression) => boolean;
|
|
98
|
-
};
|
|
99
|
-
export declare function checkConditions(x: BoxedExpression, conditions: string[]): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Create a boxed rule set from a collection of non-boxed rules
|
|
102
|
-
*/
|
|
103
|
-
export declare function boxRules(ce: ComputeEngine, rs: Rule | ReadonlyArray<Rule | BoxedRule> | BoxedRuleSet | undefined | null, options?: {
|
|
104
|
-
canonical?: boolean;
|
|
105
|
-
}): BoxedRuleSet;
|
|
106
|
-
/**
|
|
107
|
-
* Apply a rule to an expression, assuming an incoming substitution
|
|
108
|
-
* @param rule the rule to apply
|
|
109
|
-
* @param expr the expression to apply the rule to
|
|
110
|
-
* @param substitution an incoming substitution
|
|
111
|
-
* @param options
|
|
112
|
-
* @returns A transformed expression, if the rule matched. `null` otherwise.
|
|
113
|
-
*/
|
|
114
|
-
export declare function applyRule(rule: Readonly<BoxedRule>, expr: BoxedExpression, substitution: BoxedSubstitution, options?: Readonly<Partial<ReplaceOptions>>): RuleStep | null;
|
|
115
|
-
/**
|
|
116
|
-
* Apply the rules in the ruleset and return a modified expression
|
|
117
|
-
* and the set of rules that were applied.
|
|
118
|
-
*
|
|
119
|
-
* The `replace` function can be used to apply a rule to a non-canonical
|
|
120
|
-
* expression.
|
|
121
|
-
*
|
|
122
|
-
*/
|
|
123
|
-
export declare function replace(expr: BoxedExpression, rules: Rule | (Rule | BoxedRule)[] | BoxedRuleSet, options?: Partial<ReplaceOptions>): RuleSteps;
|
|
124
|
-
/**
|
|
125
|
-
* For each rules in the rule set that match, return the `replace` of the rule
|
|
126
|
-
*
|
|
127
|
-
* @param rules
|
|
128
|
-
*/
|
|
129
|
-
export declare function matchAnyRules(expr: BoxedExpression, rules: BoxedRuleSet, sub: BoxedSubstitution, options?: Partial<ReplaceOptions>): BoxedExpression[];
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
export declare function sgn(expr: BoxedExpression): Sign | undefined;
|
|
3
|
-
/**
|
|
4
|
-
* Sign `s` is > 0.
|
|
5
|
-
*
|
|
6
|
-
* :::info[Note]
|
|
7
|
-
* Returns `undefined` for cases where the given sign is either non-applicable to real numbers
|
|
8
|
-
* ('nan', 'unsigned', 'complex-infinity') or does not convey enough information (e.g. 'real',
|
|
9
|
-
* 'not-zero', 'real-not-zero', 'non-negative').
|
|
10
|
-
* :::
|
|
11
|
-
*
|
|
12
|
-
* @param s
|
|
13
|
-
*/
|
|
14
|
-
export declare function positiveSign(s: Sign | undefined): boolean | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Sign `s` is >= 0.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* **note**: returns *undefined* where sign does not apply to the field of reals, or does not convey
|
|
20
|
-
* enough information.
|
|
21
|
-
*
|
|
22
|
-
* @param s
|
|
23
|
-
*/
|
|
24
|
-
export declare function nonNegativeSign(s: Sign | undefined): boolean | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Sign `s` is < 0.
|
|
27
|
-
*
|
|
28
|
-
* :::info[Note]
|
|
29
|
-
* Returns `undefined` for cases where the given sign is either non-applicable to real numbers
|
|
30
|
-
* ('nan', 'unsigned', 'complex-infinity') or does not convey enough information (e.g. 'real',
|
|
31
|
-
* 'not-zero', 'real-not-zero', 'non-positive').
|
|
32
|
-
* :::
|
|
33
|
-
*
|
|
34
|
-
* @param s
|
|
35
|
-
*/
|
|
36
|
-
export declare function negativeSign(s: Sign | undefined): boolean | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Sign `s` is <= 0.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* **note**: returns *undefined* where sign does not apply to the field of reals, or does not convey
|
|
42
|
-
* enough information.
|
|
43
|
-
*
|
|
44
|
-
* @param s
|
|
45
|
-
*/
|
|
46
|
-
export declare function nonPositiveSign(s: Sign | undefined): boolean | undefined;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
export declare const UNIVARIATE_ROOTS: Rule[];
|
|
3
|
-
/**
|
|
4
|
-
* Expression is a function of a single variable (`x`) or an Equality
|
|
5
|
-
*
|
|
6
|
-
* Return the roots of that variable
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export declare function findUnivariateRoots(expr: BoxedExpression, x: string): ReadonlyArray<BoxedExpression>;
|
|
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;
|
|
18
|
-
/** Harmonization rules transform an expr into one or more equivalent
|
|
19
|
-
* expressions that are easier to solve */
|
|
20
|
-
export declare const HARMONIZATION_RULES: Rule[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
export declare function Fu(exp: BoxedExpression): RuleStep | undefined;
|
|
3
|
-
/** Assuming x in an expression in radians, convert to current angular unit. */
|
|
4
|
-
export declare function radiansToAngle(x: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
5
|
-
export declare function evalTrig(name: string, op: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
6
|
-
export declare function processInverseFunction(ce: ComputeEngine, xs: ReadonlyArray<BoxedExpression>): BoxedExpression | undefined;
|
|
7
|
-
export declare function trigSign(operator: string, x: BoxedExpression): Sign | undefined;
|
|
8
|
-
export declare function isConstructible(x: string | BoxedExpression): boolean;
|
|
9
|
-
export declare function constructibleValues(operator: string, x: BoxedExpression | undefined): undefined | BoxedExpression;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import { Type } from '../../common/type/types';
|
|
3
|
-
import { NumericValue } from '../numeric-value/types';
|
|
4
|
-
/**
|
|
5
|
-
* Check if an expression contains symbolic transcendental functions of constants
|
|
6
|
-
* (like ln(2), sin(1), etc.) that should not be evaluated numerically.
|
|
7
|
-
*
|
|
8
|
-
* This excludes transcendentals that simplify to exact values, such as:
|
|
9
|
-
* - ln(e) -> 1
|
|
10
|
-
* - sin(0) -> 0
|
|
11
|
-
* - cos(0) -> 1
|
|
12
|
-
*/
|
|
13
|
-
export declare function hasSymbolicTranscendental(expr: BoxedExpression): boolean;
|
|
14
|
-
export declare function isDictionary(expr: any | null | undefined): expr is DictionaryInterface;
|
|
15
|
-
export declare function isBoxedExpression(x: unknown): x is BoxedExpression;
|
|
16
|
-
/**
|
|
17
|
-
* For any numeric result, if `bignumPreferred()` is true, calculate using
|
|
18
|
-
* bignums. If `bignumPreferred()` is false, calculate using machine numbers
|
|
19
|
-
*/
|
|
20
|
-
export declare function bignumPreferred(ce: ComputeEngine): boolean;
|
|
21
|
-
export declare function hashCode(s: string): number;
|
|
22
|
-
export declare function normalizedUnknownsForSolve(syms: string | Iterable<string> | BoxedExpression | Iterable<BoxedExpression> | null | undefined): string[];
|
|
23
|
-
/** Return the local variables in the expression.
|
|
24
|
-
*
|
|
25
|
-
* A local variable is a symbol that is declared with a `Declare`
|
|
26
|
-
* expression in a `Block` expression.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export declare function getLocalVariables(expr: BoxedExpression): string[];
|
|
30
|
-
export declare function domainToType(expr: BoxedExpression): Type;
|
|
31
|
-
/**
|
|
32
|
-
* Return the angle in the range [0, 2π) that is equivalent to the given angle.
|
|
33
|
-
*
|
|
34
|
-
* @param x
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
export declare function canonicalAngle(x: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Return a multiple of the imaginary unit, e.g.
|
|
40
|
-
* - 'ImaginaryUnit' -> 1
|
|
41
|
-
* - ['Negate', 'ImaginaryUnit'] -> -1
|
|
42
|
-
* - ['Negate', ['Multiply', 3, 'ImaginaryUnit']] -> -3
|
|
43
|
-
* - ['Multiply', 5, 'ImaginaryUnit'] -> 5
|
|
44
|
-
* - ['Multiply', 'ImaginaryUnit', 5] -> 5
|
|
45
|
-
* - ['Divide', 'ImaginaryUnit', 2] -> 0.5
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
export declare function getImaginaryFactor(expr: number | BoxedExpression): BoxedExpression | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* `true` if expr is a number with imaginary part 1 and real part 0, or a symbol with a definition
|
|
51
|
-
* matching this. Does not bind expr if a symbol.
|
|
52
|
-
*
|
|
53
|
-
* @export
|
|
54
|
-
* @param expr
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
export declare function isImaginaryUnit(expr: BoxedExpression): boolean;
|
|
58
|
-
export declare function getPiTerm(expr: BoxedExpression): [k: NumericValue, t: NumericValue];
|
|
59
|
-
export declare function isValidOperatorDef(def: any): def is Partial<OperatorDefinition>;
|
|
60
|
-
export declare function isValidValueDef(def: any): def is Partial<ValueDefinition>;
|
|
61
|
-
export declare function isValueDef(def: BoxedDefinition | undefined): def is TaggedValueDefinition;
|
|
62
|
-
export declare function isOperatorDef(def: BoxedDefinition | undefined): def is TaggedOperatorDefinition;
|
|
63
|
-
export declare function updateDef(ce: ComputeEngine, name: string, def: BoxedDefinition, newDef: Partial<OperatorDefinition> | BoxedOperatorDefinition | Partial<ValueDefinition> | BoxedValueDefinition): void;
|
|
64
|
-
export declare function placeholderDef(ce: ComputeEngine, name: string): BoxedDefinition;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import type { BoxedExpression, ComputeEngine } from '../global-types';
|
|
3
|
-
/**
|
|
4
|
-
* Check that the number of arguments is as expected.
|
|
5
|
-
*
|
|
6
|
-
* Converts the arguments to canonical, and flattens the sequence.
|
|
7
|
-
*/
|
|
8
|
-
export declare function checkArity(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, count: number): ReadonlyArray<BoxedExpression>;
|
|
9
|
-
/**
|
|
10
|
-
* Validation of arguments is normally done by checking the signature of the
|
|
11
|
-
* function vs the arguments of the expression. However, we have a fastpath
|
|
12
|
-
* for some common operations (add, multiply, power, neg, etc...) that bypasses
|
|
13
|
-
* the regular checks. This is its replacements.
|
|
14
|
-
*
|
|
15
|
-
* Since all those fastpath functions are numeric (i.e. have numeric arguments
|
|
16
|
-
* and a numeric result), we do a simple numeric check of all arguments, and
|
|
17
|
-
* verify we have the number of expected arguments.
|
|
18
|
-
*
|
|
19
|
-
* We also assume that the function is threadable.
|
|
20
|
-
*
|
|
21
|
-
* The arguments are made canonical.
|
|
22
|
-
*
|
|
23
|
-
* Flattens sequence expressions.
|
|
24
|
-
*/
|
|
25
|
-
export declare function checkNumericArgs(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, options?: number | {
|
|
26
|
-
count?: number;
|
|
27
|
-
flatten?: string;
|
|
28
|
-
}): ReadonlyArray<BoxedExpression>;
|
|
29
|
-
/**
|
|
30
|
-
* Check that an argument is of the expected type.
|
|
31
|
-
*
|
|
32
|
-
* Converts the arguments to canonical
|
|
33
|
-
*/
|
|
34
|
-
export declare function checkType(ce: ComputeEngine, arg: BoxedExpression | undefined | null, type: Type | undefined): BoxedExpression;
|
|
35
|
-
export declare function checkTypes(ce: ComputeEngine, args: ReadonlyArray<BoxedExpression>, types: Type[]): ReadonlyArray<BoxedExpression>;
|
|
36
|
-
/**
|
|
37
|
-
* Check that the argument is pure.
|
|
38
|
-
*/
|
|
39
|
-
export declare function checkPure(ce: ComputeEngine, arg: BoxedExpression | BoxedExpression | undefined | null): BoxedExpression;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* If the arguments match the parameters, return null.
|
|
43
|
-
*
|
|
44
|
-
* Otherwise return a list of expressions indicating the mismatched
|
|
45
|
-
* arguments.
|
|
46
|
-
*
|
|
47
|
-
* <!--
|
|
48
|
-
* @todo?:
|
|
49
|
-
* - Some permutations of operands should perhaps always be treated as invalid. Consider:
|
|
50
|
-
* - A sequence wildcard (non-optional, i.e. '__') followed by either a universal wildcard ('_'),
|
|
51
|
-
* or another non-optional sequence wildcard. (note that an optional sequence wildcard is
|
|
52
|
-
* unproblematic here.)
|
|
53
|
-
*
|
|
54
|
-
* -->
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
export declare function validateArguments(ce: ComputeEngine, ops: ReadonlyArray<BoxedExpression>, signature: Type, lazy?: boolean, threadable?: boolean): ReadonlyArray<BoxedExpression> | null;
|
|
58
|
-
export declare function spellCheckMessage(expr: BoxedExpression): string;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
/** If a collection has fewer than this many elements, eagerly evaluate it.
|
|
3
|
-
*
|
|
4
|
-
* For example, evaluate the Union of two sets with 10 elements each will
|
|
5
|
-
* result in a set with 20 elements.
|
|
6
|
-
*
|
|
7
|
-
* If the sum of the sizes of the two sets is greater than
|
|
8
|
-
* `MAX_SIZE_EAGER_COLLECTION`, the result is a Union expression
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export declare const MAX_SIZE_EAGER_COLLECTION = 100;
|
|
12
|
-
export declare function isFiniteIndexedCollection(col: BoxedExpression): boolean;
|
|
13
|
-
export declare function repeat(value: BoxedExpression, count?: number): Iterator<BoxedExpression>;
|
|
14
|
-
/**
|
|
15
|
-
* Zips together multiple collections into a single iterator.
|
|
16
|
-
*
|
|
17
|
-
* Example:
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const a = ce.box(['List', 1, 2, 3]);
|
|
20
|
-
* const b = ce.box(['List', 4, 5, 6]);
|
|
21
|
-
* const zipped = zip([a, b]);
|
|
22
|
-
* for (const [x, y] of zipped) {
|
|
23
|
-
* console.log(x, y); // 1 4, 2 5, 3 6
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function zip(items: ReadonlyArray<BoxedExpression>): Iterator<BoxedExpression[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Default collection handlers suitable for collections that store their
|
|
30
|
-
* elements as operands.
|
|
31
|
-
*
|
|
32
|
-
* This is the case for List, Tuple, etc.
|
|
33
|
-
*/
|
|
34
|
-
export declare function basicIndexedCollectionHandlers(): CollectionHandlers;
|
|
35
|
-
export declare function defaultCollectionHandlers(def: undefined | CollectionHandlers): CollectionHandlers | undefined;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import type { CompileTarget, TargetSource } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Base compiler class containing language-agnostic compilation logic
|
|
5
|
-
*/
|
|
6
|
-
export declare class BaseCompiler {
|
|
7
|
-
/**
|
|
8
|
-
* Compile an expression to target language source code
|
|
9
|
-
*/
|
|
10
|
-
static compile(expr: BoxedExpression | undefined, target: CompileTarget, prec?: number): TargetSource;
|
|
11
|
-
/**
|
|
12
|
-
* Compile a function expression
|
|
13
|
-
*/
|
|
14
|
-
static compileExpr(engine: ComputeEngine, h: string, args: ReadonlyArray<BoxedExpression>, prec: number, target: CompileTarget): TargetSource;
|
|
15
|
-
/**
|
|
16
|
-
* Compile a block expression
|
|
17
|
-
*/
|
|
18
|
-
private static compileBlock;
|
|
19
|
-
/**
|
|
20
|
-
* Compile loop constructs (Sum/Product)
|
|
21
|
-
*/
|
|
22
|
-
private static compileLoop;
|
|
23
|
-
/**
|
|
24
|
-
* Generate a temporary variable name
|
|
25
|
-
*/
|
|
26
|
-
static tempVar(): string;
|
|
27
|
-
/**
|
|
28
|
-
* Inline or wrap expression in IIFE based on complexity
|
|
29
|
-
*/
|
|
30
|
-
static inlineExpression(body: string, x: string): string;
|
|
31
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import { chop, factorial, gcd, lcm, limit } from '../numerics/numeric';
|
|
3
|
-
import { gamma, gammaln } from '../numerics/special-functions';
|
|
4
|
-
import { interquartileRange, kurtosis, mean, median, mode, populationStandardDeviation, populationVariance, quartiles, skewness, standardDeviation, variance } from '../numerics/statistics';
|
|
5
|
-
import type { CompileTarget, CompiledOperators, CompiledFunctions, LanguageTarget, CompilationOptions, CompiledExecutable } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* JavaScript-specific function extension that provides system functions
|
|
8
|
-
*/
|
|
9
|
-
export declare class ComputeEngineFunction extends Function {
|
|
10
|
-
SYS: {
|
|
11
|
-
chop: typeof chop;
|
|
12
|
-
factorial: typeof factorial;
|
|
13
|
-
gamma: typeof gamma;
|
|
14
|
-
gcd: typeof gcd;
|
|
15
|
-
integrate: (f: any, a: any, b: any) => number;
|
|
16
|
-
lcm: typeof lcm;
|
|
17
|
-
lngamma: typeof gammaln;
|
|
18
|
-
limit: typeof limit;
|
|
19
|
-
mean: typeof mean;
|
|
20
|
-
median: typeof median;
|
|
21
|
-
variance: typeof variance;
|
|
22
|
-
populationVariance: typeof populationVariance;
|
|
23
|
-
standardDeviation: typeof standardDeviation;
|
|
24
|
-
populationStandardDeviation: typeof populationStandardDeviation;
|
|
25
|
-
kurtosis: typeof kurtosis;
|
|
26
|
-
skewness: typeof skewness;
|
|
27
|
-
mode: typeof mode;
|
|
28
|
-
quartiles: typeof quartiles;
|
|
29
|
-
interquartileRange: typeof interquartileRange;
|
|
30
|
-
};
|
|
31
|
-
constructor(body: string, preamble?: string);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* JavaScript function literal with parameters
|
|
35
|
-
*/
|
|
36
|
-
export declare class ComputeEngineFunctionLiteral extends Function {
|
|
37
|
-
SYS: {
|
|
38
|
-
chop: typeof chop;
|
|
39
|
-
factorial: typeof factorial;
|
|
40
|
-
gamma: typeof gamma;
|
|
41
|
-
gcd: typeof gcd;
|
|
42
|
-
integrate: (f: any, a: any, b: any) => number;
|
|
43
|
-
lcm: typeof lcm;
|
|
44
|
-
lngamma: typeof gammaln;
|
|
45
|
-
limit: typeof limit;
|
|
46
|
-
mean: typeof mean;
|
|
47
|
-
median: typeof median;
|
|
48
|
-
variance: typeof variance;
|
|
49
|
-
populationVariance: typeof populationVariance;
|
|
50
|
-
standardDeviation: typeof standardDeviation;
|
|
51
|
-
populationStandardDeviation: typeof populationStandardDeviation;
|
|
52
|
-
kurtosis: typeof kurtosis;
|
|
53
|
-
skewness: typeof skewness;
|
|
54
|
-
mode: typeof mode;
|
|
55
|
-
quartiles: typeof quartiles;
|
|
56
|
-
interquartileRange: typeof interquartileRange;
|
|
57
|
-
};
|
|
58
|
-
constructor(body: string, args: string[]);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* JavaScript language target implementation
|
|
62
|
-
*/
|
|
63
|
-
export declare class JavaScriptTarget implements LanguageTarget {
|
|
64
|
-
getOperators(): CompiledOperators;
|
|
65
|
-
getFunctions(): CompiledFunctions;
|
|
66
|
-
createTarget(options?: Partial<CompileTarget>): CompileTarget;
|
|
67
|
-
compileToExecutable(expr: BoxedExpression, options?: CompilationOptions): CompiledExecutable;
|
|
68
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
import type { BoxedExpression } from '../global-types';
|
|
3
|
-
/**
|
|
4
|
-
* Source code in the target language
|
|
5
|
-
*/
|
|
6
|
-
export type TargetSource = string;
|
|
7
|
-
/**
|
|
8
|
-
* A compiled function that can be executed
|
|
9
|
-
*/
|
|
10
|
-
export type CompiledFunction = string | ((args: ReadonlyArray<BoxedExpression>, compile: (expr: BoxedExpression) => TargetSource, target: CompileTarget) => TargetSource);
|
|
11
|
-
/**
|
|
12
|
-
* Mapping of operators to their target language representation and precedence
|
|
13
|
-
*/
|
|
14
|
-
export type CompiledOperators = Record<MathJsonSymbol, [
|
|
15
|
-
op: string,
|
|
16
|
-
prec: number
|
|
17
|
-
]>;
|
|
18
|
-
/**
|
|
19
|
-
* Mapping of function names to their target language implementation
|
|
20
|
-
*/
|
|
21
|
-
export type CompiledFunctions = {
|
|
22
|
-
[id: MathJsonSymbol]: CompiledFunction;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Target language compilation configuration
|
|
26
|
-
*/
|
|
27
|
-
export interface CompileTarget {
|
|
28
|
-
/** Get operator representation for the target language */
|
|
29
|
-
operators?: (op: MathJsonSymbol) => [op: string, prec: number] | undefined;
|
|
30
|
-
/** Get function implementation for the target language */
|
|
31
|
-
functions?: (id: MathJsonSymbol) => CompiledFunction | undefined;
|
|
32
|
-
/** Get variable representation for the target language */
|
|
33
|
-
var: (id: MathJsonSymbol) => string | undefined;
|
|
34
|
-
/** Format string literals for the target language */
|
|
35
|
-
string: (str: string) => string;
|
|
36
|
-
/** Format numeric literals for the target language */
|
|
37
|
-
number: (n: number) => string;
|
|
38
|
-
/** Format whitespace for the target language */
|
|
39
|
-
ws: (s?: string) => string;
|
|
40
|
-
/** Code to be inserted at the beginning of the compiled output */
|
|
41
|
-
preamble: string;
|
|
42
|
-
/** Current indentation level */
|
|
43
|
-
indent: number;
|
|
44
|
-
/** Target language identifier (for debugging/logging) */
|
|
45
|
-
language?: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Base interface for language-specific compilation targets
|
|
49
|
-
*/
|
|
50
|
-
export interface LanguageTarget {
|
|
51
|
-
/** Get the default operators for this language */
|
|
52
|
-
getOperators(): CompiledOperators;
|
|
53
|
-
/** Get the default functions for this language */
|
|
54
|
-
getFunctions(): CompiledFunctions;
|
|
55
|
-
/** Create a CompileTarget for this language */
|
|
56
|
-
createTarget(options?: Partial<CompileTarget>): CompileTarget;
|
|
57
|
-
/** Compile an expression to executable code in this language */
|
|
58
|
-
compileToExecutable(expr: BoxedExpression, options?: CompilationOptions): CompiledExecutable;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Options for compilation
|
|
62
|
-
*/
|
|
63
|
-
export interface CompilationOptions {
|
|
64
|
-
/** Custom function implementations */
|
|
65
|
-
functions?: Record<MathJsonSymbol, TargetSource | Function>;
|
|
66
|
-
/** Variable bindings */
|
|
67
|
-
vars?: Record<MathJsonSymbol, TargetSource>;
|
|
68
|
-
/** Additional imports/libraries to include */
|
|
69
|
-
imports?: unknown[];
|
|
70
|
-
/** Additional preamble code */
|
|
71
|
-
preamble?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* A compiled expression that can be executed
|
|
75
|
-
*/
|
|
76
|
-
export interface CompiledExecutable {
|
|
77
|
-
/** Execute the compiled code */
|
|
78
|
-
(...args: any[]): any;
|
|
79
|
-
/** Get the source code */
|
|
80
|
-
toString(): string;
|
|
81
|
-
/** Flag indicating this is a compiled expression */
|
|
82
|
-
isCompiled: true;
|
|
83
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* 0.31.0 */
|
|
2
|
-
/**
|
|
3
|
-
* The default cost function, used to determine if a new expression is simpler
|
|
4
|
-
* than the old one.
|
|
5
|
-
*
|
|
6
|
-
* To change the cost function used by the engine, set the
|
|
7
|
-
* `ce.costFunction` property of the engine or pass a custom cost function
|
|
8
|
-
* to the `simplify` function.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export declare function costFunction(expr: BoxedExpression): number;
|
|
12
|
-
export declare function leafCount(expr: BoxedExpression): number;
|
|
13
|
-
export declare const DEFAULT_COST_FUNCTION: typeof costFunction;
|