@cortex-js/compute-engine 0.6.0 → 0.8.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 +14942 -11619
- package/dist/compute-engine.min.esm.js +2 -2
- package/dist/compute-engine.min.js +2 -2
- package/dist/math-json.esm.js +62 -43
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +72 -57
- package/dist/types/compute-engine/boxed-expression/box.d.ts +2 -14
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +36 -19
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +46 -38
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +6 -4
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +13 -10
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +28 -14
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +25 -8
- package/dist/types/compute-engine/compute-engine.d.ts +72 -49
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.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-core.d.ts +1 -3
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.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-sets.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 +8 -7
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +87 -62
- package/dist/types/compute-engine/latex-syntax/public.d.ts +65 -46
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +6 -4
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +11 -0
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +15 -0
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +19 -0
- package/dist/types/compute-engine/{dictionary → library}/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +2 -0
- package/dist/types/compute-engine/library/calculus.d.ts +2 -0
- package/dist/types/compute-engine/library/collections.d.ts +2 -0
- package/dist/types/compute-engine/library/core.d.ts +2 -0
- package/dist/types/compute-engine/library/domains.d.ts +15 -0
- package/dist/types/compute-engine/library/library.d.ts +17 -0
- package/dist/types/compute-engine/library/logic.d.ts +2 -0
- package/dist/types/compute-engine/library/polynomials.d.ts +2 -0
- package/dist/types/compute-engine/library/relational-operator.d.ts +2 -0
- package/dist/types/compute-engine/library/sets.d.ts +2 -0
- package/dist/types/compute-engine/library/trigonometry.d.ts +2 -0
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-decimal.d.ts +5 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +4 -2
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +717 -504
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +2 -2
- package/dist/types/compute-engine/symbolic/utils.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +27 -23
- package/dist/types/math-json/utils.d.ts +22 -16
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +20 -20
- package/dist/types/compute-engine/dictionary/arithmetic-add.d.ts +0 -11
- package/dist/types/compute-engine/dictionary/arithmetic-divide.d.ts +0 -9
- package/dist/types/compute-engine/dictionary/arithmetic-multiply.d.ts +0 -17
- package/dist/types/compute-engine/dictionary/arithmetic.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/collections.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/core.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/dictionary.d.ts +0 -26
- package/dist/types/compute-engine/dictionary/logic.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/polynomials.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/relational-operator.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/sets.d.ts +0 -2
- package/dist/types/compute-engine/dictionary/trigonometry.d.ts +0 -2
|
@@ -1,44 +1,63 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
|
-
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOption,
|
|
3
|
+
import { BoxedExpression, BoxedFunctionDefinition, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, Substitution, ReplaceOptions, Metadata, PatternMatchOption, BoxedDomain, BoxedLambdaExpression, RuntimeScope } from '../public';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedFunction
|
|
6
6
|
*/
|
|
7
7
|
export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
8
|
+
private _scope;
|
|
9
|
+
private readonly _head;
|
|
10
|
+
private readonly _ops;
|
|
11
|
+
private _canonical;
|
|
10
12
|
private _def;
|
|
11
|
-
private _isCanonical;
|
|
12
13
|
private _isPure;
|
|
14
|
+
/** The domain of the value of the function applied to its arguments */
|
|
15
|
+
private _codomain;
|
|
13
16
|
/** The cached values of applying the tail to the head.
|
|
14
17
|
* If the function is not pure, it is never cached.
|
|
15
18
|
*/
|
|
16
19
|
private _value;
|
|
17
20
|
private _numericValue;
|
|
18
21
|
private _hash;
|
|
19
|
-
constructor(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[],
|
|
22
|
+
constructor(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[], options?: {
|
|
23
|
+
metadata?: Metadata;
|
|
24
|
+
canonical?: boolean;
|
|
25
|
+
def?: BoxedFunctionDefinition;
|
|
26
|
+
});
|
|
20
27
|
get hash(): number;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
get description(): string[];
|
|
24
|
-
get url(): string;
|
|
25
|
-
get complexity(): number;
|
|
26
|
-
get head(): string | BoxedExpression;
|
|
27
|
-
get value(): BoxedExpression | undefined;
|
|
28
|
-
get numericValue(): BoxedExpression | undefined;
|
|
29
|
-
get isPure(): boolean;
|
|
28
|
+
get isCanonical(): boolean;
|
|
29
|
+
set isCanonical(val: boolean);
|
|
30
30
|
get isLiteral(): boolean;
|
|
31
|
+
get isPure(): boolean;
|
|
32
|
+
get json(): Expression;
|
|
33
|
+
get head(): string | BoxedExpression;
|
|
31
34
|
get ops(): BoxedExpression[];
|
|
32
35
|
get nops(): number;
|
|
33
36
|
get op1(): BoxedExpression;
|
|
34
37
|
get op2(): BoxedExpression;
|
|
35
38
|
get op3(): BoxedExpression;
|
|
39
|
+
get isValid(): boolean;
|
|
40
|
+
get canonical(): BoxedExpression;
|
|
41
|
+
map<T = BoxedExpression>(fn: (x: BoxedExpression) => T): IterableIterator<T>;
|
|
42
|
+
apply(fn: (x: BoxedExpression) => SemiBoxedExpression, head?: string): BoxedExpression;
|
|
43
|
+
subs(sub: Substitution): BoxedExpression;
|
|
44
|
+
replace(rules: BoxedRuleSet, options?: ReplaceOptions): BoxedExpression | null;
|
|
45
|
+
has(x: string | string[]): boolean;
|
|
46
|
+
/** `isSame` is structural/symbolic equality */
|
|
47
|
+
isSame(rhs: BoxedExpression): boolean;
|
|
48
|
+
match(rhs: BoxedExpression, options?: PatternMatchOption): Substitution | null;
|
|
49
|
+
unbind(): void;
|
|
50
|
+
get wikidata(): string | undefined;
|
|
51
|
+
get description(): string[] | undefined;
|
|
52
|
+
get url(): string | undefined;
|
|
53
|
+
get complexity(): number | undefined;
|
|
36
54
|
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
get
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
bind(_scope: RuntimeScope | null): void;
|
|
56
|
+
get value(): BoxedExpression | undefined;
|
|
57
|
+
get numericValue(): BoxedExpression | undefined;
|
|
58
|
+
get domain(): BoxedDomain;
|
|
59
|
+
/** `isEqual` is mathematical equality */
|
|
60
|
+
isEqual(rhs: BoxedExpression): boolean;
|
|
42
61
|
isLess(rhs: BoxedExpression): boolean | undefined;
|
|
43
62
|
isLessEqual(rhs: BoxedExpression): boolean | undefined;
|
|
44
63
|
isGreater(rhs: BoxedExpression): boolean | undefined;
|
|
@@ -59,28 +78,17 @@ export declare class BoxedFunction extends AbstractBoxedExpression {
|
|
|
59
78
|
get isExtendedReal(): boolean | undefined;
|
|
60
79
|
get isComplex(): boolean | undefined;
|
|
61
80
|
get isImaginary(): boolean | undefined;
|
|
62
|
-
get json(): Expression;
|
|
63
|
-
has(x: string | string[]): boolean;
|
|
64
|
-
/** `isSame` is structural/symbolic equality */
|
|
65
|
-
isSame(rhs: BoxedExpression): boolean;
|
|
66
|
-
match(rhs: BoxedExpression, options?: PatternMatchOption): Substitution | null;
|
|
67
|
-
/** `isEqual` is mathematical equality */
|
|
68
|
-
isEqual(rhs: BoxedExpression): boolean;
|
|
69
81
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
70
|
-
map<T = BoxedExpression>(fn: (x: BoxedExpression) => T): IterableIterator<T>;
|
|
71
|
-
get isCanonical(): boolean;
|
|
72
|
-
set isCanonical(val: boolean);
|
|
73
|
-
get canonical(): BoxedExpression;
|
|
74
|
-
apply(fn: (x: BoxedExpression) => SemiBoxedExpression, head?: string): BoxedExpression;
|
|
75
82
|
simplify(options?: SimplifyOptions): BoxedExpression;
|
|
76
83
|
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
77
84
|
N(options?: NOptions): BoxedExpression;
|
|
78
85
|
solve(_vars: Iterable<string>): null | BoxedExpression[];
|
|
79
|
-
replace(rules: BoxedRuleSet, options?: ReplaceOptions): BoxedExpression | null;
|
|
80
|
-
subs(sub: Substitution): BoxedExpression;
|
|
81
86
|
}
|
|
82
|
-
export declare function
|
|
83
|
-
|
|
87
|
+
export declare function makeCanonicalFunction(ce: IComputeEngine, head: string | BoxedExpression, ops: BoxedExpression[], options?: {
|
|
88
|
+
[x: string]: any;
|
|
89
|
+
metadata?: Metadata;
|
|
90
|
+
}): BoxedExpression;
|
|
91
|
+
export declare function lambda(ce: IComputeEngine, fn: BoxedLambdaExpression, args: BoxedExpression[]): BoxedExpression;
|
|
84
92
|
/** Apply the function `f` to elements of `xs`, except to the elements
|
|
85
93
|
* described by `skip`:
|
|
86
94
|
* - `all`: don't apply f to any elements
|
|
@@ -90,8 +98,8 @@ export declare function ungroup(expr: BoxedExpression): BoxedExpression;
|
|
|
90
98
|
* - 'last': apply `f` to all elements except the last
|
|
91
99
|
* - 'most': apply `f` to the last elements, skip the others
|
|
92
100
|
*
|
|
93
|
-
* Account for `Hold`, `ReleaseHold` and
|
|
101
|
+
* Account for `Hold`, `ReleaseHold`, `Sequence`, `Symbol` and `Nothing`.
|
|
94
102
|
*
|
|
95
103
|
* If `f` returns `null`, the element is not added to the result
|
|
96
104
|
*/
|
|
97
|
-
export declare function holdMap(xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', f: (
|
|
105
|
+
export declare function holdMap(head: string, xs: BoxedExpression[], skip: 'all' | 'none' | 'first' | 'rest' | 'last' | 'most', associative: boolean, f: (x: BoxedExpression) => BoxedExpression | null): BoxedExpression[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
2
|
import { Complex } from 'complex.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
|
-
import { BoxedExpression,
|
|
4
|
+
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOption, SimplifyOptions, Substitution } from '../public';
|
|
5
5
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
6
6
|
/**
|
|
7
7
|
* BoxedNumber
|
|
@@ -26,7 +26,9 @@ export declare class BoxedNumber extends AbstractBoxedExpression {
|
|
|
26
26
|
get isLiteral(): boolean;
|
|
27
27
|
get isCanonical(): boolean;
|
|
28
28
|
set isCanonical(val: boolean);
|
|
29
|
-
get
|
|
29
|
+
get complexity(): number;
|
|
30
|
+
get value(): BoxedExpression;
|
|
31
|
+
get numericValue(): BoxedExpression;
|
|
30
32
|
get machineValue(): number | null;
|
|
31
33
|
get decimalValue(): Decimal | null;
|
|
32
34
|
get complexValue(): Complex | null;
|
|
@@ -34,7 +36,7 @@ export declare class BoxedNumber extends AbstractBoxedExpression {
|
|
|
34
36
|
get asFloat(): number | null;
|
|
35
37
|
get asSmallInteger(): number | null;
|
|
36
38
|
get asRational(): [number, number] | [null, null];
|
|
37
|
-
get domain():
|
|
39
|
+
get domain(): BoxedDomain;
|
|
38
40
|
get json(): Expression;
|
|
39
41
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
40
42
|
isSame(rhs: BoxedExpression): boolean;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
|
-
import { BoxedExpression,
|
|
3
|
+
import { BoxedExpression, BoxedSubstitution, BoxedDomain, IComputeEngine, LatexString, Metadata, Pattern, PatternMatchOption, SemiBoxedExpression, Substitution } from '../public';
|
|
4
4
|
export declare class BoxedPattern extends AbstractBoxedExpression implements Pattern {
|
|
5
5
|
_pattern: BoxedExpression;
|
|
6
6
|
_canonicalPattern: BoxedExpression | undefined;
|
|
7
7
|
constructor(ce: IComputeEngine, pattern: LatexString | SemiBoxedExpression, metadata?: Metadata);
|
|
8
8
|
get hash(): number;
|
|
9
|
-
|
|
9
|
+
unbind(): void;
|
|
10
10
|
get json(): Expression;
|
|
11
11
|
get head(): string | BoxedExpression;
|
|
12
|
-
get
|
|
12
|
+
get domain(): BoxedDomain;
|
|
13
13
|
get isCanonical(): boolean;
|
|
14
14
|
set isCanonical(_val: boolean);
|
|
15
15
|
isSame(rhs: BoxedExpression): boolean;
|
|
16
16
|
isEqual(rhs: BoxedExpression): boolean;
|
|
17
|
-
match(expr: BoxedExpression, options?: PatternMatchOption):
|
|
17
|
+
match(expr: BoxedExpression, options?: PatternMatchOption): BoxedSubstitution | null;
|
|
18
18
|
test(expr: BoxedExpression, options?: PatternMatchOption): boolean;
|
|
19
19
|
count(exprs: Iterable<BoxedExpression>, options?: PatternMatchOption): number;
|
|
20
20
|
subs(sub: Substitution): BoxedPattern;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
|
-
import { BoxedExpression,
|
|
3
|
+
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, PatternMatchOption, Substitution } from '../public';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedString
|
|
6
6
|
*/
|
|
@@ -14,7 +14,7 @@ export declare class BoxedString extends AbstractBoxedExpression {
|
|
|
14
14
|
get isLiteral(): boolean;
|
|
15
15
|
get isCanonical(): boolean;
|
|
16
16
|
set isCanonical(_va: boolean);
|
|
17
|
-
get domain():
|
|
17
|
+
get domain(): BoxedDomain;
|
|
18
18
|
get complexity(): number;
|
|
19
19
|
get string(): string;
|
|
20
20
|
isEqual(rhs: BoxedExpression): boolean;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
export declare function domainToFlags(dom:
|
|
1
|
+
/* 0.8.0 */
|
|
2
|
+
export declare function domainToFlags(dom: BoxedDomain | undefined | null): Partial<SymbolFlags>;
|
|
3
3
|
export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition {
|
|
4
|
-
private _engine;
|
|
5
|
-
private _value;
|
|
6
4
|
readonly name: string;
|
|
5
|
+
private _def;
|
|
6
|
+
private _value;
|
|
7
|
+
private _domain;
|
|
8
|
+
private _inferedDomain;
|
|
9
|
+
private _engine;
|
|
10
|
+
readonly scope: RuntimeScope | undefined;
|
|
7
11
|
wikidata?: string;
|
|
8
12
|
description?: string | string[];
|
|
9
|
-
readonly scope: RuntimeScope | undefined;
|
|
10
|
-
private _domain;
|
|
11
13
|
private _number;
|
|
12
14
|
private _integer;
|
|
13
15
|
private _rational;
|
|
@@ -36,15 +38,16 @@ export declare class BoxedSymbolDefinitionImpl implements BoxedSymbolDefinition
|
|
|
36
38
|
at?: (index: string | number) => undefined | BoxedExpression;
|
|
37
39
|
readonly constant: boolean;
|
|
38
40
|
readonly hold: boolean;
|
|
39
|
-
private _def;
|
|
40
41
|
prototype?: BoxedFunctionDefinition;
|
|
41
42
|
self?: unknown;
|
|
42
43
|
constructor(ce: IComputeEngine, def: SymbolDefinition);
|
|
43
|
-
|
|
44
|
+
reset(): void;
|
|
45
|
+
unbind(): void;
|
|
46
|
+
bind(): void;
|
|
44
47
|
get value(): BoxedExpression | undefined;
|
|
45
48
|
set value(val: BoxedExpression | number | undefined);
|
|
46
|
-
get domain():
|
|
47
|
-
set domain(domain:
|
|
49
|
+
get domain(): BoxedDomain | undefined;
|
|
50
|
+
set domain(domain: BoxedDomain | DomainExpression | undefined);
|
|
48
51
|
updateFlags(flags: Partial<SymbolFlags>): void;
|
|
49
52
|
setProps(props: Omit<Partial<BoxedSymbolDefinition>, 'domain' | 'value'>): void;
|
|
50
53
|
get number(): boolean | undefined;
|
|
@@ -1,38 +1,52 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
2
|
import { AbstractBoxedExpression } from './abstract-boxed-expression';
|
|
3
|
-
import { BoxedExpression, BoxedRuleSet, BoxedSymbolDefinition, IComputeEngine, EvaluateOptions, NOptions, ReplaceOptions, SimplifyOptions, Substitution, Metadata, PatternMatchOption,
|
|
3
|
+
import { BoxedExpression, BoxedRuleSet, BoxedSymbolDefinition, IComputeEngine, EvaluateOptions, NOptions, ReplaceOptions, SimplifyOptions, Substitution, Metadata, PatternMatchOption, BoxedDomain, RuntimeScope, BoxedFunctionDefinition, BoxedBaseDefinition } from '../public';
|
|
4
4
|
/**
|
|
5
5
|
* BoxedSymbol
|
|
6
6
|
*
|
|
7
|
-
* A boxed symbol is a reference to a BoxedSymbolDefinition
|
|
8
|
-
*
|
|
7
|
+
* A boxed symbol is a reference to a `BoxedSymbolDefinition` or a
|
|
8
|
+
* `BoxedFunctionDefinition`.
|
|
9
|
+
*
|
|
10
|
+
* If a `BoxedSymbolDefinition`, it "owns" all the information
|
|
9
11
|
* about the symbol, its value, domain and various attributes.
|
|
12
|
+
*
|
|
13
|
+
* If a `BoxedFunctionDefinition`, it it a reference to a function name,
|
|
14
|
+
* not a function expression, i.e. `Sin`, not `["Sin", "Pi"]`. This is used
|
|
15
|
+
* for example in `["InverseFunction", "Sin"]`
|
|
10
16
|
*/
|
|
11
17
|
export declare class BoxedSymbol extends AbstractBoxedExpression {
|
|
18
|
+
private _scope;
|
|
12
19
|
protected _name: string;
|
|
13
20
|
private _hash;
|
|
14
21
|
private _def;
|
|
15
22
|
constructor(ce: IComputeEngine, name: string, metadata?: Metadata);
|
|
16
23
|
get hash(): number;
|
|
17
|
-
|
|
24
|
+
unbind(): undefined;
|
|
18
25
|
get isPure(): boolean;
|
|
26
|
+
/** A free variable either has no definition, or it has a definition, but no value */
|
|
27
|
+
get isFree(): boolean;
|
|
28
|
+
get isConstant(): boolean;
|
|
19
29
|
get isCanonical(): boolean;
|
|
20
30
|
set isCanonical(_va: boolean);
|
|
21
|
-
get
|
|
22
|
-
get
|
|
23
|
-
get
|
|
31
|
+
get canonical(): BoxedExpression;
|
|
32
|
+
get wikidata(): string | undefined;
|
|
33
|
+
get description(): string[] | undefined;
|
|
34
|
+
get url(): string | undefined;
|
|
24
35
|
get complexity(): number;
|
|
25
36
|
get head(): string;
|
|
26
37
|
get symbol(): string;
|
|
27
|
-
get
|
|
38
|
+
get isNothing(): boolean;
|
|
28
39
|
get isLiteral(): boolean;
|
|
40
|
+
get baseDefinition(): BoxedBaseDefinition | undefined;
|
|
29
41
|
get symbolDefinition(): BoxedSymbolDefinition | undefined;
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
get functionDefinition(): BoxedFunctionDefinition | undefined;
|
|
43
|
+
bind(scope: RuntimeScope | null): void;
|
|
44
|
+
get value(): BoxedExpression;
|
|
32
45
|
set value(value: BoxedExpression | number | undefined);
|
|
33
46
|
get numericValue(): BoxedExpression | undefined;
|
|
34
|
-
get domain():
|
|
35
|
-
set domain(d:
|
|
47
|
+
get domain(): BoxedDomain;
|
|
48
|
+
set domain(d: BoxedDomain);
|
|
49
|
+
get explicitDomain(): BoxedDomain | undefined;
|
|
36
50
|
get json(): Expression;
|
|
37
51
|
get sgn(): -1 | 0 | 1 | undefined | null;
|
|
38
52
|
has(x: string | string[]): boolean;
|
|
@@ -43,6 +57,7 @@ export declare class BoxedSymbol extends AbstractBoxedExpression {
|
|
|
43
57
|
isLessEqual(rhs: BoxedExpression): boolean | undefined;
|
|
44
58
|
isGreater(rhs: BoxedExpression): boolean | undefined;
|
|
45
59
|
isGreaterEqual(rhs: BoxedExpression): boolean | undefined;
|
|
60
|
+
get isFunction(): boolean | undefined;
|
|
46
61
|
get isZero(): boolean | undefined;
|
|
47
62
|
get isNotZero(): boolean | undefined;
|
|
48
63
|
get isOne(): boolean | undefined;
|
|
@@ -65,7 +80,6 @@ export declare class BoxedSymbol extends AbstractBoxedExpression {
|
|
|
65
80
|
get isExtendedReal(): boolean | undefined;
|
|
66
81
|
get isComplex(): boolean | undefined;
|
|
67
82
|
get isImaginary(): boolean | undefined;
|
|
68
|
-
get canonical(): BoxedExpression;
|
|
69
83
|
simplify(options?: SimplifyOptions): BoxedExpression;
|
|
70
84
|
evaluate(options?: EvaluateOptions): BoxedExpression;
|
|
71
85
|
N(options?: NOptions): BoxedExpression;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.8.0 */
|
|
2
|
+
import { Expression } from '../../math-json/math-json-format';
|
|
3
|
+
import { BoxedExpression, IComputeEngine } from '../public';
|
|
2
4
|
export declare function isLatexString(s: unknown): s is string;
|
|
3
5
|
export declare function latexString(s: unknown): string | null;
|
|
4
6
|
/**
|
|
@@ -9,20 +11,22 @@ export declare function latexString(s: unknown): string | null;
|
|
|
9
11
|
* - ['Multiply', 5, 'ImaginaryUnit']
|
|
10
12
|
* - ['Multiply', 'ImaginaryUnit', 5]
|
|
11
13
|
*/
|
|
12
|
-
export declare function getImaginaryCoef(expr: BoxedExpression): number;
|
|
14
|
+
export declare function getImaginaryCoef(expr: BoxedExpression): number | null;
|
|
13
15
|
/**
|
|
14
16
|
* Return the free symbols in the expression, recursively.
|
|
15
|
-
* A variable, or free symbol,is a symbol that is not bound to a value.
|
|
17
|
+
* A variable, or free symbol, is a symbol that is not bound to a value.
|
|
16
18
|
*/
|
|
17
19
|
export declare function getVars(expr: BoxedExpression): string[];
|
|
20
|
+
export declare function getSymbols(expr: BoxedExpression, set: Set<string>): Set<string>;
|
|
21
|
+
export declare function getSubexpressions(expr: BoxedExpression, head: string): BoxedExpression[];
|
|
18
22
|
/**
|
|
19
23
|
* For any numeric result, or when boxing numbers,
|
|
20
|
-
* if `
|
|
21
|
-
* if `
|
|
24
|
+
* if `preferDecimal` is true, create them as Decimal number
|
|
25
|
+
* if `preferDecimal` is false, create them as machine number
|
|
22
26
|
*/
|
|
23
|
-
export declare function
|
|
24
|
-
/**
|
|
25
|
-
* return `NaN` if `
|
|
27
|
+
export declare function preferDecimal(ce: IComputeEngine): boolean;
|
|
28
|
+
/** When result of a numeric evaluation is a complex number,
|
|
29
|
+
* return `NaN` if not `complexallowed()`
|
|
26
30
|
*/
|
|
27
31
|
export declare function complexAllowed(ce: IComputeEngine): boolean;
|
|
28
32
|
/**
|
|
@@ -35,3 +39,16 @@ export declare function complexAllowed(ce: IComputeEngine): boolean;
|
|
|
35
39
|
*/
|
|
36
40
|
export declare function asCanonical(expr: BoxedExpression): BoxedExpression;
|
|
37
41
|
export declare function hashCode(s: string): number;
|
|
42
|
+
export declare function isDictionaryLike(expr: BoxedExpression): boolean;
|
|
43
|
+
export declare function getDictionaryLike(expr: BoxedExpression): {
|
|
44
|
+
[key: string]: BoxedExpression;
|
|
45
|
+
};
|
|
46
|
+
export declare function isListLike(expr: BoxedExpression): boolean;
|
|
47
|
+
export declare function getListLike(expr: BoxedExpression): BoxedExpression[];
|
|
48
|
+
/**
|
|
49
|
+
* If `expr` is a number, return it as a Decimal (it might be
|
|
50
|
+
* in the machine value range or not). Use `isInMachineRange()` to check.
|
|
51
|
+
*
|
|
52
|
+
* Use this instead of `machineValue()` when possible, as `machineValue` will truncate decimal numbers to machine numbers
|
|
53
|
+
*/
|
|
54
|
+
export declare function decimalValue(ce: IComputeEngine, expr: Expression | null | undefined): Decimal | null;
|