@cortex-js/compute-engine 0.8.0 → 0.9.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 +7800 -6891
- package/dist/compute-engine.min.esm.js +2 -2
- package/dist/compute-engine.min.js +2 -2
- package/dist/math-json.esm.js +41 -88
- 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 -5
- package/dist/types/common/utils.d.ts +1 -0
- package/dist/types/compute-engine/assume.d.ts +6 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +10 -14
- package/dist/types/compute-engine/boxed-expression/box.d.ts +74 -16
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +10 -5
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +3 -4
- 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 +16 -14
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +20 -19
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +8 -7
- 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 +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +18 -12
- 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 +3 -3
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +7 -7
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +18 -0
- package/dist/types/compute-engine/compute-engine.d.ts +64 -33
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +2 -8
- 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 -1
- 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 +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +25 -9
- package/dist/types/compute-engine/latex-syntax/public.d.ts +14 -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 -2
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +3 -3
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +5 -6
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +3 -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 +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/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.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/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/numerics/{numeric-decimal.d.ts → numeric-bignum.d.ts} +10 -6
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +10 -6
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +56 -0
- package/dist/types/compute-engine/public.d.ts +200 -247
- package/dist/types/compute-engine/rules.d.ts +7 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +17 -0
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +2 -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 +30 -12
- package/dist/types/compute-engine/symbolic/sum.d.ts +13 -7
- package/dist/types/compute-engine/symbolic/utils.d.ts +7 -29
- package/dist/types/compute-engine.d.ts +2 -2
- package/dist/types/math-json/math-json-format.d.ts +2 -2
- package/dist/types/math-json/utils.d.ts +11 -41
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
import { IndexedLatexDictionary, InfixEntry, PostfixEntry, PrefixEntry, SymbolEntry } from './dictionary/definitions';
|
|
3
3
|
import { IComputeEngine } from '../public';
|
|
4
4
|
import { Expression } from '../../math-json/math-json-format';
|
|
@@ -67,11 +67,17 @@ export declare class _Parser implements Parser {
|
|
|
67
67
|
peekDefinitions(kind: 'infix'): [InfixEntry, number][] | null;
|
|
68
68
|
peekDefinitions(kind: 'prefix'): [PrefixEntry, number][] | null;
|
|
69
69
|
peekDefinitions(kind: 'operator'): [InfixEntry | PrefixEntry | PostfixEntry, number][] | null;
|
|
70
|
+
/** Skip strictly `<space>` tokens.
|
|
71
|
+
* To also skip `{}` see `skipSpace()`.
|
|
72
|
+
* To skip visual space (e.g. `\,`) see `skipVisualSpace()`.
|
|
73
|
+
*/
|
|
70
74
|
skipSpaceTokens(): void;
|
|
71
|
-
/** While parsing in math mode, skip applicable spaces
|
|
72
|
-
* Do not use to skip spaces
|
|
75
|
+
/** While parsing in math mode, skip applicable spaces, which includes `{}`.
|
|
76
|
+
* Do not use to skip spaces while parsing a string. See `skipSpaceTokens()`
|
|
77
|
+
* instead.
|
|
73
78
|
*/
|
|
74
79
|
skipSpace(): boolean;
|
|
80
|
+
skipVisualSpace(): void;
|
|
75
81
|
matchChar(): string | null;
|
|
76
82
|
matchColor(_background?: boolean): string | null;
|
|
77
83
|
matchLatexDimension(): string | null;
|
|
@@ -109,6 +115,13 @@ export declare class _Parser implements Parser {
|
|
|
109
115
|
* (i.e. we interpret `\cos 2x + 1` as `\cos(2x) + 1`)
|
|
110
116
|
*/
|
|
111
117
|
matchArguments(kind: undefined | '' | 'enclosure' | 'implicit'): Expression[] | null;
|
|
118
|
+
/**
|
|
119
|
+
* A function can be followed by the following suffixes:
|
|
120
|
+
* - a `\prime`, `\doubleprime`, `'`, `(n)` to indicate a derivative
|
|
121
|
+
* - a subscript to indicate an argument
|
|
122
|
+
* - an argument, optionally inside an enclosure
|
|
123
|
+
*/
|
|
124
|
+
matchFunctionSuffix(): Expression | null;
|
|
112
125
|
/** If matches the normalized open delimiter, return the
|
|
113
126
|
* expected closing delimiter.
|
|
114
127
|
*
|
|
@@ -119,6 +132,11 @@ export declare class _Parser implements Parser {
|
|
|
119
132
|
*/
|
|
120
133
|
matchOpenDelimiter(openDelim: Delimiter, closeDelim: Delimiter): LatexToken[] | null;
|
|
121
134
|
matchMiddleDelimiter(delimiter: '|' | ':' | LatexToken): boolean;
|
|
135
|
+
/** For error handling, when there is potentially a mismatched delimiter.
|
|
136
|
+
* Return a LaTeX fragment of the expected closing delimiter
|
|
137
|
+
*/
|
|
138
|
+
matchEnclosureOpen(): string | null;
|
|
139
|
+
matchEnclosureClose(): string | null;
|
|
122
140
|
/**
|
|
123
141
|
* An enclosure is an opening matchfix operator, an optional expression,
|
|
124
142
|
* optionally followed multiple times by a separator and another expression,
|
|
@@ -126,15 +144,13 @@ export declare class _Parser implements Parser {
|
|
|
126
144
|
*/
|
|
127
145
|
matchEnclosure(): Expression | null;
|
|
128
146
|
/**
|
|
129
|
-
* Match
|
|
147
|
+
* Match an identifier. It can be:
|
|
130
148
|
* - a symbol
|
|
131
149
|
* - a simple multi-letter identifier: `\mathrm{speed}`
|
|
132
|
-
* - a complex multi-letter identifier: `\
|
|
150
|
+
* - a complex multi-letter identifier: `\mathrm{\alpha_{12}}` or `\mathit{speed\unicode{"2012}of\unicode{"2012}sound}`
|
|
133
151
|
* - 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
|
|
136
152
|
*/
|
|
137
|
-
matchIdentifier(): string | null;
|
|
153
|
+
matchIdentifier(): string | Expression | null;
|
|
138
154
|
/**
|
|
139
155
|
* A function is a function identifier followed by arguments
|
|
140
156
|
* - a function with explicit arguments `f(x)`
|
|
@@ -151,7 +167,7 @@ export declare class _Parser implements Parser {
|
|
|
151
167
|
*/
|
|
152
168
|
matchSymbol(): Expression | null;
|
|
153
169
|
matchOptionalLatexArgument(): Expression | null;
|
|
154
|
-
matchRequiredLatexArgument(): Expression | null;
|
|
170
|
+
matchRequiredLatexArgument(excluding?: string[]): Expression | null;
|
|
155
171
|
matchSupsub(lhs: Expression | null): Expression | null;
|
|
156
172
|
matchPostfix(lhs: Expression | null): Expression | null;
|
|
157
173
|
/** Match a string used as a LaTeX identifier, for example an environment
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
import { Expression } from '../../math-json/math-json-format';
|
|
3
3
|
import type { IComputeEngine } from '../public';
|
|
4
4
|
/**
|
|
@@ -255,7 +255,7 @@ export declare type ParseLatexOptions = {
|
|
|
255
255
|
* When a number is encountered, parse it.
|
|
256
256
|
*
|
|
257
257
|
* Otherwise, return each token making up the number (minus sign, digits,
|
|
258
|
-
* decimal
|
|
258
|
+
* decimal marker, etc...).
|
|
259
259
|
*
|
|
260
260
|
* **Default**: `true`
|
|
261
261
|
*/
|
|
@@ -276,7 +276,7 @@ export declare type ParseLatexOptions = {
|
|
|
276
276
|
*
|
|
277
277
|
* - `error`, an error condition is raised.
|
|
278
278
|
*/
|
|
279
|
-
|
|
279
|
+
parseUnknownIdentifier: (symbol: string, parser: Parser) => 'symbol' | 'function' | 'unknown';
|
|
280
280
|
/**
|
|
281
281
|
* If true, the expression will be decorated with the LaTeX
|
|
282
282
|
* fragments corresponding to each elements of the expression.
|
|
@@ -364,7 +364,7 @@ export declare type NumberFormattingOptions = {
|
|
|
364
364
|
truncationMarker: LatexString;
|
|
365
365
|
beginRepeatingDigits: LatexString;
|
|
366
366
|
endRepeatingDigits: LatexString;
|
|
367
|
-
|
|
367
|
+
imaginaryUnit: LatexString;
|
|
368
368
|
avoidExponentsInRange: [negativeExponent: number, positiveExponent: number];
|
|
369
369
|
};
|
|
370
370
|
/**
|
|
@@ -512,18 +512,26 @@ export interface Parser {
|
|
|
512
512
|
/**
|
|
513
513
|
* Match a required LaTeX argument:
|
|
514
514
|
* - either enclosed in `{}`
|
|
515
|
-
* - or a single token
|
|
515
|
+
* - or a single token (except if token is in `excluding`)
|
|
516
|
+
*
|
|
517
|
+
* The `excluding` option is useful to fail early when encountering a likely
|
|
518
|
+
* syntax error, for example `x^(2)` (instead of `x^{2}`). With `(` in the list
|
|
519
|
+
* of excluded tokens, the match will fail and the error can be recovered.
|
|
520
|
+
*
|
|
521
|
+
* If none is provided, `excluding` is `!"#$%&(),/;:?@[]`|~", `\left` and `\bigl`
|
|
522
|
+
*
|
|
516
523
|
*
|
|
517
524
|
* Return null if no argument was found
|
|
518
525
|
* Return `['Sequence']` if an empty argument `{}` was found
|
|
519
526
|
*/
|
|
520
|
-
matchRequiredLatexArgument(): Expression | null;
|
|
527
|
+
matchRequiredLatexArgument(excluding?: string[]): Expression | null;
|
|
521
528
|
/**
|
|
522
529
|
* - 'enclosure' : will look for an argument inside an enclosure (an open/close fence)
|
|
523
530
|
* - 'implicit': either an expression inside a pair of `()`, or just a primary
|
|
524
531
|
* (i.e. we interpret `\cos x + 1` as `\cos(x) + 1`)
|
|
525
532
|
*/
|
|
526
533
|
matchArguments(kind: '' | 'implicit' | 'enclosure'): Expression[] | null;
|
|
534
|
+
matchStringArgument(): string | null;
|
|
527
535
|
/** If matches the normalized open delimiter, returns the
|
|
528
536
|
* expected closing delimiter.
|
|
529
537
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.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,8 +1,8 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.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';
|
|
5
|
-
export declare function getFractionStyle(
|
|
5
|
+
export declare function getFractionStyle(expr: Expression, level: number): 'quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
|
|
6
6
|
export declare function getLogicStyle(_expr: Expression, _level: number): 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
|
|
7
7
|
export declare function getPowerStyle(_expr: Expression, _level: number): 'root' | 'solidus' | 'quotient';
|
|
8
8
|
export declare function getNumericSetStyle(_expr: Expression, _level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
|
+
import { WarningSignalHandler } from '../../common/signals';
|
|
2
3
|
import { NumberFormattingOptions, LatexString, SerializeLatexOptions, FunctionEntry } from './public';
|
|
3
4
|
import { IndexedLatexDictionary, SymbolEntry } from './dictionary/definitions';
|
|
4
|
-
import { WarningSignalHandler } from '../../common/signals';
|
|
5
5
|
export declare class Serializer {
|
|
6
6
|
readonly onError: WarningSignalHandler;
|
|
7
7
|
options: NumberFormattingOptions & SerializeLatexOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
/** The canonical form of `Add`:
|
|
3
3
|
* - removes `0`
|
|
4
4
|
* - capture complex numbers (a + ib or ai +b)
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
7
7
|
export declare function domainAdd(_ce: IComputeEngine, args: BoxedDomain[]): BoxedDomain | null;
|
|
8
8
|
export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression | undefined;
|
|
9
|
-
export declare function evalAdd(ce: IComputeEngine,
|
|
10
|
-
export declare function canonicalSummation(ce: IComputeEngine,
|
|
9
|
+
export declare function evalAdd(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
|
|
10
|
+
export declare function canonicalSummation(ce: IComputeEngine, body: BoxedExpression, range: BoxedExpression | undefined): BoxedExpression;
|
|
11
11
|
export declare function evalSummation(ce: IComputeEngine, expr: BoxedExpression, range: BoxedExpression, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
/** The canonical form of `Multiply`:
|
|
3
3
|
* - remove `1`
|
|
4
|
-
* - combine literal
|
|
4
|
+
* - combine literal integers and rationals
|
|
5
5
|
* - any arg is literal 0 -> return 0
|
|
6
|
-
* - simplify signs
|
|
7
6
|
* - combine terms with same base
|
|
8
7
|
* `a a^3` -> `a^4`
|
|
9
8
|
* - simplify the signs:
|
|
10
|
-
* - i.e. `-
|
|
9
|
+
* - i.e. `-y \times -x` -> `x \times y`
|
|
11
10
|
* - `2 \times -x` -> `-2 \times x`
|
|
12
11
|
*
|
|
13
12
|
* The ops must be canonical, the result is canonical.
|
|
14
13
|
*/
|
|
15
14
|
export declare function canonicalMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
16
|
-
export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression
|
|
15
|
+
export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
|
|
17
16
|
export declare function evalMultiply(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression | undefined;
|
|
18
|
-
export declare function canonicalMultiplication(ce: IComputeEngine,
|
|
17
|
+
export declare function canonicalMultiplication(ce: IComputeEngine, body: BoxedExpression | undefined, range: BoxedExpression | undefined): BoxedExpression;
|
|
19
18
|
export declare function evalMultiplication(ce: IComputeEngine, expr: BoxedExpression, range: BoxedExpression, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* Return `null` if there is no canonicalization necessary and the result is
|
|
5
5
|
* simply `ce._fn('Power', [base, exponent])`
|
|
6
6
|
*/
|
|
7
|
-
export declare function canonicalPower(ce: IComputeEngine, base: BoxedExpression, exponent: BoxedExpression, metadata?: Metadata): BoxedExpression | null;
|
|
7
|
+
export declare function canonicalPower(ce: IComputeEngine, base: BoxedExpression | undefined, exponent: BoxedExpression | undefined, metadata?: Metadata): BoxedExpression | null;
|
|
8
8
|
export declare function square(ce: IComputeEngine, base: BoxedExpression): BoxedExpression;
|
|
9
9
|
export declare function processPower(ce: IComputeEngine, base: BoxedExpression, exponent: BoxedExpression, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|
|
10
|
+
export declare function processSqrt(ce: IComputeEngine, base: BoxedExpression, mode: 'simplify' | 'evaluate' | 'N'): BoxedExpression | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const ARITHMETIC_LIBRARY: SymbolTable[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const CALCULUS_LIBRARY: SymbolTable[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const COLLECTIONS_LIBRARY: SymbolTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const CORE_LIBRARY: SymbolTable[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const LOGIC_LIBRARY: SymbolTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const POLYNOMIALS_LIBRARY: SymbolTable[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const RELOP_LIBRARY: SymbolTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const SETS_LIBRARY: SymbolTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare const TRIGONOMETRY_LIBRARY: SymbolTable[];
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
import { IComputeEngine } from '../public';
|
|
3
3
|
export declare function gcd(a: Decimal, b: Decimal): Decimal;
|
|
4
4
|
export declare function lcm(a: Decimal, b: Decimal): Decimal;
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export declare function primeFactors(ce: IComputeEngine, n: Decimal): Map<Decimal, number>;
|
|
6
|
+
/** Return `[factor, root]` such that
|
|
7
|
+
* pow(n, 1/exponent) = factor * pow(root, 1/exponent)
|
|
8
|
+
*
|
|
9
|
+
* factorPower(75, 2) -> [5, 3] = 5^2 * 3
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare function factorPower(ce: IComputeEngine, n: Decimal, exponent: number): [factor: Decimal, root: Decimal];
|
|
9
13
|
export declare function factorial(ce: IComputeEngine, n: Decimal): Decimal;
|
|
10
14
|
export declare function lngamma(ce: IComputeEngine, z: Decimal): Decimal;
|
|
11
15
|
export declare function gamma(ce: IComputeEngine, z: Decimal): Decimal;
|
|
12
16
|
/**
|
|
13
|
-
* If the exponent of the
|
|
17
|
+
* If the exponent of the bignum is in the range of the exponents
|
|
14
18
|
* for machine numbers,return true.
|
|
15
19
|
*/
|
|
16
20
|
export declare function isInMachineRange(d: Decimal): boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
|
+
import Decimal from 'decimal.js';
|
|
3
|
+
import { BoxedExpression } from '../public';
|
|
4
|
+
export declare const MACHINE_PRECISION_BITS = 53;
|
|
2
5
|
export declare const MACHINE_PRECISION: number;
|
|
3
6
|
export declare const MACHINE_TOLERANCE_BITS = 7;
|
|
4
7
|
export declare const MACHINE_TOLERANCE: number;
|
|
@@ -25,13 +28,14 @@ export declare function primeFactors(n: number): {
|
|
|
25
28
|
*/
|
|
26
29
|
export declare function factorPower(n: number, exponent: number): [factor: number, root: number];
|
|
27
30
|
export declare function gcd(a: number, b: number): number;
|
|
28
|
-
export declare function rationalGcd([a, b]: [number, number], [c, d]: [number, number]): [number, number];
|
|
29
31
|
export declare function lcm(a: number, b: number): number;
|
|
30
|
-
export declare function rationalLcm([a, b]: [number, number], [c, d]: [number, number]): [number, number];
|
|
31
|
-
export declare function reducedRational([a, b]: [number, number]): [number, number];
|
|
32
32
|
export declare function factorial(n: number): number;
|
|
33
33
|
export declare function lngamma(z: number): number;
|
|
34
34
|
export declare function gamma(z: number): number;
|
|
35
35
|
export declare function fromDigits(s: string, base?: number): [value: number, rest: string];
|
|
36
|
-
|
|
37
|
-
export declare function
|
|
36
|
+
export declare function asFloat(expr: BoxedExpression): number | null;
|
|
37
|
+
export declare function asBignum(expr: BoxedExpression): Decimal | null;
|
|
38
|
+
export declare function asSmallInteger(expr: BoxedExpression): number | null;
|
|
39
|
+
export declare function chop(n: number, tolerance: number): number;
|
|
40
|
+
export declare function chop(n: Decimal, tolerance: number): 0 | Decimal;
|
|
41
|
+
export declare function chop(n: Complex, tolerance: number): 0 | Complex;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.9.0 */
|
|
2
2
|
export declare function isPrime(n: number): boolean | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* 0.9.0 */
|
|
2
|
+
import Decimal from 'decimal.js';
|
|
3
|
+
export declare function isRational(x: any | null): x is Rational;
|
|
4
|
+
export declare function isMachineRational(x: any | null): x is [number, number];
|
|
5
|
+
export declare function isBigRational(x: any | null): x is [Decimal, Decimal];
|
|
6
|
+
export declare function isRationalZero(x: Rational): boolean;
|
|
7
|
+
export declare function isRationalOne(x: Rational): boolean;
|
|
8
|
+
export declare function isRationalNegativeOne(x: Rational): boolean;
|
|
9
|
+
export declare function machineNumerator(x: Rational): number;
|
|
10
|
+
export declare function machineDenominator(x: Rational): number;
|
|
11
|
+
export declare function isNeg(lhs: Rational): boolean;
|
|
12
|
+
export declare function neg(lhs: [number, number]): [number, number];
|
|
13
|
+
export declare function neg(lhs: [Decimal, Decimal]): [Decimal, Decimal];
|
|
14
|
+
export declare function neg(lhs: Rational): Rational;
|
|
15
|
+
export declare function inverse(lhs: [number, number]): [number, number];
|
|
16
|
+
export declare function inverse(lhs: [Decimal, Decimal]): [Decimal, Decimal];
|
|
17
|
+
export declare function inverse(lhs: Rational): Rational;
|
|
18
|
+
export declare function asRational(expr: BoxedExpression): Rational | undefined;
|
|
19
|
+
export declare function asMachineRational(r: Rational): [number, number];
|
|
20
|
+
/**
|
|
21
|
+
* Add a literal numeric value to a rational.
|
|
22
|
+
* If the rational is a bignum, this is a hint to do the calculation in bignum
|
|
23
|
+
* (no need to check `bignumPreferred()`).
|
|
24
|
+
* @param lhs
|
|
25
|
+
* @param rhs
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare function add(lhs: Rational, rhs: BoxedExpression | Rational): Rational;
|
|
29
|
+
export declare function mul(lhs: Rational, rhs: BoxedExpression | Rational): Rational;
|
|
30
|
+
export declare function pow(r: Rational, exp: number): Rational;
|
|
31
|
+
export declare function reducedRational(r: [number, number]): [number, number];
|
|
32
|
+
export declare function reducedRational(r: [Decimal, Decimal]): [Decimal, Decimal];
|
|
33
|
+
export declare function reducedRational(r: Rational): Rational;
|
|
34
|
+
/** Return a rational approximation of x */
|
|
35
|
+
export declare function rationalize(x: number): [n: number, d: number] | number;
|
|
36
|
+
/**
|
|
37
|
+
* Attempt to factor a rational coefficient `c` and a `rest` out of a
|
|
38
|
+
* canonical expression `expr` such that `ce.mul(c, rest)` is equal to `expr`.
|
|
39
|
+
*
|
|
40
|
+
* Attempts to make `rest` a positive value (i.e. pulls out negative sign).
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
* ['Multiply', 2, 'x', 3, 'a', ['Sqrt', 5]]
|
|
44
|
+
* -> [[6, 1], ['Multiply', 'x', 'a', ['Sqrt', 5]]]
|
|
45
|
+
*
|
|
46
|
+
* ['Divide', ['Multiply', 2, 'x'], ['Multiply', 3, 'y', 'a']]
|
|
47
|
+
* -> [[2, 3], ['Divide', 'x', ['Multiply, 'y', 'a']]]
|
|
48
|
+
*/
|
|
49
|
+
export declare function asCoefficient(expr: BoxedExpression): [coef: Rational, rest: BoxedExpression];
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param lhs
|
|
53
|
+
* @param rhs
|
|
54
|
+
* @returns the sign (-1, 0, 1) of the difference between `lhs` and `rhs`
|
|
55
|
+
*/
|
|
56
|
+
export declare function signDiff(lhs: BoxedExpression, rhs: BoxedExpression, tolerance?: number): -1 | 0 | 1 | undefined;
|