@cortex-js/compute-engine 0.25.0 → 0.25.1
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 +3185 -5191
- package/dist/compute-engine.js +3185 -5191
- package/dist/compute-engine.min.esm.js +10 -10
- package/dist/compute-engine.min.js +10 -10
- package/dist/math-json.esm.js +39 -76
- package/dist/math-json.js +39 -76
- package/dist/math-json.min.esm.js +39 -76
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +2 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +1 -1
- 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 +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/coefficient-field.d.ts +56 -0
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/public.d.ts +54 -35
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +4 -3
- 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/function-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-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/public.d.ts +1 -1
- 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 +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -2
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +2 -2
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/domains.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/terms.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +1 -1
- 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/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.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/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/tensors.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/utils.d.ts +2 -2
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { LatexString } from '../public';
|
|
@@ -87,6 +87,7 @@ export declare abstract class _BoxedExpression implements BoxedExpression {
|
|
|
87
87
|
}): BoxedExpression;
|
|
88
88
|
map(fn: (x: BoxedExpression) => BoxedExpression, options?: {
|
|
89
89
|
canonical: CanonicalOptions;
|
|
90
|
+
recursive?: boolean;
|
|
90
91
|
}): BoxedExpression;
|
|
91
92
|
solve(_vars: Iterable<string> | string | BoxedExpression | Iterable<BoxedExpression>): null | ReadonlyArray<BoxedExpression>;
|
|
92
93
|
replace(_rules: BoxedRuleSet | Rule | Rule[]): null | BoxedExpression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, BoxedRuleSet, SemiBoxedExpression, SimplifyOptions, ReplaceOptions, Substitution, Metadata, PatternMatchOptions, BoxedDomain, BoxedSubstitution, Rule, CanonicalOptions } from './public';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedDomain, BoxedSubstitution, DomainCompatibility, DomainConstructor, DomainExpression, DomainLiteral, IComputeEngine, Metadata, PatternMatchOptions } from '../public';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { BoxedExpression, BoxedDomain, IComputeEngine, Metadata, NOptions, PatternMatchOptions, SimplifyOptions, BoxedSubstitution, EvaluateOptions, SemiBoxedExpression } from '../public';
|
|
4
4
|
import { Rational } from '../numerics/rationals';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { Expression } from '../../math-json/math-json-format';
|
|
4
4
|
import { BoxedExpression, IComputeEngine, EvaluateOptions, NOptions, SimplifyOptions, Metadata, BoxedDomain, BoxedSubstitution, PatternMatchOptions, BoxedBaseDefinition, BoxedFunctionDefinition, SemiBoxedExpression } from '../public';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare function canonicalForm(expr: BoxedExpression, forms: CanonicalOptions): BoxedExpression;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* 0.25.1 */
|
|
2
|
+
*
|
|
3
|
+
* ## THEORY OF OPERATIONS
|
|
4
|
+
*
|
|
5
|
+
* In order to preserve exact results, some numeric operations are performed
|
|
6
|
+
* on "coefficients" which represent a product of a rational number,
|
|
7
|
+
* an algebraic numbers and the square root of an integer.
|
|
8
|
+
*
|
|
9
|
+
* A field is defined on these coefficients.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { Rational } from '../numerics/rationals';
|
|
14
|
+
import { BoxedExpression } from './public';
|
|
15
|
+
export interface CoefficientData {
|
|
16
|
+
float: number;
|
|
17
|
+
rational: Rational;
|
|
18
|
+
sqrt: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class Coefficient implements CoefficientData {
|
|
21
|
+
static zero: Coefficient;
|
|
22
|
+
static one: Coefficient;
|
|
23
|
+
/**
|
|
24
|
+
* Attempt to factor a numeric coefficient `c` and a `rest` out of a
|
|
25
|
+
* canonical expression `expr` such that `ce.mul(c, rest)` is equal to `expr`.
|
|
26
|
+
*
|
|
27
|
+
* Attempts to make `rest` a positive value (i.e. pulls out negative sign).
|
|
28
|
+
*
|
|
29
|
+
* For example:
|
|
30
|
+
*
|
|
31
|
+
* ['Multiply', 2, 'x', 3, 'a']
|
|
32
|
+
* -> [6, ['Multiply', 'x', 'a']]
|
|
33
|
+
*
|
|
34
|
+
* ['Divide', ['Multiply', 2, 'x'], ['Multiply', 3, 'y', 'a']]
|
|
35
|
+
* -> [['Rational', 2, 3], ['Divide', 'x', ['Multiply, 'y', 'a']]]
|
|
36
|
+
*/
|
|
37
|
+
static fromExpression(expr: BoxedExpression): [coef: Coefficient, rest: BoxedExpression];
|
|
38
|
+
float: number;
|
|
39
|
+
rational: Rational;
|
|
40
|
+
sqrt: number;
|
|
41
|
+
constructor(value?: number | Partial<CoefficientData>);
|
|
42
|
+
asFloat(): number;
|
|
43
|
+
asRational(): Rational;
|
|
44
|
+
normalize(): void;
|
|
45
|
+
get isZero(): boolean;
|
|
46
|
+
get isOne(): boolean;
|
|
47
|
+
get sign(): number;
|
|
48
|
+
neg(): Coefficient;
|
|
49
|
+
inv(): Coefficient;
|
|
50
|
+
mul(other: Partial<CoefficientData> | number | Rational): Coefficient;
|
|
51
|
+
pow(exponent: number): Coefficient;
|
|
52
|
+
div(other: Partial<CoefficientData> | number | Rational): Coefficient;
|
|
53
|
+
add(other: Partial<CoefficientData> | number | Rational): Coefficient;
|
|
54
|
+
sub(other: Partial<CoefficientData> | number | Rational): Coefficient;
|
|
55
|
+
eq(other: Coefficient): boolean;
|
|
56
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { Expression, MathJsonNumber, MathJsonString, MathJsonSymbol, MathJsonFunction, MathJsonDictionary, MathJsonIdentifier } from '../../math-json';
|
|
4
4
|
import type { SerializeLatexOptions, LatexDictionaryEntry, ParseLatexOptions } from '../latex-syntax/public';
|
|
@@ -361,9 +361,12 @@ export interface BoxedExpression {
|
|
|
361
361
|
*
|
|
362
362
|
* The canonical option is applied to each function subexpression after
|
|
363
363
|
* the substitution is applied.
|
|
364
|
+
*
|
|
365
|
+
* **Default**: `{canonical: true, recursive: true}`
|
|
364
366
|
*/
|
|
365
367
|
map(fn: (expr: BoxedExpression) => BoxedExpression, options?: {
|
|
366
368
|
canonical: CanonicalOptions;
|
|
369
|
+
recursive?: boolean;
|
|
367
370
|
}): BoxedExpression;
|
|
368
371
|
/**
|
|
369
372
|
* Transform the expression by applying the rules:
|
|
@@ -1225,21 +1228,61 @@ export type PatternReplaceFunction = (expr: BoxedExpression, wildcards: BoxedSub
|
|
|
1225
1228
|
/** @category Rules */
|
|
1226
1229
|
export type PatternConditionFunction = (wildcards: BoxedSubstitution, ce: IComputeEngine) => boolean;
|
|
1227
1230
|
/**
|
|
1228
|
-
*
|
|
1231
|
+
* A rule describes how to modify an expressions that matches a pattern `match`
|
|
1232
|
+
* into a new expression `replace`.
|
|
1229
1233
|
*
|
|
1230
|
-
*
|
|
1234
|
+
* - `x-1` \( \to \) `1-x`
|
|
1235
|
+
* - `(x+1)(x-1)` \( \to \) `x^2-1
|
|
1236
|
+
*
|
|
1237
|
+
* The patterns can be expressed as LaTeX strings or a MathJSON expressions.
|
|
1238
|
+
*
|
|
1239
|
+
* As a shortcut, a rule can be defined as a LaTeX string: `x-1 -> 1-x`.
|
|
1240
|
+
* The expression to the left of `->` is the `match` and the expression to the
|
|
1241
|
+
* right is the `replace`. When using LaTeX strings, single character variables
|
|
1242
|
+
* are assumed to be wildcards.
|
|
1243
|
+
*
|
|
1244
|
+
* When using MathJSON expressions, anonymous wildcards (`_`) will match any
|
|
1245
|
+
* expression. Named wildcards (`_x`, `_a`, etc...) will match any expression
|
|
1246
|
+
* and bind the expression to the wildcard name.
|
|
1247
|
+
*
|
|
1248
|
+
* In addition the sequence wildcard (`__1`, `__a`, etc...) will match
|
|
1249
|
+
* a sequence of one or more expressions, and bind the sequence to the
|
|
1250
|
+
* wildcard name.
|
|
1251
|
+
*
|
|
1252
|
+
* If `exact` is false, the rule will match variants. For example
|
|
1253
|
+
* 'x' will match 'a + x', 'x' will match 'ax', etc...
|
|
1254
|
+
* For simplification rules, you generally want `exact` to be true, but
|
|
1255
|
+
* to solve equations, you want it to be false. Default to true.
|
|
1256
|
+
*
|
|
1257
|
+
* When set to false, infinite recursion is possible.
|
|
1258
|
+
*
|
|
1259
|
+
* @category Rules
|
|
1231
1260
|
*/
|
|
1232
|
-
export type
|
|
1261
|
+
export type Rule = string | {
|
|
1262
|
+
match: LatexString | SemiBoxedExpression | Pattern;
|
|
1263
|
+
replace: LatexString | SemiBoxedExpression | PatternReplaceFunction;
|
|
1264
|
+
condition?: LatexString | PatternConditionFunction;
|
|
1265
|
+
exact?: boolean;
|
|
1266
|
+
priority?: number;
|
|
1267
|
+
id?: string;
|
|
1268
|
+
};
|
|
1233
1269
|
/** @category Rules */
|
|
1234
1270
|
export type BoxedRule = {
|
|
1235
1271
|
match: Pattern;
|
|
1236
1272
|
replace: BoxedExpression | PatternReplaceFunction;
|
|
1237
1273
|
condition: undefined | PatternConditionFunction;
|
|
1238
1274
|
priority: number;
|
|
1275
|
+
exact?: boolean;
|
|
1239
1276
|
id?: string;
|
|
1240
1277
|
};
|
|
1241
1278
|
/** @category Rules */
|
|
1242
|
-
export type BoxedRuleSet =
|
|
1279
|
+
export type BoxedRuleSet = Iterable<BoxedRule>;
|
|
1280
|
+
/**
|
|
1281
|
+
* @noInheritDoc
|
|
1282
|
+
*
|
|
1283
|
+
* @category Pattern Matching
|
|
1284
|
+
*/
|
|
1285
|
+
export type Pattern = BoxedExpression;
|
|
1243
1286
|
/**
|
|
1244
1287
|
* @category Boxed Expression
|
|
1245
1288
|
*
|
|
@@ -1282,7 +1325,7 @@ export type DomainExpression<T = SemiBoxedExpression> = DomainLiteral | ['Union'
|
|
|
1282
1325
|
*/
|
|
1283
1326
|
export type SimplifyOptions = {
|
|
1284
1327
|
recursive?: boolean;
|
|
1285
|
-
rules?: BoxedRuleSet;
|
|
1328
|
+
rules?: null | BoxedRuleSet;
|
|
1286
1329
|
};
|
|
1287
1330
|
/** Options for `BoxedExpression.evaluate()`
|
|
1288
1331
|
*
|
|
@@ -1438,6 +1481,10 @@ export interface IComputeEngine {
|
|
|
1438
1481
|
tuple(elements: ReadonlyArray<BoxedExpression>, metadata?: Metadata): BoxedExpression;
|
|
1439
1482
|
array(elements: ArrayValue[] | ArrayValue[][], metadata?: Metadata): BoxedExpression;
|
|
1440
1483
|
rules(rules: Rule[]): BoxedRuleSet;
|
|
1484
|
+
/**
|
|
1485
|
+
* Return a set of built-in rules.
|
|
1486
|
+
*/
|
|
1487
|
+
getRuleSet(id?: 'harmonization' | 'solve-univariate' | 'standard-simplification'): BoxedRuleSet | undefined;
|
|
1441
1488
|
/**
|
|
1442
1489
|
* This is a primitive to create a boxed function.
|
|
1443
1490
|
*
|
|
@@ -1511,7 +1558,7 @@ export interface ComputeEngineStats {
|
|
|
1511
1558
|
highwaterMark: number;
|
|
1512
1559
|
}
|
|
1513
1560
|
/**
|
|
1514
|
-
* Options to control the serialization to MathJSON when using `BoxedExpression.
|
|
1561
|
+
* Options to control the serialization to MathJSON when using `BoxedExpression.toMathJson()`.
|
|
1515
1562
|
*
|
|
1516
1563
|
* @category Compute Engine
|
|
1517
1564
|
*/
|
|
@@ -1627,34 +1674,6 @@ export type ReplaceOptions = {
|
|
|
1627
1674
|
export type Substitution<T = SemiBoxedExpression> = {
|
|
1628
1675
|
[symbol: string]: T;
|
|
1629
1676
|
};
|
|
1630
|
-
/**
|
|
1631
|
-
* A rule describes how to modify an expressions that matches a pattern `match`
|
|
1632
|
-
* into a new expression `replace`.
|
|
1633
|
-
*
|
|
1634
|
-
* `x-1` \( \to \) `1-x`
|
|
1635
|
-
* `(x+1)(x-1)` \( \to \) `x^2-1
|
|
1636
|
-
*
|
|
1637
|
-
* The `match` pattern can be expressed as a LaTeX string or a
|
|
1638
|
-
* MathJSON expression.
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1641
|
-
* Anonymous wildcards (`_`) will match any
|
|
1642
|
-
* expression. Named wildcards (`_x`, `_a`, etc...) will match any expression
|
|
1643
|
-
* and bind the expression to the wildcard name.
|
|
1644
|
-
*
|
|
1645
|
-
* In addition the sequence wildcard (`__1`, `__a`, etc...) will match
|
|
1646
|
-
* a sequence of one or more expressions, and bind the sequence to the
|
|
1647
|
-
* wildcard name.
|
|
1648
|
-
*
|
|
1649
|
-
* @category Rules
|
|
1650
|
-
*/
|
|
1651
|
-
export type Rule = {
|
|
1652
|
-
match: LatexString | SemiBoxedExpression | Pattern;
|
|
1653
|
-
replace: LatexString | SemiBoxedExpression | PatternReplaceFunction;
|
|
1654
|
-
condition?: LatexString | PatternConditionFunction;
|
|
1655
|
-
priority?: number;
|
|
1656
|
-
id?: string;
|
|
1657
|
-
};
|
|
1658
1677
|
/** @category Assumptions */
|
|
1659
1678
|
export interface ExpressionMapInterface<U> {
|
|
1660
1679
|
has(expr: BoxedExpression): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { MathJsonIdentifier, MathJsonNumber } from '../math-json/math-json-format';
|
|
4
4
|
import type { LibraryCategory, LatexDictionaryEntry, LatexString, ParseLatexOptions } from './latex-syntax/public';
|
|
@@ -497,7 +497,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
497
497
|
/** @internal */
|
|
498
498
|
checkContinueExecution(): void;
|
|
499
499
|
/** @internal */
|
|
500
|
-
cache<T>(cacheName: string, build: () => T, purge
|
|
500
|
+
cache<T>(cacheName: string, build: () => T, purge?: (T: any) => T | undefined): T;
|
|
501
501
|
/** Return a boxed expression from a number, string or semiboxed expression.
|
|
502
502
|
* Calls `ce.function()`, `ce.number()` or `ce.symbol()` as appropriate.
|
|
503
503
|
*/
|
|
@@ -549,7 +549,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
549
549
|
* Shortcut for `this.box(["Sqrt", base]).evaluate()`
|
|
550
550
|
*
|
|
551
551
|
*/
|
|
552
|
-
sqrt(base: BoxedExpression):
|
|
552
|
+
sqrt(base: BoxedExpression): BoxedExpression;
|
|
553
553
|
/**
|
|
554
554
|
*
|
|
555
555
|
* Shortcut for `this.box(["Power", base, exponent]).evaluate()`
|
|
@@ -595,6 +595,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
595
595
|
canonical?: CanonicalOptions;
|
|
596
596
|
}): BoxedExpression;
|
|
597
597
|
rules(rules: Rule[]): BoxedRuleSet;
|
|
598
|
+
getRuleSet(id?: string): BoxedRuleSet | undefined;
|
|
598
599
|
/**
|
|
599
600
|
* Return a function expression, but the caller is responsible for making
|
|
600
601
|
* sure that the arguments are canonical.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_COMPLEX: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_OTHERS: LatexDictionary;
|
package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_INEQUALITIES: LatexDictionaryEntry[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_STATISTICS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import { Delimiter, EnvironmentParseHandler, ExpressionParseHandler, InfixParseHandler, LatexDictionary, LatexDictionaryEntry, LatexString, LatexToken, LibraryCategory, MatchfixParseHandler, PostfixParseHandler, Precedence, SerializeHandler } from '../public';
|
|
3
3
|
export type CommonEntry = {
|
|
4
4
|
/** Note: a name is required if a serialize handler is provided */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
import { ParseLatexOptions, LatexToken, Terminator, Parser, SymbolTable, SymbolType } from './public';
|
|
3
3
|
import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
/**
|
|
3
3
|
* Canonical form of 'Divide' (and 'Rational')
|
|
4
4
|
* - remove denominator of 1
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* - factor out negate (make the numerator and denominator positive)
|
|
7
7
|
* - if numerator and denominator are integer literals, return a rational number
|
|
8
8
|
* or Rational experssion
|
|
9
|
-
* - if Divide, transform into Multiply/Power
|
|
10
9
|
*/
|
|
11
10
|
export declare function canonicalDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
|
|
12
11
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.25.
|
|
1
|
+
/* 0.25.1 */
|
|
2
2
|
/** The canonical form of `Multiply`:
|
|
3
3
|
* - remove `1`
|
|
4
4
|
* - simplify the signs:
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The ops must be canonical, the result is canonical.
|
|
11
11
|
*/
|
|
12
12
|
export declare function canonicalMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
13
|
-
export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression
|
|
13
|
+
export declare function simplifyMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
14
14
|
export declare function evalMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>, mode?: 'N' | 'evaluate'): BoxedExpression;
|
|
15
15
|
export declare function canonicalProduct(ce: IComputeEngine, body: BoxedExpression | undefined, indexingSet: BoxedExpression | undefined): BoxedExpression | null;
|
|
16
16
|
export declare function evalMultiplication(ce: IComputeEngine, summationEquation: ReadonlyArray<BoxedExpression>, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|