@cortex-js/compute-engine 0.5.0 → 0.7.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 +16900 -13123
- package/dist/compute-engine.min.esm.js +2 -2
- package/dist/compute-engine.min.js +2 -2
- package/dist/math-json.esm.js +90 -36
- 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 +23 -10
- package/dist/types/compute-engine/boxed-expression/box.d.ts +4 -18
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +49 -6
- 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 +14 -11
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -3
- 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 +10 -7
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +24 -10
- 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 +73 -47
- 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 -8
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +89 -63
- package/dist/types/compute-engine/latex-syntax/public.d.ts +85 -67
- 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 +265 -219
- 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 +3 -2
- package/dist/types/math-json/math-json-format.d.ts +27 -23
- package/dist/types/math-json/utils.d.ts +23 -18
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +21 -22
- 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,24 +1,35 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import { ParseLatexOptions, LatexToken, NumberFormattingOptions, Delimiter, Terminator, Parser } from './public';
|
|
1
|
+
/* 0.7.0 */
|
|
3
2
|
import { IndexedLatexDictionary, InfixEntry, PostfixEntry, PrefixEntry, SymbolEntry } from './dictionary/definitions';
|
|
4
|
-
import { WarningSignalHandler } from '../../common/signals';
|
|
5
3
|
import { IComputeEngine } from '../public';
|
|
4
|
+
import { Expression } from '../../math-json/math-json-format';
|
|
6
5
|
export declare const DEFAULT_LATEX_NUMBER_OPTIONS: NumberFormattingOptions;
|
|
7
6
|
export declare const DEFAULT_PARSE_LATEX_OPTIONS: ParseLatexOptions;
|
|
8
7
|
export declare class _Parser implements Parser {
|
|
9
|
-
readonly
|
|
8
|
+
readonly computeEngine: IComputeEngine;
|
|
10
9
|
readonly options: NumberFormattingOptions & ParseLatexOptions;
|
|
11
|
-
readonly engine: IComputeEngine;
|
|
12
|
-
readonly _dictionary: IndexedLatexDictionary;
|
|
13
10
|
index: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
private readonly _tokens;
|
|
12
|
+
private _positiveInfinityTokens;
|
|
13
|
+
private _negativeInfinityTokens;
|
|
14
|
+
private _notANumberTokens;
|
|
15
|
+
private _decimalMarkerTokens;
|
|
16
|
+
private _groupSeparatorTokens;
|
|
17
|
+
private _exponentProductTokens;
|
|
18
|
+
private _beginExponentMarkerTokens;
|
|
19
|
+
private _endExponentMarkerTokens;
|
|
20
|
+
private _truncationMarkerTokens;
|
|
21
|
+
private _beginRepeatingDigitsTokens;
|
|
22
|
+
private _endRepeatingDigitsTokens;
|
|
23
|
+
private _imaginaryNumberTokens;
|
|
24
|
+
private readonly _dictionary;
|
|
25
|
+
private _boundaries;
|
|
26
|
+
private _lastPeek;
|
|
27
|
+
private _peekCounter;
|
|
28
|
+
constructor(tokens: LatexToken[], options: NumberFormattingOptions & ParseLatexOptions, dictionary: IndexedLatexDictionary, computeEngine: IComputeEngine);
|
|
18
29
|
updateOptions(opt: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions>): void;
|
|
19
|
-
clone(start: number, end: number): Parser;
|
|
20
30
|
get atEnd(): boolean;
|
|
21
31
|
get peek(): LatexToken;
|
|
32
|
+
next(): LatexToken;
|
|
22
33
|
/**
|
|
23
34
|
* Return true if
|
|
24
35
|
* - at end of the token stream
|
|
@@ -27,12 +38,18 @@ export declare class _Parser implements Parser {
|
|
|
27
38
|
* Note: the `minPrec` condition is not checked. It should be checked separately.
|
|
28
39
|
*/
|
|
29
40
|
atTerminator(t?: Terminator): boolean;
|
|
41
|
+
/** True if the current token matches any of the boundaries we are waiting for */
|
|
42
|
+
get atBoundary(): boolean;
|
|
43
|
+
addBoundary(boundary: LatexToken[]): void;
|
|
44
|
+
removeBoundary(): void;
|
|
45
|
+
matchBoundary(): boolean;
|
|
46
|
+
boundaryError(msg: string | [string, ...Expression[]]): Expression;
|
|
30
47
|
latex(start: number, end?: number): string;
|
|
31
48
|
latexAhead(n: number): string;
|
|
32
49
|
latexBefore(): string;
|
|
33
50
|
latexAfter(): string;
|
|
34
51
|
/**
|
|
35
|
-
* Return at most `lookahead` strings made from the tokens
|
|
52
|
+
* Return at most `this._dictionary.lookahead` strings made from the tokens
|
|
36
53
|
* ahead.
|
|
37
54
|
*
|
|
38
55
|
* The index in the returned array correspond to the number of tokens.
|
|
@@ -44,13 +61,16 @@ export declare class _Parser implements Parser {
|
|
|
44
61
|
*/
|
|
45
62
|
lookAhead(): string[];
|
|
46
63
|
/** Return all the definitions that potentially match the tokens ahead */
|
|
64
|
+
peekDefinitions(kind: 'function'): [FunctionEntry, number][] | null;
|
|
47
65
|
peekDefinitions(kind: 'symbol'): [SymbolEntry, number][] | null;
|
|
48
66
|
peekDefinitions(kind: 'postfix'): [PostfixEntry, number][] | null;
|
|
49
|
-
peekDefinitions(kind: 'postfix'): [PostfixEntry, number][] | null;
|
|
50
|
-
peekDefinitions(kind: 'operator'): [InfixEntry | PrefixEntry | PostfixEntry, number][] | null;
|
|
51
67
|
peekDefinitions(kind: 'infix'): [InfixEntry, number][] | null;
|
|
52
68
|
peekDefinitions(kind: 'prefix'): [PrefixEntry, number][] | null;
|
|
53
|
-
|
|
69
|
+
peekDefinitions(kind: 'operator'): [InfixEntry | PrefixEntry | PostfixEntry, number][] | null;
|
|
70
|
+
skipSpaceTokens(): void;
|
|
71
|
+
/** While parsing in math mode, skip applicable spaces.
|
|
72
|
+
* Do not use to skip spaces e.g. while parsing a string. See `skipSpaceTokens()` instead.
|
|
73
|
+
*/
|
|
54
74
|
skipSpace(): boolean;
|
|
55
75
|
matchChar(): string | null;
|
|
56
76
|
matchColor(_background?: boolean): string | null;
|
|
@@ -58,11 +78,16 @@ export declare class _Parser implements Parser {
|
|
|
58
78
|
match(token: LatexToken): boolean;
|
|
59
79
|
matchAll(tokens: LatexToken | LatexToken[]): boolean;
|
|
60
80
|
matchAny(tokens: LatexToken[]): LatexToken;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
matchDecimalDigits(
|
|
64
|
-
|
|
81
|
+
matchSequence(tokens: LatexToken[]): LatexToken[];
|
|
82
|
+
matchOptionalSign(): string;
|
|
83
|
+
matchDecimalDigits(options?: {
|
|
84
|
+
withGrouping?: boolean;
|
|
85
|
+
}): string;
|
|
86
|
+
matchSignedInteger(options?: {
|
|
87
|
+
withGrouping?: boolean;
|
|
88
|
+
}): string;
|
|
65
89
|
matchExponent(): string;
|
|
90
|
+
matchRepeatingDecimal(): string;
|
|
66
91
|
matchNumber(): string;
|
|
67
92
|
/**
|
|
68
93
|
* A Latex number can be a decimal, hex or octal number.
|
|
@@ -79,12 +104,12 @@ export declare class _Parser implements Parser {
|
|
|
79
104
|
matchPrefixOperator(until?: Terminator): Expression | null;
|
|
80
105
|
matchInfixOperator(lhs: Expression, until?: Terminator): Expression | null;
|
|
81
106
|
/**
|
|
82
|
-
* '
|
|
83
|
-
* 'implicit': either an expression inside a pair of `()`, or just a
|
|
84
|
-
* (i.e. we interpret `\cos
|
|
107
|
+
* - 'enclosure' : will look for an argument inside an enclosure (open/close fence)
|
|
108
|
+
* - 'implicit': either an expression inside a pair of `()`, or just a product
|
|
109
|
+
* (i.e. we interpret `\cos 2x + 1` as `\cos(2x) + 1`)
|
|
85
110
|
*/
|
|
86
|
-
matchArguments(kind: undefined | '' | '
|
|
87
|
-
/** If matches the normalized open delimiter,
|
|
111
|
+
matchArguments(kind: undefined | '' | 'enclosure' | 'implicit'): Expression[] | null;
|
|
112
|
+
/** If matches the normalized open delimiter, return the
|
|
88
113
|
* expected closing delimiter.
|
|
89
114
|
*
|
|
90
115
|
* For example, if `delimiter` is `(`, it would match `\left\lparen` and
|
|
@@ -95,56 +120,56 @@ export declare class _Parser implements Parser {
|
|
|
95
120
|
matchOpenDelimiter(openDelim: Delimiter, closeDelim: Delimiter): LatexToken[] | null;
|
|
96
121
|
matchMiddleDelimiter(delimiter: '|' | ':' | LatexToken): boolean;
|
|
97
122
|
/**
|
|
98
|
-
* An enclosure is an opening matchfix operator, an expression,
|
|
99
|
-
* followed multiple times by a separator and another expression,
|
|
123
|
+
* An enclosure is an opening matchfix operator, an optional expression,
|
|
124
|
+
* optionally followed multiple times by a separator and another expression,
|
|
100
125
|
* and finally a closing matching operator.
|
|
101
126
|
*/
|
|
102
127
|
matchEnclosure(): Expression | null;
|
|
103
128
|
/**
|
|
104
|
-
*
|
|
105
|
-
* - a
|
|
106
|
-
* - a
|
|
107
|
-
* - a
|
|
108
|
-
* - a
|
|
109
|
-
* - a
|
|
129
|
+
* Match a single variable name. It can be:
|
|
130
|
+
* - a symbol
|
|
131
|
+
* - a simple multi-letter identifier: `\mathrm{speed}`
|
|
132
|
+
* - a complex multi-letter identifier: `\alpha_12` or `\mathit{speed\unicode{"2012}of\unicode{"2012}sound}`
|
|
133
|
+
* - a command: `\alpha` @todo
|
|
134
|
+
* - a complex name such as `\alpha_12` or `\mathit{speed\unicode{"2012}of\unicode{"2012}sound}` (see serializer.ts) @todo:
|
|
135
|
+
* @todo: matchSymbol should use matchIdentifier
|
|
110
136
|
*/
|
|
111
|
-
|
|
112
|
-
matchOptionalLatexArgument(): Expression | null;
|
|
137
|
+
matchIdentifier(): string | null;
|
|
113
138
|
/**
|
|
114
|
-
*
|
|
115
|
-
* -
|
|
116
|
-
* -
|
|
139
|
+
* A function is a function identifier followed by arguments
|
|
140
|
+
* - a function with explicit arguments `f(x)`
|
|
141
|
+
* - a function with explicit arguments `\mathrm{floor}(x)`
|
|
142
|
+
* - a function name: `\mathrm{floor}`
|
|
143
|
+
* - a function with implicit arguments: `\cos x` (via a custom parser)
|
|
117
144
|
*
|
|
118
|
-
* Return null if an argument was not found
|
|
119
|
-
* Return 'Nothing' if an empty argument `{}` was found
|
|
120
145
|
*/
|
|
121
|
-
|
|
146
|
+
matchFunction(): Expression | null;
|
|
122
147
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* - they act mostly like an infix operator, but they are commutative, i.e.
|
|
128
|
-
* `x_a^b` should be parsed identically to `x^b_a`.
|
|
129
|
-
*
|
|
130
|
-
* - furthermore, in LaTeX, consecutive `^` or `_` are treated as concatenated,
|
|
131
|
-
* that is `x^a^b` parses the same as `x^{ab}`.
|
|
132
|
-
*
|
|
148
|
+
* A symbol can be:
|
|
149
|
+
* - a single-letter variable: `x`
|
|
150
|
+
* - a single LaTeX command: `\pi`
|
|
133
151
|
*/
|
|
152
|
+
matchSymbol(): Expression | null;
|
|
153
|
+
matchOptionalLatexArgument(): Expression | null;
|
|
154
|
+
matchRequiredLatexArgument(): Expression | null;
|
|
134
155
|
matchSupsub(lhs: Expression | null): Expression | null;
|
|
135
156
|
matchPostfix(lhs: Expression | null): Expression | null;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
/** Match a string used as a LaTeX identifier, for example an environment
|
|
158
|
+
* name.
|
|
159
|
+
* Not suitable for general purpose text, e.g. argument of a `\text{}
|
|
160
|
+
* command. See `matchChar()` instead.
|
|
161
|
+
*/
|
|
162
|
+
matchString(): string;
|
|
163
|
+
/** Match a string as an argument (in a `{}` pair) */
|
|
164
|
+
matchStringArgument(): string | null;
|
|
140
165
|
/**
|
|
141
|
-
* Match an expression in a tabular format,
|
|
142
|
-
*
|
|
166
|
+
* Match an expression in a tabular format, where rows are separated by `\\`
|
|
167
|
+
* and columns by `&`.
|
|
143
168
|
*
|
|
144
|
-
* Return rows of sparse columns
|
|
145
|
-
* and empty cells are also indicated with
|
|
169
|
+
* Return rows of sparse columns: empty rows are indicated with `Nothing`,
|
|
170
|
+
* and empty cells are also indicated with `Nothing`.
|
|
146
171
|
*/
|
|
147
|
-
matchTabular(
|
|
172
|
+
matchTabular(): null | Expression[][];
|
|
148
173
|
matchEnvironment(): Expression | null;
|
|
149
174
|
/**
|
|
150
175
|
* Apply an invisible operator between two expressions.
|
|
@@ -167,8 +192,8 @@ export declare class _Parser implements Parser {
|
|
|
167
192
|
* - x2 -> no
|
|
168
193
|
* => lhs is a number, rhs is a number, but not a literal
|
|
169
194
|
*/
|
|
170
|
-
applyInvisibleOperator(terminator: Terminator,
|
|
171
|
-
|
|
195
|
+
applyInvisibleOperator(terminator: Terminator, lhs: Expression | null): Expression | null;
|
|
196
|
+
matchUnexpectedLatexCommand(): Expression | null;
|
|
172
197
|
/**
|
|
173
198
|
* <primary> :=
|
|
174
199
|
* (<number> | <symbol> | <environment> | <matchfix-expr>) <subsup>* <postfix-operator>*
|
|
@@ -188,11 +213,12 @@ export declare class _Parser implements Parser {
|
|
|
188
213
|
* | <prefix-op> <primary>
|
|
189
214
|
* | <primary> <infix-op> <expression>
|
|
190
215
|
*
|
|
191
|
-
* Stop when an operator of precedence less than `minPrec` is encountered
|
|
216
|
+
* Stop when an operator of precedence less than `until.minPrec` is encountered
|
|
192
217
|
*/
|
|
193
218
|
matchExpression(until?: Partial<Terminator>): Expression | null;
|
|
194
219
|
/**
|
|
195
|
-
* Add
|
|
220
|
+
* Add LaTeX or other requested metadata to the expression
|
|
196
221
|
*/
|
|
197
222
|
decorate(expr: Expression | null, start: number): Expression | null;
|
|
223
|
+
error(code: string | [string, ...Expression[]], fromToken: number): Expression;
|
|
198
224
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import type { IComputeEngine } from '../public';
|
|
4
4
|
/**
|
|
@@ -18,17 +18,15 @@ export declare type LatexString = string;
|
|
|
18
18
|
* record to define new LaTeX dictionary entries.
|
|
19
19
|
*/
|
|
20
20
|
export declare type Delimiter = ')' | '(' | ']' | '[' | '{' /** \lbrace */ | '}' /** \rbrace */ | '<' /** \langle */ | '>' /** \rangle */ | '|' | '||' | '\\lceil' | '\\rceil' | '\\lfloor' | '\\rfloor';
|
|
21
|
-
export declare type
|
|
21
|
+
export declare type LibraryCategory = 'algebra' | 'arithmetic' | 'calculus' | 'collections' | 'control-structures' | 'combinatorics' | 'core' | 'dimensions' | 'domains' | 'linear-algebra' | 'logic' | 'numeric' | 'other' | 'physics' | 'polynomials' | 'relop' | 'sets' | 'statistics' | 'styling' | 'symbols' | 'trigonometry' | 'units';
|
|
22
22
|
/**
|
|
23
23
|
* This indicates a condition under which parsing should stop:
|
|
24
|
-
* - a specific string of tokens has been encountered
|
|
25
24
|
* - an operator of a precedence higher than specified has been encountered
|
|
26
25
|
* - the last token has been reached
|
|
27
26
|
* - or if a function is provided, the function returns true;
|
|
28
27
|
*/
|
|
29
28
|
export declare type Terminator = {
|
|
30
29
|
minPrec: number;
|
|
31
|
-
tokens?: LatexToken[];
|
|
32
30
|
condition?: (parser: Parser) => boolean;
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
@@ -54,11 +52,13 @@ export declare type Terminator = {
|
|
|
54
52
|
*/
|
|
55
53
|
export declare type EnvironmentParseHandler = (parser: Parser, reqArgs: Expression[], optArgs: Expression[]) => Expression | null;
|
|
56
54
|
export declare type SymbolParseHandler = (parser: Parser) => Expression | null;
|
|
55
|
+
export declare type FunctionParseHandler = (parser: Parser) => Expression | null;
|
|
57
56
|
export declare type PostfixParseHandler = (parser: Parser, lhs: Expression) => Expression | null;
|
|
58
57
|
export declare type PrefixParseHandler = (parser: Parser, until: Terminator) => Expression | null;
|
|
59
58
|
export declare type InfixParseHandler = (parser: Parser, until: Terminator, lhs: Expression) => Expression | null;
|
|
60
59
|
export declare type MatchfixParseHandler = (parser: Parser, body: Expression) => Expression | null;
|
|
61
|
-
export declare type ParseHandler = SymbolParseHandler | EnvironmentParseHandler | PostfixParseHandler | PrefixParseHandler | InfixParseHandler | MatchfixParseHandler;
|
|
60
|
+
export declare type ParseHandler = SymbolParseHandler | FunctionParseHandler | EnvironmentParseHandler | PostfixParseHandler | PrefixParseHandler | InfixParseHandler | MatchfixParseHandler;
|
|
61
|
+
export declare type LatexArgumentType = '{expression}' /** A required math mode expression */ | '[expression]' /** An optional math mode expression */ | '{text}' /** A required expression in text mode */ | '[text]' /** An optional expression in text mode */ | '{unit}' /** A required unit expression, e.g. `3em` */ | '[unit]' /** An optional unit expression, e.g. `3em` */ | '{glue}' /** A required glue expression, e.g. `25 mu plus 3em ` */ | '[glue]' /** An optional glue expression, e.g. `25 mu plus 3em ` */ | '{string}' /** A required text string, terminated by a non-literal token */ | '[string]' /** An optional text string, terminated by a non-literal token */ | '{color}' /** A required color expression, e.g. `red` or `#00ff00` */ | '[color]'; /** An optional color expression, e.g. `red` or `#00ff00` */
|
|
62
62
|
/**
|
|
63
63
|
* Maps a string of LaTeX tokens to a function or symbol and vice-versa.
|
|
64
64
|
*
|
|
@@ -163,8 +163,13 @@ export declare type SymbolEntry = BaseEntry & {
|
|
|
163
163
|
kind: 'symbol';
|
|
164
164
|
/** Used for appropriate wrapping (i.e. when to surround it with parens) */
|
|
165
165
|
precedence?: number;
|
|
166
|
+
parse: Expression | SymbolParseHandler;
|
|
167
|
+
};
|
|
168
|
+
export declare type FunctionEntry = BaseEntry & {
|
|
169
|
+
kind: 'function';
|
|
166
170
|
/**
|
|
167
171
|
* Indicate if this symbol can be followed by arguments.
|
|
172
|
+
*
|
|
168
173
|
* The presence of arguments will indicate that the arguments should be
|
|
169
174
|
* applied to the symbol. Otherwise, the invisible operator is applied
|
|
170
175
|
* to the symbol and the arguments.
|
|
@@ -172,14 +177,14 @@ export declare type SymbolEntry = BaseEntry & {
|
|
|
172
177
|
* If `arguments` is `"group"`:
|
|
173
178
|
*
|
|
174
179
|
* "f(x)" -> `["f", "x"]`
|
|
175
|
-
* "f x" -> `["
|
|
180
|
+
* "f x" -> `["Multiply", "f", "x"]`
|
|
176
181
|
*
|
|
177
182
|
* If `arguments` is `""`:
|
|
178
183
|
*
|
|
179
|
-
* "f(x)" -> `["
|
|
180
|
-
* "f x" -> `["
|
|
184
|
+
* "f(x)" -> `["Multiply", "f", "x"]`
|
|
185
|
+
* "f x" -> `["Multiply", "f", "x"]`
|
|
181
186
|
*
|
|
182
|
-
* If `arguments` is `"
|
|
187
|
+
* If `arguments` is `"implicit"` and the symbol is followed either
|
|
183
188
|
* by a group or by a primary (prefix + symbol + subsupfix + postfix).
|
|
184
189
|
* Used for trig functions. i.e. `\sin x` vs `\sin(x)`:
|
|
185
190
|
*
|
|
@@ -187,45 +192,21 @@ export declare type SymbolEntry = BaseEntry & {
|
|
|
187
192
|
* "f x" -> `["f", "x"]`
|
|
188
193
|
*
|
|
189
194
|
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Applicable when `kind` is `"symbol"`.
|
|
193
|
-
*
|
|
194
|
-
* If a LaTeX command (i.e. the trigger starts with `\`, e.g. `\sqrt`)
|
|
195
|
-
* indicates the number of optional arguments expected (indicate with
|
|
196
|
-
* square brackets).
|
|
197
|
-
*
|
|
198
|
-
* For example, for the `\sqrt` command, 1: `\sqrt[3]{x}`
|
|
199
|
-
*
|
|
200
|
-
*/
|
|
201
|
-
optionalLatexArg?: number;
|
|
202
|
-
/**
|
|
203
|
-
* Applicable when `kind` is `"symbol"`.
|
|
204
|
-
*
|
|
205
|
-
* If a LaTeX command (i.e. the trigger starts with `\`, e.g. `\frac`)
|
|
206
|
-
* indicates the number of required arguments expected (indicated with
|
|
207
|
-
* curly braces).
|
|
208
|
-
*
|
|
209
|
-
* For example, for the `\frac` command, 2: `\frac{1}{n}`
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
requiredLatexArg?: number;
|
|
213
|
-
parse: Expression | SymbolParseHandler;
|
|
195
|
+
parse: Expression | FunctionParseHandler;
|
|
214
196
|
};
|
|
215
197
|
/**
|
|
216
198
|
* A simple LaTeX dictionary entry, for example for a command like `\pi`.
|
|
217
199
|
*/
|
|
218
200
|
export declare type DefaultEntry = BaseEntry & {
|
|
219
201
|
precedence?: number;
|
|
220
|
-
arguments?: 'group' | 'implicit' | '';
|
|
221
|
-
optionalLatexArg?: number;
|
|
222
|
-
requiredLatexArg?: number;
|
|
223
202
|
parse?: Expression | SymbolParseHandler;
|
|
224
203
|
};
|
|
225
|
-
export declare type LatexDictionaryEntry = DefaultEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | EnvironmentEntry;
|
|
204
|
+
export declare type LatexDictionaryEntry = DefaultEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | FunctionEntry | EnvironmentEntry;
|
|
226
205
|
/** @internal */
|
|
227
206
|
export declare function isSymbolEntry(entry: LatexDictionaryEntry): entry is SymbolEntry;
|
|
228
207
|
/** @internal */
|
|
208
|
+
export declare function isFunctionEntry(entry: LatexDictionaryEntry): entry is FunctionEntry;
|
|
209
|
+
/** @internal */
|
|
229
210
|
export declare function isMatchfixEntry(entry: LatexDictionaryEntry): entry is MatchfixEntry;
|
|
230
211
|
/** @internal */
|
|
231
212
|
export declare function isInfixEntry(entry: LatexDictionaryEntry): entry is InfixEntry;
|
|
@@ -257,7 +238,7 @@ export declare type ParseLatexOptions = {
|
|
|
257
238
|
/**
|
|
258
239
|
* If true, ignore space characters.
|
|
259
240
|
*
|
|
260
|
-
* Default
|
|
241
|
+
* **Default**: `true`
|
|
261
242
|
*
|
|
262
243
|
*/
|
|
263
244
|
skipSpace: boolean;
|
|
@@ -276,26 +257,26 @@ export declare type ParseLatexOptions = {
|
|
|
276
257
|
* Otherwise, return each token making up the number (minus sign, digits,
|
|
277
258
|
* decimal separator, etc...).
|
|
278
259
|
*
|
|
279
|
-
* Default
|
|
260
|
+
* **Default**: `true`
|
|
280
261
|
*/
|
|
281
262
|
parseNumbers: boolean;
|
|
282
263
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
264
|
+
* This handler is invoked when the parser encounter a set of tokens
|
|
265
|
+
* at a position that could be a symbol or function.
|
|
266
|
+
*
|
|
267
|
+
* The `symbol` argument is one or more tokens.
|
|
286
268
|
*
|
|
287
|
-
*
|
|
288
|
-
* or function, respectively.
|
|
269
|
+
* The handler can return:
|
|
289
270
|
*
|
|
290
|
-
*
|
|
291
|
-
* (typically, parentheses), parse them as arguments to the function.
|
|
271
|
+
* - `symbol` to indicate the string represent a constant or variable.
|
|
292
272
|
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
273
|
+
* - `function` to indicate the string is a function name. If an apply
|
|
274
|
+
* function operator (typically, parentheses) follow, parse them as arguments
|
|
275
|
+
* to the function.
|
|
295
276
|
*
|
|
296
|
-
*
|
|
277
|
+
* - `error`, an error condition is raised.
|
|
297
278
|
*/
|
|
298
|
-
|
|
279
|
+
parseUnknownSymbol: (symbol: string, parser: Parser) => 'symbol' | 'function' | 'unknown';
|
|
299
280
|
/**
|
|
300
281
|
* If true, the expression will be decorated with the LaTeX
|
|
301
282
|
* fragments corresponding to each elements of the expression.
|
|
@@ -305,6 +286,8 @@ export declare type ParseLatexOptions = {
|
|
|
305
286
|
* may contain a slightly different LaTeX, for example with consecutive spaces
|
|
306
287
|
* replaced by one, with comments removed and with some low-level LaTeX
|
|
307
288
|
* commands replaced, for example `\egroup` and `\bgroup`.
|
|
289
|
+
*
|
|
290
|
+
* **Default:** `false`
|
|
308
291
|
*/
|
|
309
292
|
preserveLatex: boolean;
|
|
310
293
|
};
|
|
@@ -333,8 +316,8 @@ export declare type SerializeLatexOptions = {
|
|
|
333
316
|
*/
|
|
334
317
|
multiply: LatexString;
|
|
335
318
|
/**
|
|
336
|
-
* When an expression contains the
|
|
337
|
-
* with this LaTeX string
|
|
319
|
+
* When an expression contains the error expression `["Error", 'missing']`,
|
|
320
|
+
* serialize it with this LaTeX string
|
|
338
321
|
*/
|
|
339
322
|
missingSymbol: LatexString;
|
|
340
323
|
applyFunctionStyle: (expr: Expression, level: number) => 'paren' | 'leftright' | 'big' | 'none';
|
|
@@ -356,10 +339,10 @@ export declare type NumberFormattingOptions = {
|
|
|
356
339
|
* the '.' in '3.1415'.
|
|
357
340
|
*
|
|
358
341
|
* Some countries use a comma rather than a dot. In this case it is
|
|
359
|
-
* recommended to use `"{,}"` as the marker: the surrounding
|
|
342
|
+
* recommended to use `"{,}"` as the marker: the surrounding brackets ensure
|
|
360
343
|
* there is no additional gap after the comma.
|
|
361
344
|
*
|
|
362
|
-
* Default
|
|
345
|
+
* **Default**: `"."`
|
|
363
346
|
*/
|
|
364
347
|
decimalMarker: LatexString;
|
|
365
348
|
/**
|
|
@@ -368,10 +351,10 @@ export declare type NumberFormattingOptions = {
|
|
|
368
351
|
*
|
|
369
352
|
* If you change it to another value, be aware that this may lead to
|
|
370
353
|
* unexpected results. For example, if changing it to `,` the expression
|
|
371
|
-
*
|
|
372
|
-
*
|
|
354
|
+
* `\mathrm{Hypot}(1,2)` will parse as `["Hypot", 1.2]` rather than
|
|
355
|
+
* `["Hypot", 1, 2]`.
|
|
373
356
|
*
|
|
374
|
-
* Default
|
|
357
|
+
* **Default**: `"\\,"` (thin space, 3/18mu) (Resolution 7 of the 1948 CGPM)
|
|
375
358
|
*/
|
|
376
359
|
groupSeparator: LatexString;
|
|
377
360
|
exponentProduct: LatexString;
|
|
@@ -419,7 +402,7 @@ export declare class LatexSyntax {
|
|
|
419
402
|
* Use the value returned by this function to the `options` argument of the
|
|
420
403
|
* constructor.
|
|
421
404
|
*/
|
|
422
|
-
static getDictionary(domain?:
|
|
405
|
+
static getDictionary(domain?: LibraryCategory | 'all'): Readonly<LatexDictionary>;
|
|
423
406
|
parse(latex: LatexString): Expression;
|
|
424
407
|
serialize(expr: Expression): LatexString;
|
|
425
408
|
}
|
|
@@ -439,7 +422,11 @@ export interface Serializer {
|
|
|
439
422
|
level: number;
|
|
440
423
|
/** Output a LaTeX string representing the expression */
|
|
441
424
|
serialize: (expr: Expression | null) => string;
|
|
442
|
-
wrapString(s: string, style: 'paren' | 'leftright' | 'big' | 'none'): string;
|
|
425
|
+
wrapString(s: string, style: 'paren' | 'leftright' | 'big' | 'none', fence?: string): string;
|
|
426
|
+
/** A string with the arguments of expr fenced appropriately and separated by
|
|
427
|
+
* commas.
|
|
428
|
+
*/
|
|
429
|
+
wrapArguments(expr: Expression): string;
|
|
443
430
|
/** Add a group fence around the expression if it is
|
|
444
431
|
* an operator of precedence less than or equal to `prec`.
|
|
445
432
|
*/
|
|
@@ -459,7 +446,6 @@ export interface Serializer {
|
|
|
459
446
|
}
|
|
460
447
|
export declare type SerializeHandler = (serializer: Serializer, expr: Expression) => string;
|
|
461
448
|
export interface Parser {
|
|
462
|
-
readonly onError: WarningSignalHandler;
|
|
463
449
|
readonly options: Required<ParseLatexOptions>;
|
|
464
450
|
readonly computeEngine?: IComputeEngine;
|
|
465
451
|
index: number;
|
|
@@ -481,6 +467,10 @@ export interface Parser {
|
|
|
481
467
|
latexAfter(): string;
|
|
482
468
|
/** If there are any space, advance the index until a non-space is encountered */
|
|
483
469
|
skipSpace(): boolean;
|
|
470
|
+
addBoundary(boundary: LatexToken[]): void;
|
|
471
|
+
removeBoundary(): void;
|
|
472
|
+
matchBoundary(): boolean;
|
|
473
|
+
boundaryError(msg: string | [string, ...Expression[]]): Expression;
|
|
484
474
|
/** If the next token is a character, return it and advance the index
|
|
485
475
|
* This includes plain characters (e.g. 'a', '+'...), characters
|
|
486
476
|
* defined in hex (^^ and ^^^^), the `\char` and `\unicode` command.
|
|
@@ -500,31 +490,40 @@ export interface Parser {
|
|
|
500
490
|
match(tokens: LatexToken): boolean;
|
|
501
491
|
matchAll(tokens: LatexToken | LatexToken[]): boolean;
|
|
502
492
|
matchAny(tokens: LatexToken[]): LatexToken;
|
|
503
|
-
|
|
493
|
+
matchSequence(tokens: LatexToken[]): LatexToken[];
|
|
504
494
|
/** If the next token matches a `+` or `-` sign, return it and advance the index.
|
|
505
495
|
* Otherwise return `''` and do not advance */
|
|
506
|
-
|
|
496
|
+
matchOptionalSign(): string;
|
|
507
497
|
matchDecimalDigits(): string;
|
|
508
498
|
matchSignedInteger(): string;
|
|
509
499
|
matchExponent(): string;
|
|
510
500
|
matchNumber(): string;
|
|
511
501
|
/** Parse a tabular environment, until `\end{endName}`
|
|
512
502
|
*/
|
|
513
|
-
matchTabular(endName: string): null | Expression;
|
|
503
|
+
matchTabular(endName: string): null | Expression[][];
|
|
514
504
|
applyInvisibleOperator(terminator: Terminator, lhs: Expression | null): Expression | null;
|
|
515
505
|
/** If the next tokens correspond to an optional LaTeX argument,
|
|
516
506
|
* enclosed with `[` and `]` return the content of the argument
|
|
517
507
|
* as an expression and advance the index past the closing `]`.
|
|
508
|
+
*
|
|
518
509
|
* Otherwise, return `null`.
|
|
519
510
|
*/
|
|
520
511
|
matchOptionalLatexArgument(): Expression | null;
|
|
512
|
+
/**
|
|
513
|
+
* Match a required LaTeX argument:
|
|
514
|
+
* - either enclosed in `{}`
|
|
515
|
+
* - or a single token.
|
|
516
|
+
*
|
|
517
|
+
* Return null if no argument was found
|
|
518
|
+
* Return `['Sequence']` if an empty argument `{}` was found
|
|
519
|
+
*/
|
|
521
520
|
matchRequiredLatexArgument(): Expression | null;
|
|
522
521
|
/**
|
|
523
|
-
* '
|
|
524
|
-
* 'implicit': either an expression inside a pair of `()`, or just a primary
|
|
525
|
-
*
|
|
522
|
+
* - 'enclosure' : will look for an argument inside an enclosure (an open/close fence)
|
|
523
|
+
* - 'implicit': either an expression inside a pair of `()`, or just a primary
|
|
524
|
+
* (i.e. we interpret `\cos x + 1` as `\cos(x) + 1`)
|
|
526
525
|
*/
|
|
527
|
-
matchArguments(kind: '' | '
|
|
526
|
+
matchArguments(kind: '' | 'implicit' | 'enclosure'): Expression[] | null;
|
|
528
527
|
/** If matches the normalized open delimiter, returns the
|
|
529
528
|
* expected closing delimiter.
|
|
530
529
|
*
|
|
@@ -534,6 +533,17 @@ export interface Parser {
|
|
|
534
533
|
*/
|
|
535
534
|
matchOpenDelimiter(openDelim: Delimiter, closeDelim: Delimiter): LatexToken[] | null;
|
|
536
535
|
matchMiddleDelimiter(delimiter: '|' | ':' | LatexToken): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Match a sequence superfix/subfix operator, e.g. `^{*}`
|
|
538
|
+
*
|
|
539
|
+
* Superfix and subfix need special handling:
|
|
540
|
+
*
|
|
541
|
+
* - they act mostly like an infix operator, but they are commutative, i.e.
|
|
542
|
+
* `x_a^b` should be parsed identically to `x^b_a`.
|
|
543
|
+
*
|
|
544
|
+
* - furthermore, in LaTeX `x^a^b` parses the same as `x^a{}^b`.
|
|
545
|
+
*
|
|
546
|
+
*/
|
|
537
547
|
matchSupsub(lhs: Expression | null): Expression | null;
|
|
538
548
|
/**
|
|
539
549
|
*
|
|
@@ -555,6 +565,12 @@ export interface Parser {
|
|
|
555
565
|
* If not a primary, return `null` and do not advance the index.
|
|
556
566
|
*/
|
|
557
567
|
matchPrimary(): Expression | null;
|
|
568
|
+
/**
|
|
569
|
+
* A symbol can be:
|
|
570
|
+
* - a single-letter variable: `x`
|
|
571
|
+
* - a single LaTeX command: `\pi`
|
|
572
|
+
*/
|
|
573
|
+
matchSymbol(): Expression | null;
|
|
558
574
|
/**
|
|
559
575
|
* Parse an expression:
|
|
560
576
|
*
|
|
@@ -573,4 +589,6 @@ export interface Parser {
|
|
|
573
589
|
* `until` is `{ minPrec:0 }` by default.
|
|
574
590
|
*/
|
|
575
591
|
matchExpression(until?: Partial<Terminator>): Expression | null;
|
|
592
|
+
/** Return an error expression with the specified code and arguments */
|
|
593
|
+
error(code: string | [string, ...Expression[]], fromToken: number): Expression;
|
|
576
594
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
import { NumberFormattingOptions } from './public';
|
|
3
3
|
export declare function serializeNumber(expr: Expression | null, options: NumberFormattingOptions): string;
|
|
4
4
|
export declare function serializeEngineeringNotationNumber(value: number, options: NumberFormattingOptions): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.7.0 */
|
|
2
2
|
export declare function getApplyFunctionStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
|
|
3
3
|
export declare function getGroupStyle(_expr: Expression, _level: number): 'paren' | 'leftright' | 'big' | 'none';
|
|
4
4
|
export declare function getRootStyle(_expr: Expression | null, level: number): 'radical' | 'quotient' | 'solidus';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
import { NumberFormattingOptions, LatexString, SerializeLatexOptions } from './public';
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
import { NumberFormattingOptions, LatexString, SerializeLatexOptions, FunctionEntry } from './public';
|
|
3
3
|
import { IndexedLatexDictionary, SymbolEntry } from './dictionary/definitions';
|
|
4
4
|
import { WarningSignalHandler } from '../../common/signals';
|
|
5
5
|
export declare class Serializer {
|
|
@@ -19,8 +19,10 @@ export declare class Serializer {
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
wrapShort(expr: Expression | null): string;
|
|
22
|
-
wrapString(s: string, style: 'paren' | 'leftright' | 'big' | 'none'): string;
|
|
23
|
-
|
|
22
|
+
wrapString(s: string, style: 'paren' | 'leftright' | 'big' | 'none', fence?: string): string;
|
|
23
|
+
wrapArguments(expr: Expression): string;
|
|
24
|
+
serializeSymbol(expr: Expression, def?: SymbolEntry | FunctionEntry): string;
|
|
25
|
+
serializeFunction(expr: Expression, def?: FunctionEntry | SymbolEntry): string;
|
|
24
26
|
serializeDictionary(dict: {
|
|
25
27
|
[key: string]: Expression;
|
|
26
28
|
}): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
/** The canonical form of `Add`:
|
|
3
|
+
* - removes `0`
|
|
4
|
+
* - capture complex numbers (a + ib or ai +b)
|
|
5
|
+
* */
|
|
6
|
+
export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
7
|
+
export declare function domainAdd(_ce: IComputeEngine, args: BoxedDomain[]): BoxedDomain | null;
|
|
8
|
+
export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression | undefined;
|
|
9
|
+
export declare function evalAdd(ce: IComputeEngine, args: BoxedExpression[], mode?: 'N' | 'eval'): BoxedExpression;
|
|
10
|
+
export declare function canonicalSummation(ce: IComputeEngine, expr: BoxedExpression, range: BoxedExpression | undefined): BoxedExpression;
|
|
11
|
+
export declare function evalSummation(ce: IComputeEngine, expr: BoxedExpression, range: BoxedExpression, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* 0.7.0 */
|
|
2
|
+
/**
|
|
3
|
+
* Canonical form of 'Divide' (and 'Rational')
|
|
4
|
+
* - remove denominator of 1
|
|
5
|
+
* - simplify the signs
|
|
6
|
+
* - factor out negate (make the numerator and denominator positive)
|
|
7
|
+
* - if numerator and denominator are integer literals, return a rational number
|
|
8
|
+
* or Rational experssion
|
|
9
|
+
* - if Divide, transform into Multiply/Power
|
|
10
|
+
*/
|
|
11
|
+
export declare function canonicalDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
|
|
12
|
+
/**
|
|
13
|
+
* Simplify form of 'Divide' (and 'Rational')
|
|
14
|
+
*/
|
|
15
|
+
export declare function simplifyDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression | undefined;
|