@cortex-js/compute-engine 0.22.0 → 0.23.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 +7550 -6908
- package/dist/compute-engine.js +7549 -6907
- package/dist/compute-engine.min.esm.js +10 -10
- package/dist/compute-engine.min.js +10 -10
- package/dist/math-json.esm.js +12 -11
- package/dist/math-json.js +12 -11
- package/dist/math-json.min.esm.js +12 -11
- 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 +11 -10
- package/dist/types/compute-engine/boxed-expression/box.d.ts +2 -2
- 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 +2 -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 +2 -2
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- 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 +16 -51
- 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 +41 -39
- 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 +4 -2
- 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 +2 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.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 +13 -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 +4 -3
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +6 -6
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +13 -3
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +2 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +6 -8
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +3 -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 +24 -2
- package/dist/types/compute-engine/numerics/factor.d.ts +27 -0
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +3 -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 +8 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +8 -22
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/terms.d.ts +14 -0
- package/dist/types/compute-engine/public.d.ts +45 -37
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +11 -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 +5 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/negate.d.ts +3 -2
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/product.d.ts +8 -3
- 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 +1 -1
- 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 +1 -1
- package/dist/types/compute-engine/symbolic/sum.d.ts +0 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { Decimal } from 'decimal.js';
|
|
3
3
|
import { Expression, MathJsonNumber } from '../math-json/math-json-format';
|
|
4
4
|
import type { LibraryCategory, LatexDictionaryEntry, LatexString, NumberFormattingOptions, ParseLatexOptions, SerializeLatexOptions } from './latex-syntax/public';
|
|
@@ -432,31 +432,20 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
432
432
|
checkContinueExecution(): void;
|
|
433
433
|
/** @internal */
|
|
434
434
|
cache<T>(cacheName: string, build: () => T, purge: (T: any) => T | undefined): T;
|
|
435
|
+
canonical(xs: SemiBoxedExpression[]): BoxedExpression[];
|
|
435
436
|
/**
|
|
436
437
|
* Return a boxed expression from the input.
|
|
437
438
|
*/
|
|
438
439
|
box(expr: Decimal | Complex | [num: number, denom: number] | SemiBoxedExpression, options?: {
|
|
439
440
|
canonical?: boolean | CanonicalForm | CanonicalForm[];
|
|
440
441
|
}): BoxedExpression;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
*
|
|
445
|
-
* Note that the result may not be a function, or may have a different
|
|
446
|
-
* `head` than the one specified.
|
|
447
|
-
*
|
|
448
|
-
* For example:
|
|
449
|
-
* `ce.fn("Rational", [ce.number(1), ce.number(2)]))` \( \to \) `ce.number([1,2])`
|
|
450
|
-
*
|
|
451
|
-
*/
|
|
452
|
-
fn(head: string, ops: BoxedExpression[], options?: {
|
|
453
|
-
canonical: boolean;
|
|
442
|
+
function(head: string, ops: SemiBoxedExpression[], options?: {
|
|
443
|
+
metadata?: Metadata;
|
|
444
|
+
canonical?: boolean;
|
|
454
445
|
}): BoxedExpression;
|
|
455
|
-
/** @internal */
|
|
456
|
-
_fn(head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
457
446
|
/**
|
|
458
447
|
*
|
|
459
|
-
* Shortcut for `this.
|
|
448
|
+
* Shortcut for `this.box(["Error",...])`.
|
|
460
449
|
*
|
|
461
450
|
* The result is canonical.
|
|
462
451
|
*/
|
|
@@ -466,47 +455,54 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
466
455
|
* Add a`["Hold"]` wrapper to `expr.
|
|
467
456
|
*/
|
|
468
457
|
hold(expr: SemiBoxedExpression): BoxedExpression;
|
|
469
|
-
/**
|
|
458
|
+
/**
|
|
459
|
+
* Shortcut for `this.box(["Add", ...]).evaluate()`.
|
|
470
460
|
*
|
|
471
|
-
* The result is canonical.
|
|
472
461
|
*/
|
|
473
|
-
add(ops: BoxedExpression[]
|
|
474
|
-
/**
|
|
462
|
+
add(...ops: BoxedExpression[]): BoxedExpression;
|
|
463
|
+
/**
|
|
464
|
+
*
|
|
465
|
+
* Shortcut for `this.box(["Negate", expr]).evaluate()`
|
|
475
466
|
*
|
|
476
|
-
* The result is canonical.
|
|
477
467
|
*/
|
|
478
|
-
neg(expr: BoxedExpression
|
|
479
|
-
/**
|
|
468
|
+
neg(expr: BoxedExpression): BoxedExpression;
|
|
469
|
+
/**
|
|
470
|
+
*
|
|
471
|
+
* Shortcut for `this.box(["Multiply", ...]).evaluate()`
|
|
480
472
|
*
|
|
481
|
-
* The result is canonical.
|
|
482
473
|
*/
|
|
483
|
-
mul(ops: BoxedExpression[]
|
|
484
|
-
/**
|
|
474
|
+
mul(...ops: BoxedExpression[]): BoxedExpression;
|
|
475
|
+
/**
|
|
476
|
+
*
|
|
477
|
+
* Shortcut for `this.box(["Divide", num, denom]).evaluate()`
|
|
485
478
|
*
|
|
486
479
|
* The result is canonical.
|
|
487
480
|
*/
|
|
488
|
-
div(num: BoxedExpression, denom: BoxedExpression
|
|
489
|
-
/**
|
|
481
|
+
div(num: BoxedExpression, denom: BoxedExpression): BoxedExpression;
|
|
482
|
+
/**
|
|
483
|
+
*
|
|
484
|
+
* Shortcut for `this.box(["Sqrt", base]).evaluate()`
|
|
490
485
|
*
|
|
491
|
-
* The result is canonical.
|
|
492
486
|
*/
|
|
493
|
-
sqrt(base: BoxedExpression
|
|
494
|
-
/**
|
|
487
|
+
sqrt(base: BoxedExpression): any;
|
|
488
|
+
/**
|
|
489
|
+
*
|
|
490
|
+
* Shortcut for `this.box(["Power", base, exponent]).evaluate()`
|
|
495
491
|
*
|
|
496
|
-
* The result is canonical.
|
|
497
492
|
*/
|
|
498
|
-
pow(base: BoxedExpression, exponent: number | Rational | BoxedExpression
|
|
499
|
-
/**
|
|
493
|
+
pow(base: BoxedExpression, exponent: number | Rational | BoxedExpression): BoxedExpression;
|
|
494
|
+
/**
|
|
495
|
+
*
|
|
496
|
+
* Shortcut for `this.box(["Divide", 1, expr]).evaluate()`
|
|
500
497
|
*
|
|
501
|
-
* The result is canonical.
|
|
502
498
|
*/
|
|
503
|
-
inv(expr: BoxedExpression
|
|
504
|
-
/** Shortcut for `this.
|
|
499
|
+
inv(expr: BoxedExpression): BoxedExpression;
|
|
500
|
+
/** Shortcut for `this.box(["Pair", ...])`
|
|
505
501
|
*
|
|
506
502
|
* The result is canonical.
|
|
507
503
|
*/
|
|
508
504
|
pair(first: BoxedExpression, second: BoxedExpression, metadata?: Metadata): BoxedExpression;
|
|
509
|
-
/** Shortcut for `this.
|
|
505
|
+
/** Shortcut for `this.box(["Tuple", ...])`
|
|
510
506
|
*
|
|
511
507
|
* The result is canonical.
|
|
512
508
|
*/
|
|
@@ -535,6 +531,12 @@ export declare class ComputeEngine implements IComputeEngine {
|
|
|
535
531
|
}): BoxedExpression;
|
|
536
532
|
rules(rules: Rule[]): BoxedRuleSet;
|
|
537
533
|
pattern(expr: LatexString | SemiBoxedExpression): Pattern;
|
|
534
|
+
/**
|
|
535
|
+
* Return a function expression, but the caller is responsible for making
|
|
536
|
+
* sure that the arguments are canonical.
|
|
537
|
+
*
|
|
538
|
+
* @internal */
|
|
539
|
+
_fn(head: string | BoxedExpression, ops: BoxedExpression[], metadata?: Metadata): BoxedExpression;
|
|
538
540
|
/**
|
|
539
541
|
* Parse a string of LaTeX and return a corresponding `BoxedExpression`.
|
|
540
542
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_CALCULUS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_COMPLEX: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_LOGIC: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.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,4 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
|
|
1
|
+
/* 0.23.0 */
|
|
2
|
+
import { LatexDictionaryEntry } from '../public';
|
|
3
|
+
export declare const DEFINITIONS_INEQUALITIES: LatexDictionaryEntry[];
|
|
4
|
+
export declare function isRelationalOperator(name: BoxedExpression | string): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_SETS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_STATISTICS: LatexDictionary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { WarningSignal } from '../../../common/signals';
|
|
3
3
|
export type CommonEntry = {
|
|
4
4
|
/** Note: a name is required if a serialize handler is provided */
|
|
@@ -19,6 +19,7 @@ export type IndexedSymbolEntry = CommonEntry & {
|
|
|
19
19
|
export declare function isIndexedSymbolEntry(entry: IndexedLatexDictionaryEntry): entry is IndexedSymbolEntry;
|
|
20
20
|
export type IndexedExpressionEntry = CommonEntry & {
|
|
21
21
|
kind: 'expression';
|
|
22
|
+
precedence: Precedence;
|
|
22
23
|
parse: ExpressionParseHandler;
|
|
23
24
|
};
|
|
24
25
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
|
|
3
3
|
import { IComputeEngine } from '../public';
|
|
4
4
|
import { Expression } from '../../math-json/math-json-format';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import type { IComputeEngine } from '../public';
|
|
4
4
|
/**
|
|
@@ -163,6 +163,7 @@ export type DefaultEntry = BaseEntry & Trigger & {
|
|
|
163
163
|
export type ExpressionEntry = BaseEntry & Trigger & {
|
|
164
164
|
kind: 'expression';
|
|
165
165
|
parse: Expression | ExpressionParseHandler;
|
|
166
|
+
precedence?: Precedence;
|
|
166
167
|
};
|
|
167
168
|
export type MatchfixEntry = BaseEntry & {
|
|
168
169
|
kind: 'matchfix';
|
|
@@ -333,6 +334,7 @@ export type ParseLatexOptions = {
|
|
|
333
334
|
*/
|
|
334
335
|
preserveLatex: boolean;
|
|
335
336
|
};
|
|
337
|
+
export type DelimiterScale = 'normal' | 'scaled' | 'big' | 'none';
|
|
336
338
|
export type SerializeLatexOptions = {
|
|
337
339
|
/**
|
|
338
340
|
* LaTeX string used to render an invisible multiply, e.g. in '2x'.
|
|
@@ -367,8 +369,8 @@ export type SerializeLatexOptions = {
|
|
|
367
369
|
* serialize it with this LaTeX string
|
|
368
370
|
*/
|
|
369
371
|
missingSymbol: LatexString;
|
|
370
|
-
applyFunctionStyle: (expr: Expression, level: number) =>
|
|
371
|
-
groupStyle: (expr: Expression, level: number) =>
|
|
372
|
+
applyFunctionStyle: (expr: Expression, level: number) => DelimiterScale;
|
|
373
|
+
groupStyle: (expr: Expression, level: number) => DelimiterScale;
|
|
372
374
|
rootStyle: (expr: Expression, level: number) => 'radical' | 'quotient' | 'solidus';
|
|
373
375
|
fractionStyle: (expr: Expression, level: number) => 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
|
|
374
376
|
logicStyle: (expr: Expression, level: number) => 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
@@ -473,7 +475,12 @@ export interface Serializer {
|
|
|
473
475
|
canonical?: boolean;
|
|
474
476
|
/** Output a LaTeX string representing the expression */
|
|
475
477
|
serialize: (expr: Expression | null) => string;
|
|
476
|
-
|
|
478
|
+
/** Output `s` surrounded by delimiters.
|
|
479
|
+
*
|
|
480
|
+
* If `delimiters` is not specified, use `()`
|
|
481
|
+
*
|
|
482
|
+
*/
|
|
483
|
+
wrapString(s: string, style: DelimiterScale, delimiters?: string): string;
|
|
477
484
|
/** A string with the arguments of expr fenced appropriately and separated by
|
|
478
485
|
* commas.
|
|
479
486
|
*/
|
|
@@ -487,8 +494,8 @@ export interface Serializer {
|
|
|
487
494
|
*/
|
|
488
495
|
wrapShort(expr: Expression | null): string;
|
|
489
496
|
/** Styles */
|
|
490
|
-
applyFunctionStyle: (expr: Expression, level: number) =>
|
|
491
|
-
groupStyle: (expr: Expression, level: number) =>
|
|
497
|
+
applyFunctionStyle: (expr: Expression, level: number) => DelimiterScale;
|
|
498
|
+
groupStyle: (expr: Expression, level: number) => DelimiterScale;
|
|
492
499
|
rootStyle: (expr: Expression, level: number) => 'radical' | 'quotient' | 'solidus';
|
|
493
500
|
fractionStyle: (expr: Expression, level: number) => 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
|
|
494
501
|
logicStyle: (expr: Expression, level: number) => 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
1
|
+
/* 0.23.0 */
|
|
2
|
+
import { DelimiterScale } from './public.js';
|
|
3
|
+
export declare function getApplyFunctionStyle(_expr: Expression, _level: number): DelimiterScale;
|
|
4
|
+
export declare function getGroupStyle(_expr: Expression, _level: number): DelimiterScale;
|
|
4
5
|
export declare function getRootStyle(_expr: Expression | null, level: number): 'radical' | 'quotient' | 'solidus';
|
|
5
6
|
export declare function getFractionStyle(expr: Expression, level: number): 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
|
|
6
7
|
export declare function getLogicStyle(_expr: Expression, _level: number): 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { WarningSignalHandler } from '../../common/signals';
|
|
3
|
-
import { NumberFormattingOptions, LatexString, SerializeLatexOptions } from './public';
|
|
3
|
+
import { NumberFormattingOptions, LatexString, SerializeLatexOptions, DelimiterScale } from './public';
|
|
4
4
|
import { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
|
|
5
5
|
export declare class Serializer {
|
|
6
6
|
readonly onError: WarningSignalHandler;
|
|
@@ -12,7 +12,7 @@ export declare class Serializer {
|
|
|
12
12
|
updateOptions(opt: Partial<NumberFormattingOptions> & Partial<SerializeLatexOptions>): void;
|
|
13
13
|
/**
|
|
14
14
|
* Serialize the expression, and if the expression is an operator
|
|
15
|
-
* of precedence less than or equal to prec, wrap it in some
|
|
15
|
+
* of precedence less than or equal to prec, wrap it in some parens.
|
|
16
16
|
* @todo: don't wrap Abs, Floor, Ceil, Delimiter
|
|
17
17
|
*/
|
|
18
18
|
wrap(expr: Expression | null, prec?: number): string;
|
|
@@ -24,7 +24,7 @@ export declare class Serializer {
|
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
wrapShort(expr: Expression | null): string;
|
|
27
|
-
wrapString(s: string, style:
|
|
27
|
+
wrapString(s: string, style: DelimiterScale, fence?: string): string;
|
|
28
28
|
wrapArguments(expr: Expression): string;
|
|
29
29
|
serializeSymbol(expr: Expression, def?: IndexedLatexDictionaryEntry): LatexString;
|
|
30
30
|
serializeFunction(expr: Expression, def?: IndexedLatexDictionaryEntry): LatexString;
|
|
@@ -34,8 +34,8 @@ export declare class Serializer {
|
|
|
34
34
|
serialize(expr: Expression | null, options?: {
|
|
35
35
|
canonical?: boolean;
|
|
36
36
|
}): LatexString;
|
|
37
|
-
applyFunctionStyle(expr: Expression, level: number):
|
|
38
|
-
groupStyle(expr: Expression, level: number):
|
|
37
|
+
applyFunctionStyle(expr: Expression, level: number): DelimiterScale;
|
|
38
|
+
groupStyle(expr: Expression, level: number): DelimiterScale;
|
|
39
39
|
rootStyle(expr: Expression, level: number): 'radical' | 'quotient' | 'solidus';
|
|
40
40
|
fractionStyle(expr: Expression, level: number): 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
|
|
41
41
|
logicStyle(expr: Expression, level: number): 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
/** The canonical form of `Add`:
|
|
3
3
|
* - removes `0`
|
|
4
4
|
* - capture complex numbers (a + ib or ai +b)
|
|
@@ -7,5 +7,15 @@ export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[])
|
|
|
7
7
|
export declare function domainAdd(_ce: IComputeEngine, args: (undefined | BoxedDomain)[]): BoxedDomain | null | undefined;
|
|
8
8
|
export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression;
|
|
9
9
|
export declare function evalAdd(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
|
|
10
|
-
export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression, indexingSet: BoxedExpression | undefined): BoxedExpression;
|
|
11
|
-
export declare function evalSummation(ce: IComputeEngine,
|
|
10
|
+
export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression, indexingSet: BoxedExpression | undefined): BoxedExpression | null;
|
|
11
|
+
export declare function evalSummation(ce: IComputeEngine, summationEquation: BoxedExpression[], mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Return a multiple of the imaginary unit, e.g.
|
|
14
|
+
* - 'ImaginaryUnit' -> 1
|
|
15
|
+
* - ['Negate', 'ImaginaryUnit'] -> -1
|
|
16
|
+
* - ['Negate', ['Multiply', 3, 'ImaginaryUnit']] -> -3
|
|
17
|
+
* - ['Multiply', 5, 'ImaginaryUnit'] -> 5
|
|
18
|
+
* - ['Multiply', 'ImaginaryUnit', 5] -> 5
|
|
19
|
+
* - ['Divide', 'ImaginaryUnit', 2] -> 0.5
|
|
20
|
+
*/
|
|
21
|
+
export declare function getImaginaryCoef(expr: BoxedExpression): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Canonical form of 'Divide' (and 'Rational')
|
|
4
4
|
* - remove denominator of 1
|
|
@@ -13,3 +13,4 @@ export declare function canonicalDivide(ce: IComputeEngine, op1: BoxedExpression
|
|
|
13
13
|
* Simplify form of 'Divide' (and 'Rational')
|
|
14
14
|
*/
|
|
15
15
|
export declare function simplifyDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression | undefined;
|
|
16
|
+
export declare function evalDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
/** The canonical form of `Multiply`:
|
|
3
3
|
* - remove `1`
|
|
4
|
-
* - combine literal integers and rationals
|
|
5
|
-
* - any arg is literal 0 -> return 0
|
|
6
|
-
* - combine terms with same base
|
|
7
|
-
* `a a^3` -> `a^4`
|
|
8
4
|
* - simplify the signs:
|
|
9
5
|
* - i.e. `-y \times -x` -> `x \times y`
|
|
10
6
|
* - `2 \times -x` -> `-2 \times x`
|
|
7
|
+
* - arguments are sorted
|
|
8
|
+
* - complex numbers promoted (['Multiply', 2, 'ImaginaryUnit'] -> 2i)
|
|
11
9
|
*
|
|
12
10
|
* The ops must be canonical, the result is canonical.
|
|
13
11
|
*/
|
|
14
12
|
export declare function canonicalMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
15
13
|
export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
16
|
-
export declare function evalMultiply(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression
|
|
17
|
-
export declare function canonicalProduct(ce: IComputeEngine, body: BoxedExpression | undefined, indexingSet: BoxedExpression | undefined): BoxedExpression;
|
|
18
|
-
export declare function evalMultiplication(ce: IComputeEngine,
|
|
14
|
+
export declare function evalMultiply(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
|
|
15
|
+
export declare function canonicalProduct(ce: IComputeEngine, body: BoxedExpression | undefined, indexingSet: BoxedExpression | undefined): BoxedExpression | null;
|
|
16
|
+
export declare function evalMultiplication(ce: IComputeEngine, summationEquation: BoxedExpression[], mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
@@ -6,3 +6,5 @@ export declare function canonicalPower(ce: IComputeEngine, base: BoxedExpression
|
|
|
6
6
|
export declare function square(ce: IComputeEngine, base: BoxedExpression): BoxedExpression;
|
|
7
7
|
export declare function processPower(ce: IComputeEngine, base: BoxedExpression, exponent: BoxedExpression, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|
|
8
8
|
export declare function processSqrt(ce: IComputeEngine, base: BoxedExpression, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|
|
9
|
+
export declare function isSqrt(expr: BoxedExpression): boolean;
|
|
10
|
+
export declare function asRationalSqrt(expr: BoxedExpression): Rational | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
import { FunctionDefinition, IComputeEngine, IdentifierDefinitions, SymbolDefinition } from '../public';
|
|
3
3
|
export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): readonly IdentifierDefinitions[];
|
|
4
4
|
export declare const LIBRARIES: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const LOGIC_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare function randomExpression(level?: number): Expression;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const RELOP_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const SETS_LIBRARY: IdentifierDefinitions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.23.0 */
|
|
2
2
|
/**
|
|
3
3
|
* Assume the caller has setup a scope. The index
|
|
4
4
|
* variable will be declared in that scope.
|
|
5
5
|
*
|
|
6
6
|
* @param indexingSet
|
|
7
|
+
|
|
8
|
+
* IndexingSet is an expression describing an index variable
|
|
9
|
+
* and a range of values for that variable.
|
|
10
|
+
*
|
|
11
|
+
* The MultiIndexingSet function takes an expression of the form
|
|
12
|
+
* \sum_{i=1,j=1}^{10,10} x and returns an array of expressions
|
|
13
|
+
* ["Sum","x",["Triple","i",1,10],["Triple","j",1,10]
|
|
14
|
+
*/
|
|
15
|
+
export declare function MultiIndexingSet(indexingSet: BoxedExpression | undefined): BoxedExpression[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Assume the caller has setup a scope. The index
|
|
18
|
+
* variable will be declared in that scope.
|
|
19
|
+
*
|
|
20
|
+
* @param indexingSet
|
|
21
|
+
|
|
22
|
+
* IndexingSet is an expression describing an index variable
|
|
23
|
+
* and a range of values for that variable.
|
|
7
24
|
*
|
|
25
|
+
* The SingleIndexingSet function takes an expression of the form
|
|
26
|
+
* \sum_{i=1}^{10} x and returns an array of expressions
|
|
27
|
+
* ["Sum","x",["Triple","i",1,10]
|
|
8
28
|
*/
|
|
9
|
-
export declare function
|
|
29
|
+
export declare function SingleIndexingSet(indexingSet: BoxedExpression | undefined): BoxedExpression | undefined;
|
|
10
30
|
/**
|
|
11
31
|
* IndexingSet is an expression describing an index variable
|
|
12
32
|
* and a range of values for that variable.
|
|
@@ -27,3 +47,5 @@ export declare function normalizeIndexingSet(limits: BoxedExpression | undefined
|
|
|
27
47
|
upper: number,
|
|
28
48
|
isFinite: boolean
|
|
29
49
|
];
|
|
50
|
+
export declare function cartesianProduct(array1: number[], array2: number[]): number[][];
|
|
51
|
+
export declare function range(start: number, end: number): number[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* 0.23.0 */
|
|
2
|
+
import Decimal from 'decimal.js';
|
|
3
|
+
import { BoxedExpression, Rational } from '../public';
|
|
4
|
+
/**
|
|
5
|
+
* Attempt to factor a numeric coefficient `c` and a `rest` out of a
|
|
6
|
+
* canonical expression `expr` such that `ce.mul(c, rest)` is equal to `expr`.
|
|
7
|
+
*
|
|
8
|
+
* Attempts to make `rest` a positive value (i.e. pulls out negative sign).
|
|
9
|
+
*
|
|
10
|
+
* The numeric coefficient could be an expression, for example:
|
|
11
|
+
* ['Multiply', 2, ['Sqrt', 5], 'x']
|
|
12
|
+
* -> [['Multiply', 2, ['Sqrt', 5]], 'x']
|
|
13
|
+
*
|
|
14
|
+
* ['Multiply', 2, 'x', 3, 'a']
|
|
15
|
+
* -> [6, ['Multiply', 'x', 'a']]
|
|
16
|
+
*
|
|
17
|
+
* ['Divide', ['Multiply', 2, 'x'], ['Multiply', 3, 'y', 'a']]
|
|
18
|
+
* -> [['Rational', 2, 3], ['Divide', 'x', ['Multiply, 'y', 'a']]]
|
|
19
|
+
*/
|
|
20
|
+
export declare function asCoefficient(expr: BoxedExpression): [coef: Rational, rest: BoxedExpression];
|
|
21
|
+
export declare function applyCoefficient(value: number | Decimal | Complex | Rational | null, coef: Rational): number | Decimal | Complex | Rational | null;
|
|
22
|
+
/** Combine rational expressions into a single fraction */
|
|
23
|
+
export declare function together(op: BoxedExpression): BoxedExpression;
|
|
24
|
+
/**
|
|
25
|
+
* Return a list of expressions that multiply together to form `expr`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function factor(expr: BoxedExpression): BoxedExpression;
|