@cortex-js/compute-engine 0.26.4 → 0.28.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 +9785 -8316
- package/dist/compute-engine.js +9785 -8316
- package/dist/compute-engine.min.esm.js +57 -50
- package/dist/compute-engine.min.js +57 -50
- package/dist/math-json.esm.js +287 -7
- package/dist/math-json.js +287 -7
- package/dist/math-json.min.esm.js +287 -7
- package/dist/math-json.min.js +4 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/buffer.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +2 -0
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +20 -0
- package/dist/types/common/json5.d.ts +3 -0
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/styled-text.d.ts +1 -1
- package/dist/types/common/syntax-highlighter.d.ts +1 -1
- package/dist/types/common/terminal.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +13 -0
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +2 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +39 -49
- package/dist/types/common/type/utils.d.ts +3 -7
- 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 +16 -9
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +3 -2
- package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +13 -6
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +12 -8
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- 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 +5 -4
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +7 -6
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +4 -4
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +2 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- 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/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +3 -2
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.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/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/public.d.ts +109 -64
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +7 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +3 -3
- package/dist/types/compute-engine/collection-utils.d.ts +3 -1
- package/dist/types/compute-engine/compile.d.ts +9 -8
- package/dist/types/compute-engine/compute-engine.d.ts +29 -16
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/debug.d.ts +3 -0
- 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 +11 -6
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +3 -3
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +2 -2
- 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 +3 -2
- 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/invisible-operator.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 +3 -5
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/public.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +9 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -2
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +2 -3
- 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/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +24 -0
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/private.d.ts +29 -0
- package/dist/types/compute-engine/public.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +2 -2
- package/dist/types/compute-engine.d.ts +3 -2
- package/dist/types/math-json/identifiers.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +6 -6
- package/dist/types/math-json/utils.d.ts +3 -3
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +3 -3
- package/dist/types/common/suggest.d.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression, MathJsonIdentifier, MathJsonNumber } from '../math-json/types';
|
|
4
4
|
import type { LibraryCategory, LatexDictionaryEntry, LatexString, ParseLatexOptions } from './latex-syntax/public';
|
|
@@ -11,6 +11,9 @@ import { ExactNumericValueData, NumericValue, NumericValueData } from './numeric
|
|
|
11
11
|
import { Type, TypeString } from '../common/type/types';
|
|
12
12
|
import { OneOf } from '../common/one-of';
|
|
13
13
|
import { BigNum } from './numerics/bignum';
|
|
14
|
+
import { BoxedType } from '../common/type/boxed-type';
|
|
15
|
+
export type * from '../common/type/types';
|
|
16
|
+
export * from '../common/type/subtype';
|
|
14
17
|
/**
|
|
15
18
|
*
|
|
16
19
|
* To use the Compute Engine, create a `ComputeEngine` instance:
|
|
@@ -195,9 +198,8 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
195
198
|
*
|
|
196
199
|
* The order of the dictionaries matter: the definitions from the later ones
|
|
197
200
|
* override the definitions from earlier ones. The first dictionary should
|
|
198
|
-
* be the `'core'` dictionary which include
|
|
199
|
-
*
|
|
200
|
-
* dictionaries.
|
|
201
|
+
* be the `'core'` dictionary which include basic definitions that are used
|
|
202
|
+
* by later dictionaries.
|
|
201
203
|
*
|
|
202
204
|
*
|
|
203
205
|
* @param options.precision Specific how many digits of precision
|
|
@@ -212,6 +214,7 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
212
214
|
precision?: number | 'machine';
|
|
213
215
|
tolerance?: number | 'auto';
|
|
214
216
|
});
|
|
217
|
+
toString(): string;
|
|
215
218
|
get latexDictionary(): Readonly<LatexDictionaryEntry[]>;
|
|
216
219
|
set latexDictionary(dic: Readonly<LatexDictionaryEntry[]>);
|
|
217
220
|
get indexedLatexDictionary(): IndexedLatexDictionary;
|
|
@@ -231,30 +234,39 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
231
234
|
get stats(): ComputeEngineStats;
|
|
232
235
|
get precision(): number;
|
|
233
236
|
/** The precision, or number of significant digits, of numeric
|
|
234
|
-
* calculations
|
|
237
|
+
* calculations.
|
|
235
238
|
*
|
|
236
239
|
* To make calculations using more digits, at the cost of expanded memory
|
|
237
240
|
* usage and slower computations, set the `precision` higher.
|
|
238
241
|
*
|
|
239
|
-
* If the numeric mode is not `"auto"` or `"bignum"`, it is set to `"auto"`.
|
|
240
|
-
*
|
|
241
242
|
* Trigonometric operations are accurate for precision up to 1,000.
|
|
242
243
|
*
|
|
243
244
|
*/
|
|
244
245
|
set precision(p: number | 'machine' | 'auto');
|
|
245
246
|
/**
|
|
246
|
-
* The unit used for angles in trigonometric functions.
|
|
247
|
+
* The unit used for unitless angles in trigonometric functions.
|
|
248
|
+
*
|
|
249
|
+
* - `rad`: radian, $2\pi$ radians is a full circle
|
|
250
|
+
* - `deg`: degree, 360 degrees is a full circle
|
|
251
|
+
* - `grad`: gradians, 400 gradians is a full circle
|
|
252
|
+
* - `turn`: turn, 1 turn is a full circle
|
|
247
253
|
*
|
|
248
254
|
* Default is `"rad"` (radians).
|
|
249
255
|
*/
|
|
250
256
|
get angularUnit(): AngularUnit;
|
|
251
257
|
set angularUnit(u: AngularUnit);
|
|
252
|
-
/** @experimental */
|
|
253
258
|
get timeLimit(): number;
|
|
254
|
-
|
|
259
|
+
set timeLimit(t: number);
|
|
260
|
+
private _timeLimit;
|
|
261
|
+
/** The time after which the time limit has been exceeded */
|
|
262
|
+
_deadline: number | undefined;
|
|
263
|
+
get _timeRemaining(): number;
|
|
255
264
|
get iterationLimit(): number;
|
|
256
|
-
|
|
265
|
+
set iterationLimit(t: number);
|
|
266
|
+
private _iterationLimit;
|
|
257
267
|
get recursionLimit(): number;
|
|
268
|
+
set recursionLimit(t: number);
|
|
269
|
+
private _recursionLimit;
|
|
258
270
|
get tolerance(): number;
|
|
259
271
|
/**
|
|
260
272
|
* Values smaller than the tolerance are considered to be zero for the
|
|
@@ -488,8 +500,8 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
488
500
|
*
|
|
489
501
|
* @internal
|
|
490
502
|
*/
|
|
491
|
-
_assign(id: string, value: BoxedExpression | ((ops: ReadonlyArray<BoxedExpression>, options: EvaluateOptions & {
|
|
492
|
-
engine
|
|
503
|
+
_assign(id: string, value: BoxedExpression | ((ops: ReadonlyArray<BoxedExpression>, options: Partial<EvaluateOptions> & {
|
|
504
|
+
engine?: IComputeEngine;
|
|
493
505
|
}) => BoxedExpression | undefined)): void;
|
|
494
506
|
/**
|
|
495
507
|
* Return false if the execution should stop.
|
|
@@ -524,17 +536,18 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
524
536
|
* The result is canonical.
|
|
525
537
|
*/
|
|
526
538
|
error(message: string | string[], where?: string): BoxedExpression;
|
|
527
|
-
typeError(expected: Type, actual: undefined | Type, where?: string): BoxedExpression;
|
|
539
|
+
typeError(expected: Type, actual: undefined | Type | BoxedType, where?: string): BoxedExpression;
|
|
528
540
|
/**
|
|
529
|
-
* Add a`["Hold"]` wrapper to `expr
|
|
541
|
+
* Add a `["Hold"]` wrapper to `expr`.
|
|
530
542
|
*/
|
|
531
|
-
hold(expr:
|
|
543
|
+
hold(expr: SemiBoxedExpression): BoxedExpression;
|
|
532
544
|
/** Shortcut for `this.box(["Tuple", ...])`
|
|
533
545
|
*
|
|
534
546
|
* The result is canonical.
|
|
535
547
|
*/
|
|
536
548
|
tuple(...elements: ReadonlyArray<number>): BoxedExpression;
|
|
537
549
|
tuple(...elements: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
550
|
+
type(type: Type | TypeString | BoxedType): BoxedType;
|
|
538
551
|
string(s: string, metadata?: Metadata): BoxedExpression;
|
|
539
552
|
/** Return a boxed symbol */
|
|
540
553
|
symbol(name: string, options?: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_COMPLEX: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
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.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_INEQUALITIES: LatexDictionaryEntry[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_STATISTICS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
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.
|
|
1
|
+
/* 0.28.0 */
|
|
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,5 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
|
+
import type { Expression, MathJsonIdentifier } from '../../math-json/types';
|
|
2
3
|
import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
|
|
3
4
|
export type SymbolType = 'symbol' | 'function' | 'unknown';
|
|
4
5
|
export type SymbolTable = {
|
|
@@ -100,6 +101,8 @@ export declare const MULTIPLICATION_PRECEDENCE: Precedence;
|
|
|
100
101
|
/** @hidden */
|
|
101
102
|
export declare const DIVISION_PRECEDENCE: Precedence;
|
|
102
103
|
/** @hidden */
|
|
104
|
+
export declare const INVISIBLE_OP_PRECEDENCE: Precedence;
|
|
105
|
+
/** @hidden */
|
|
103
106
|
export declare const EXPONENTIATION_PRECEDENCE: Precedence;
|
|
104
107
|
/** @hidden */
|
|
105
108
|
export declare const POSTFIX_PRECEDENCE: Precedence;
|
|
@@ -220,14 +223,14 @@ export type BaseEntry = {
|
|
|
220
223
|
* @category Latex Parsing and Serialization
|
|
221
224
|
*/
|
|
222
225
|
export type DefaultEntry = BaseEntry & Trigger & {
|
|
223
|
-
parse
|
|
226
|
+
parse?: Expression | ExpressionParseHandler;
|
|
224
227
|
};
|
|
225
228
|
/**
|
|
226
229
|
* @category Latex Parsing and Serialization
|
|
227
230
|
*/
|
|
228
231
|
export type ExpressionEntry = BaseEntry & Trigger & {
|
|
229
232
|
kind: 'expression';
|
|
230
|
-
parse
|
|
233
|
+
parse?: Expression | ExpressionParseHandler;
|
|
231
234
|
precedence?: Precedence;
|
|
232
235
|
};
|
|
233
236
|
/**
|
|
@@ -341,7 +344,9 @@ export type FunctionEntry = BaseEntry & Trigger & {
|
|
|
341
344
|
* @category Latex Parsing and Serialization
|
|
342
345
|
*
|
|
343
346
|
*/
|
|
344
|
-
export type LatexDictionaryEntry =
|
|
347
|
+
export type LatexDictionaryEntry = OneOf<[
|
|
348
|
+
ExpressionEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | FunctionEntry | EnvironmentEntry | DefaultEntry
|
|
349
|
+
]>;
|
|
345
350
|
/** @internal */
|
|
346
351
|
export declare function isExpressionEntry(entry: LatexDictionaryEntry): entry is ExpressionEntry;
|
|
347
352
|
/** @internal */
|
|
@@ -475,7 +480,7 @@ export type ParseLatexOptions = NumberFormat & {
|
|
|
475
480
|
* This handler is invoked when the parser encounters an identifier
|
|
476
481
|
* that has not yet been declared.
|
|
477
482
|
*
|
|
478
|
-
* The `identifier` argument is a
|
|
483
|
+
* The `identifier` argument is a [valid identifier](/math-json/#identifiers).
|
|
479
484
|
*
|
|
480
485
|
* The handler can return:
|
|
481
486
|
*
|
|
@@ -575,7 +580,7 @@ export interface Parser {
|
|
|
575
580
|
*/
|
|
576
581
|
matchChar(): string | null;
|
|
577
582
|
/**
|
|
578
|
-
* Parse an expression in
|
|
583
|
+
* Parse an expression in a LaTeX group enclosed in curly brackets `{}`.
|
|
579
584
|
* These are often used as arguments to LaTeX commands, for example
|
|
580
585
|
* `\frac{1}{2}`.
|
|
581
586
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
import { DelimiterScale } from './public';
|
|
3
3
|
export declare function getApplyFunctionStyle(_expr: Expression, _level: number): DelimiterScale;
|
|
4
4
|
export declare function getGroupStyle(_expr: Expression, _level: number): DelimiterScale;
|
|
@@ -7,3 +7,4 @@ export declare function getFractionStyle(expr: Expression, level: number): 'quot
|
|
|
7
7
|
export declare function getLogicStyle(_expr: Expression, _level: number): 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
8
8
|
export declare function getPowerStyle(_expr: Expression, _level: number): 'root' | 'solidus' | 'quotient';
|
|
9
9
|
export declare function getNumericSetStyle(_expr: Expression, _level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
|
|
10
|
+
export declare function latexTemplate(s: string, lhs: string, rhs: string): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
import { LatexString, SerializeLatexOptions, DelimiterScale } from './public';
|
|
3
3
|
import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
|
|
4
4
|
export declare class Serializer {
|
|
5
|
-
options: SerializeLatexOptions
|
|
5
|
+
options: Readonly<SerializeLatexOptions>;
|
|
6
6
|
readonly dictionary: IndexedLatexDictionary;
|
|
7
7
|
level: number;
|
|
8
8
|
constructor(dictionary: IndexedLatexDictionary, options: SerializeLatexOptions);
|
|
@@ -34,4 +34,4 @@ export declare class Serializer {
|
|
|
34
34
|
numericSetStyle(expr: Expression, level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
|
|
35
35
|
}
|
|
36
36
|
export declare function appendLatex(src: string, s: string): string;
|
|
37
|
-
export declare function serializeLatex(expr: Expression | null, dict: IndexedLatexDictionary, options: SerializeLatexOptions): string;
|
|
37
|
+
export declare function serializeLatex(expr: Expression | null, dict: IndexedLatexDictionary, options: Readonly<SerializeLatexOptions>): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
* ## Reference
|
|
3
3
|
* TeX source code:
|
|
4
4
|
* {@link http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web | Tex.web}
|
|
@@ -14,5 +14,5 @@ export type Token = string;
|
|
|
14
14
|
export declare function tokenize(s: string, args?: string[]): Token[];
|
|
15
15
|
export declare function countTokens(s: string): number;
|
|
16
16
|
export declare function joinLatex(segments: Iterable<string>): string;
|
|
17
|
-
export declare function supsub(c: '_' | '^', x: string): string;
|
|
17
|
+
export declare function supsub(c: '_' | '^', body: string, x: string): string;
|
|
18
18
|
export declare function tokensToString(tokens: Token | Token[] | [Token[] | Token][]): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
import { BoxedExpression } from '../boxed-expression/public';
|
|
3
3
|
export type CanonicalArithmeticOperators = 'Add' | 'Negate' | 'Multiply' | 'Divide' | 'Power' | 'Sqrt' | 'Root' | 'Ln';
|
|
4
4
|
export declare const ARITHMETIC_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const DEFAULT_LINSPACE_COUNT = 50;
|
|
3
3
|
export declare const COLLECTIONS_LIBRARY: IdentifierDefinitions;
|
|
4
4
|
/**
|
|
@@ -22,5 +22,6 @@ export declare function rangeLast(r: [lower: number, upper: number, step: number
|
|
|
22
22
|
* is returned. Otherwise, the result of the function is used as the new accumulator.
|
|
23
23
|
* If the iteration completes, the final accumulator is returned.
|
|
24
24
|
*/
|
|
25
|
-
export declare function reduceCollection<T>(collection: BoxedExpression, fn: (acc: T, next: BoxedExpression) => T | null, initial: T): T | undefined
|
|
25
|
+
export declare function reduceCollection<T>(collection: BoxedExpression, fn: (acc: T, next: BoxedExpression) => T | null, initial: T): Generator<T | undefined>;
|
|
26
26
|
export declare function fromRange(start: number, end: number): number[];
|
|
27
|
+
export declare function canonicalDictionary(engine: IComputeEngine, dict: BoxedExpression): BoxedExpression;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const CORE_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare function randomExpression(level?: number): Expression;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const RELOP_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const SETS_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export type IndexingSet = {
|
|
3
3
|
index: string | undefined;
|
|
4
4
|
lower: number;
|
|
@@ -23,7 +23,7 @@ export type IndexingSet = {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function normalizeIndexingSet(indexingSet: BoxedExpression): IndexingSet;
|
|
25
25
|
export declare function normalizeIndexingSets(ops: ReadonlyArray<BoxedExpression>): IndexingSet[];
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function indexingSetCartesianProduct(indexingSets: IndexingSet[]): number[][];
|
|
27
27
|
/**
|
|
28
28
|
* Calculates the cartesian product of two arrays.
|
|
29
29
|
* ```ts
|
|
@@ -49,9 +49,7 @@ export declare function canonicalBigop(operator: string, body: BoxedExpression,
|
|
|
49
49
|
* - ['Operator', collection]
|
|
50
50
|
*
|
|
51
51
|
* `fn()` is the processing done on each element
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
52
|
* Apply the function `fn` to the body of a big operator, according to the
|
|
55
53
|
* indexing sets.
|
|
56
54
|
*/
|
|
57
|
-
export declare function reduceBigOp<T>(body: BoxedExpression, indexes: ReadonlyArray<BoxedExpression>, fn: (acc: T, x: BoxedExpression) => T | null, initial: T): T | undefined
|
|
55
|
+
export declare function reduceBigOp<T>(body: BoxedExpression, indexes: ReadonlyArray<BoxedExpression>, fn: (acc: T, x: BoxedExpression) => T | null, initial: T): Generator<T | undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare function bigint(a: Decimal | number | bigint | string): bigint | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare function bigintValue(expr: Expression | null | undefined): bigint | null;
|
|
3
3
|
/** Output a shorthand if possible */
|
|
4
4
|
export declare function numberToExpression(num: number | bigint, fractionalDigits?: string | number): Expression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare function lcm(a: bigint, b: bigint): bigint;
|
|
3
3
|
/** Return `[factor, root]` such that
|
|
4
4
|
* pow(n, 1/exponent) = factor * pow(root, 1/exponent)
|
|
@@ -8,3 +8,11 @@ export declare function lcm(a: bigint, b: bigint): bigint;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function canonicalInteger(n: bigint, exponent: number): [factor: bigint, root: bigint];
|
|
10
10
|
export declare function reducedInteger(n: bigint): bigint | number;
|
|
11
|
+
/**
|
|
12
|
+
* Computes the factorial of a number as a generator to allow interruptibility.
|
|
13
|
+
* Yields intermediate values periodically, but these are not intended to be the primary result.
|
|
14
|
+
*
|
|
15
|
+
* @param n - The number to compute the factorial of (as a BigInt).
|
|
16
|
+
* @returns A generator that can be iterated for intermediate values, with the final value returned when the computation completes.
|
|
17
|
+
*/
|
|
18
|
+
export declare function factorial(n: bigint): Generator<bigint, bigint>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare function gcd(a: BigNum, b: BigNum): BigNum;
|
|
3
3
|
export declare function lcm(a: BigNum, b: BigNum): BigNum;
|
|
4
|
-
export declare function factorial(ce: IBigNum, n: BigNum): BigNum;
|
|
5
4
|
export declare function factorial2(ce: IBigNum, n: BigNum): BigNum;
|
|
6
5
|
/**
|
|
7
6
|
* If the exponent of the bignum is in the range of the exponents
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.28.0 */
|
|
2
2
|
export declare const MACHINE_PRECISION_BITS = 53;
|
|
3
3
|
export declare const MACHINE_PRECISION: number;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const MACHINE_TOLERANCE: number;
|
|
4
|
+
export declare const DEFAULT_TOLERANCE = 1e-10;
|
|
6
5
|
export declare const SMALL_INTEGER = 1000000;
|
|
7
6
|
type IsInteger<N extends number> = `${N}` extends `${string}.${string}` ? never : `${N}` extends `-${string}.${string}` ? never : number;
|
|
8
7
|
export type SmallInteger = IsInteger<number>;
|