@cortex-js/compute-engine 0.24.0 → 0.25.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.
Files changed (111) hide show
  1. package/dist/compute-engine.esm.js +25479 -24875
  2. package/dist/compute-engine.js +25480 -24876
  3. package/dist/compute-engine.min.esm.js +13 -13
  4. package/dist/compute-engine.min.js +13 -13
  5. package/dist/math-json.esm.js +6 -3
  6. package/dist/math-json.js +6 -3
  7. package/dist/math-json.min.esm.js +6 -3
  8. package/dist/math-json.min.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  11. package/dist/types/common/signals.d.ts +1 -1
  12. package/dist/types/common/utils.d.ts +1 -1
  13. package/dist/types/compute-engine/assume.d.ts +1 -1
  14. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +30 -19
  15. package/dist/types/compute-engine/boxed-expression/box.d.ts +9 -9
  16. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +4 -4
  17. package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +3 -2
  18. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +2 -1
  19. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +9 -10
  20. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +5 -4
  21. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +2 -15
  22. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +3 -4
  23. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +1 -1
  24. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +7 -8
  25. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +6 -7
  26. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +2 -2
  27. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  28. package/dist/types/compute-engine/boxed-expression/factor.d.ts +11 -0
  29. package/dist/types/compute-engine/boxed-expression/match.d.ts +14 -0
  30. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +41 -0
  31. package/dist/types/compute-engine/boxed-expression/order.d.ts +6 -6
  32. package/dist/types/compute-engine/boxed-expression/public.d.ts +1964 -0
  33. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -15
  34. package/dist/types/compute-engine/boxed-expression/utils.d.ts +5 -2
  35. package/dist/types/compute-engine/boxed-expression/validate.d.ts +7 -6
  36. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  37. package/dist/types/compute-engine/compile.d.ts +2 -2
  38. package/dist/types/compute-engine/compute-engine.d.ts +83 -60
  39. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  40. package/dist/types/compute-engine/domain-utils.d.ts +3 -2
  41. package/dist/types/compute-engine/function-utils.d.ts +2 -2
  42. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  43. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  44. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  45. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  46. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  47. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  48. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  49. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  50. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -3
  51. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  52. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  53. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  54. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  55. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +5 -4
  56. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +1 -1
  57. package/dist/types/compute-engine/latex-syntax/parse.d.ts +71 -29
  58. package/dist/types/compute-engine/latex-syntax/public.d.ts +264 -252
  59. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +9 -3
  60. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  61. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +6 -11
  62. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +3 -2
  63. package/dist/types/compute-engine/library/arithmetic-add.d.ts +5 -5
  64. package/dist/types/compute-engine/library/arithmetic-divide.d.ts +2 -1
  65. package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +4 -4
  66. package/dist/types/compute-engine/library/arithmetic-power.d.ts +2 -1
  67. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  68. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  69. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  70. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  71. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  72. package/dist/types/compute-engine/library/core.d.ts +3 -2
  73. package/dist/types/compute-engine/library/domains.d.ts +1 -1
  74. package/dist/types/compute-engine/library/library.d.ts +1 -1
  75. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  76. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  77. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  78. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  79. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -2
  80. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  81. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  82. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  83. package/dist/types/compute-engine/library/utils.d.ts +2 -2
  84. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +7 -1
  85. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  86. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  87. package/dist/types/compute-engine/numerics/numeric.d.ts +7 -17
  88. package/dist/types/compute-engine/numerics/primes.d.ts +6 -1
  89. package/dist/types/compute-engine/numerics/rationals.d.ts +4 -13
  90. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  91. package/dist/types/compute-engine/numerics/terms.d.ts +7 -4
  92. package/dist/types/compute-engine/public.d.ts +3 -1839
  93. package/dist/types/compute-engine/rules.d.ts +1 -1
  94. package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
  95. package/dist/types/compute-engine/solve.d.ts +4 -3
  96. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  97. package/dist/types/compute-engine/symbolic/expand.d.ts +2 -2
  98. package/dist/types/compute-engine/symbolic/flatten.d.ts +6 -4
  99. package/dist/types/compute-engine/symbolic/negate.d.ts +1 -1
  100. package/dist/types/compute-engine/symbolic/polynomials.d.ts +1 -1
  101. package/dist/types/compute-engine/symbolic/product.d.ts +4 -3
  102. package/dist/types/compute-engine/symbolic/tensor-fields.d.ts +1 -1
  103. package/dist/types/compute-engine/symbolic/tensors.d.ts +1 -1
  104. package/dist/types/compute-engine/symbolic/utils.d.ts +5 -10
  105. package/dist/types/compute-engine.d.ts +2 -2
  106. package/dist/types/math-json/math-json-format.d.ts +3 -3
  107. package/dist/types/math-json/utils.d.ts +4 -6
  108. package/dist/types/math-json.d.ts +2 -2
  109. package/package.json +1 -1
  110. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +0 -28
  111. package/dist/types/compute-engine/numerics/factor.d.ts +0 -27
@@ -1,6 +1,12 @@
1
- /* 0.24.0 */
2
- import { NumberFormattingOptions } from './public';
3
- export declare function serializeNumber(expr: Expression | null, options: NumberFormattingOptions): string;
1
+ /* 0.25.0 */
2
+ import { NumberSerializationFormat } from './public';
3
+ /**
4
+ * @param expr - A number, can be represented as a string
5
+ * particularly useful for arbitrary precision numbers) or a number (-12.45)
6
+ * @return A textual representation of the number, formatted according to the
7
+ * `options`
8
+ */
9
+ export declare function serializeNumber(expr: Expression | null, options: NumberSerializationFormat): string;
4
10
  /**
5
11
  * `value` is a base-10 number, possibly a floating point number with an
6
12
  * exponent, i.e. "0.31415e1"
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.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;
@@ -1,15 +1,11 @@
1
- /* 0.24.0 */
2
- import { WarningSignalHandler } from '../../common/signals';
3
- import { NumberFormattingOptions, LatexString, SerializeLatexOptions, DelimiterScale } from './public';
1
+ /* 0.25.0 */
2
+ import { LatexString, SerializeLatexOptions, DelimiterScale } from './public';
4
3
  import { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
5
4
  export declare class Serializer {
6
- readonly onError: WarningSignalHandler;
7
- options: NumberFormattingOptions & SerializeLatexOptions;
5
+ options: SerializeLatexOptions;
8
6
  readonly dictionary: IndexedLatexDictionary;
9
7
  level: number;
10
- canonical: undefined | boolean;
11
- constructor(options: NumberFormattingOptions & SerializeLatexOptions, dictionary: IndexedLatexDictionary, onError: WarningSignalHandler);
12
- updateOptions(opt: Partial<NumberFormattingOptions> & Partial<SerializeLatexOptions>): void;
8
+ constructor(dictionary: IndexedLatexDictionary, options: SerializeLatexOptions);
13
9
  /**
14
10
  * Serialize the expression, and if the expression is an operator
15
11
  * of precedence less than or equal to prec, wrap it in some parens.
@@ -31,9 +27,7 @@ export declare class Serializer {
31
27
  serializeDictionary(dict: {
32
28
  [key: string]: Expression;
33
29
  }): string;
34
- serialize(expr: Expression | null, options?: {
35
- canonical?: boolean;
36
- }): LatexString;
30
+ serialize(expr: Expression | null): LatexString;
37
31
  applyFunctionStyle(expr: Expression, level: number): DelimiterScale;
38
32
  groupStyle(expr: Expression, level: number): DelimiterScale;
39
33
  rootStyle(expr: Expression, level: number): 'radical' | 'quotient' | 'solidus';
@@ -43,3 +37,4 @@ export declare class Serializer {
43
37
  numericSetStyle(expr: Expression, level: number): 'compact' | 'regular' | 'interval' | 'set-builder';
44
38
  }
45
39
  export declare function appendLatex(src: string, s: string): string;
40
+ export declare function serializeLatex(expr: Expression | null, dict: IndexedLatexDictionary, options: SerializeLatexOptions): string;
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.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}
@@ -11,7 +11,8 @@ export type Token = string;
11
11
  * @param s - A string of LaTeX. It can include comments (with the `%`
12
12
  * marker) and multiple lines.
13
13
  */
14
- export declare function tokenize(s: string, args: string[]): Token[];
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
18
  export declare function tokensToString(tokens: Token | Token[] | [Token[] | Token][]): string;
@@ -1,14 +1,14 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  /** The canonical form of `Add`:
3
3
  * - removes `0`
4
4
  * - capture complex numbers (a + ib or ai +b)
5
5
  * */
6
- export declare function canonicalAdd(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
6
+ export declare function canonicalAdd(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
7
7
  export declare function domainAdd(_ce: IComputeEngine, args: (undefined | BoxedDomain)[]): BoxedDomain | null | undefined;
8
- export declare function simplifyAdd(ce: IComputeEngine, args: BoxedExpression[]): BoxedExpression;
9
- export declare function evalAdd(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
8
+ export declare function simplifyAdd(ce: IComputeEngine, args: ReadonlyArray<BoxedExpression>): BoxedExpression;
9
+ export declare function evalAdd(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>, mode?: 'N' | 'evaluate'): BoxedExpression;
10
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;
11
+ export declare function evalSummation(ce: IComputeEngine, summationEquation: ReadonlyArray<BoxedExpression>, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
12
12
  /**
13
13
  * Return a multiple of the imaginary unit, e.g.
14
14
  * - 'ImaginaryUnit' -> 1
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  /**
3
3
  * Canonical form of 'Divide' (and 'Rational')
4
4
  * - remove denominator of 1
@@ -14,3 +14,4 @@ export declare function canonicalDivide(ce: IComputeEngine, op1: BoxedExpression
14
14
  */
15
15
  export declare function simplifyDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression | undefined;
16
16
  export declare function evalDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
17
+ export declare function evalNDivide(ce: IComputeEngine, op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  /** The canonical form of `Multiply`:
3
3
  * - remove `1`
4
4
  * - simplify the signs:
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * The ops must be canonical, the result is canonical.
11
11
  */
12
- export declare function canonicalMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
12
+ export declare function canonicalMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
13
13
  export declare function simplifyMultiply(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression;
14
- export declare function evalMultiply(ce: IComputeEngine, ops: BoxedExpression[], mode?: 'N' | 'evaluate'): BoxedExpression;
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
- export declare function evalMultiplication(ce: IComputeEngine, summationEquation: BoxedExpression[], mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
16
+ export declare function evalMultiplication(ce: IComputeEngine, summationEquation: ReadonlyArray<BoxedExpression>, mode: 'simplify' | 'N' | 'evaluate'): BoxedExpression | undefined;
@@ -1,4 +1,5 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
+ import { BoxedExpression, IComputeEngine, Metadata } from '../public';
2
3
  /**
3
4
  *
4
5
  */
@@ -1,3 +1,3 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export type CanonicalArithmeticFunctions = 'Add' | 'Negate' | 'Sqrt' | 'Multiply' | 'Divide' | 'Power' | 'Ln';
3
3
  export declare const ARITHMETIC_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
@@ -1,3 +1,3 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const DEFAULT_LINSPACE_COUNT = 50;
3
3
  export declare const COLLECTIONS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
@@ -1,3 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
+ import { BoxedExpression } from '../boxed-expression/public';
2
3
  export declare const CORE_LIBRARY: IdentifierDefinitions[];
3
- export declare function canonicalInvisibleOperator(ce: IComputeEngine, ops: BoxedExpression[]): BoxedExpression | null;
4
+ export declare function canonicalInvisibleOperator(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression | null;
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const DOMAIN_CONSTRUCTORS: string[];
3
3
  export declare const DOMAIN_ALIAS: {
4
4
  Functions: (string | string[])[];
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.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.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const LOGIC_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare function randomExpression(level?: number): Expression;
@@ -1,3 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const RELOP_LIBRARY: IdentifierDefinitions;
3
- export declare function isInequality(expr: BoxedExpression): boolean;
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const SETS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  /**
3
3
  * Assume the caller has setup a scope. The index
4
4
  * variable will be declared in that scope.
@@ -12,7 +12,7 @@
12
12
  * \sum_{i=1,j=1}^{10,10} x and returns an array of expressions
13
13
  * ["Sum","x",["Triple","i",1,10],["Triple","j",1,10]
14
14
  */
15
- export declare function MultiIndexingSet(indexingSet: BoxedExpression | undefined): BoxedExpression[] | undefined;
15
+ export declare function MultiIndexingSet(indexingSet: BoxedExpression | undefined): ReadonlyArray<BoxedExpression> | undefined;
16
16
  /**
17
17
  * Assume the caller has setup a scope. The index
18
18
  * variable will be declared in that scope.
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  import { Expression } from '../../math-json';
3
3
  export declare function bigintValue(expr: Expression | null | undefined): bigint | null;
4
4
  export declare function bigint(a: Decimal | number | bigint | string): bigint;
@@ -12,3 +12,9 @@ export declare function primeFactors(d: bigint): Map<bigint, number>;
12
12
  *
13
13
  */
14
14
  export declare function factorPower(n: bigint, exponent: number): [factor: bigint, root: bigint];
15
+ /**
16
+ * Return a, b, c such that n = a * b^c
17
+ * @param n
18
+ *
19
+ */
20
+ export declare function canonicalInteger(n: bigint): [a: bigint, b: bigint, c: bigint];
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.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;
@@ -1,3 +1,3 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  export declare function gamma(c: Complex): Complex;
3
3
  export declare function gammaln(c: Complex): Complex;
@@ -1,6 +1,5 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
  import { Decimal } from 'decimal.js';
3
- import { BoxedExpression } from '../public';
4
3
  export declare const MACHINE_PRECISION_BITS = 53;
5
4
  export declare const MACHINE_PRECISION: number;
6
5
  export declare const MACHINE_TOLERANCE_BITS = 7;
@@ -15,11 +14,12 @@ export declare const MAX_SYMBOLIC_TERMS = 200;
15
14
  */
16
15
  export declare function nextUp(x: number): number;
17
16
  export declare function nextDown(x: number): number;
18
- export declare const SMALL_PRIMES: Set<number>;
19
- export declare const LARGEST_SMALL_PRIME = 7919;
20
- export declare function primeFactors(n: number): {
21
- [factor: number]: number;
22
- };
17
+ /**
18
+ * Return a, b, c such that n = a * b^c
19
+ * @param n
20
+ *
21
+ */
22
+ export declare function canonicalInteger(n: number): [a: number, b: number, c: number];
23
23
  /** Return `[factor, root]` such that
24
24
  * pow(n, 1/exponent) = factor * pow(root, 1/exponent)
25
25
  *
@@ -33,9 +33,6 @@ export declare function factorial(n: number): number;
33
33
  export declare function factorial2(n: number): number;
34
34
  export declare function gammaln(z: number): number;
35
35
  export declare function gamma(z: number): number;
36
- export declare function asFloat(expr: BoxedExpression | undefined): number | null;
37
- export declare function asBignum(expr: BoxedExpression | undefined): Decimal | null;
38
- export declare function asSmallInteger(expr: BoxedExpression | undefined): number | null;
39
36
  export declare function chop(n: number, tolerance: number): number;
40
37
  export declare function chop(n: Decimal, tolerance: number): 0 | Decimal;
41
38
  export declare function chop(n: Complex, tolerance: number): 0 | Complex;
@@ -109,10 +106,3 @@ export declare function monteCarloEstimate(f: (x: number) => number, a: number,
109
106
  export declare function limit(f: (x: number) => number, x: number, dir?: number): number;
110
107
  export declare function fromRoman(roman: string): [result: number, rest: string];
111
108
  export declare function fromDigits(s: string, baseInput?: string | number): [result: number, rest: string];
112
- /**
113
- *
114
- * @param lhs
115
- * @param rhs
116
- * @returns the sign (-1, 0, 1) of the difference between `lhs` and `rhs`
117
- */
118
- export declare function signDiff(lhs: BoxedExpression, rhs: BoxedExpression, tolerance?: number): -1 | 0 | 1 | undefined;
@@ -1,2 +1,7 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
+ export declare const SMALL_PRIMES: Set<number>;
3
+ export declare const LARGEST_SMALL_PRIME = 7919;
4
+ export declare function primeFactors(n: number): {
5
+ [factor: number]: number;
6
+ };
2
7
  export declare function isPrime(n: number): boolean | undefined;
@@ -1,4 +1,7 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
+ * @category Boxed Expression
3
+ */
4
+ export type Rational = [number, number] | [bigint, bigint];
2
5
  export declare function isRational(x: any | null): x is Rational;
3
6
  export declare function isMachineRational(x: any | null): x is [number, number];
4
7
  export declare function isBigRational(x: any | null): x is [bigint, bigint];
@@ -15,18 +18,6 @@ export declare function neg(x: Rational): Rational;
15
18
  export declare function inverse(x: [number, number]): [number, number];
16
19
  export declare function inverse(x: [bigint, bigint]): [bigint, bigint];
17
20
  export declare function inverse(x: Rational): Rational;
18
- export declare function asRational(expr: BoxedExpression): Rational | undefined;
19
- /**
20
- * Add a literal numeric value to a rational.
21
- * If the rational is a bigint, this is a hint to do the calculation in bigint
22
- * (no need to check `bignumPreferred()`).
23
- * @param lhs
24
- * @param rhs
25
- * @returns
26
- */
27
- export declare function add(lhs: Rational, rhs: BoxedExpression | Rational): Rational;
28
- export declare function mul(lhs: Rational, rhs: BoxedExpression | Rational): Rational;
29
- export declare function div(lhs: Rational, rhs: Rational): Rational;
30
21
  export declare function pow(r: Rational, exp: number): Rational;
31
22
  export declare function sqrt(r: Rational): Rational | undefined;
32
23
  export declare function reducedRational(r: [number, number]): [number, number];
@@ -1,4 +1,4 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
2
 
3
3
  Translated from https://github.com/JuliaMath/Richardson.jl/blob/master/src/Richardson.jl
4
4
 
@@ -1,14 +1,17 @@
1
- /* 0.24.0 */
1
+ /* 0.25.0 */
2
+ import { Rational } from './rationals';
2
3
  export declare class Terms {
3
4
  private engine;
4
5
  private terms;
5
- constructor(ce: IComputeEngine, terms: BoxedExpression[]);
6
+ constructor(ce: IComputeEngine, terms: ReadonlyArray<BoxedExpression>);
6
7
  sub(term: BoxedExpression): void;
7
8
  add(term2: BoxedExpression, coef2?: Rational): void;
8
9
  find(term: BoxedExpression): number;
9
10
  /** If `exact` is true, keep exact numbers */
10
- reduceNumbers({ exact }?: {
11
+ reduceNumbers({ exact }: {
11
12
  exact: boolean;
12
13
  }): void;
13
- asExpression(): BoxedExpression;
14
+ asExpression(options: {
15
+ exact: boolean;
16
+ }): BoxedExpression;
14
17
  }