@cortex-js/compute-engine 0.28.0 → 0.29.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 (148) hide show
  1. package/dist/{compute-engine.js → compute-engine.cjs} +22662 -23286
  2. package/dist/compute-engine.esm.js +22672 -23296
  3. package/dist/compute-engine.min.cjs +129 -0
  4. package/dist/compute-engine.min.esm.js +47 -63
  5. package/dist/{math-json.js → math-json.cjs} +2 -2
  6. package/dist/math-json.esm.js +2 -2
  7. package/dist/{math-json.min.js → math-json.min.cjs} +2 -2
  8. package/dist/math-json.min.esm.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  11. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  12. package/dist/types/common/interruptible.d.ts +1 -1
  13. package/dist/types/common/json5.d.ts +1 -1
  14. package/dist/types/common/one-of.d.ts +2 -1
  15. package/dist/types/common/signals.d.ts +1 -2
  16. package/dist/types/common/type/boxed-type.d.ts +2 -1
  17. package/dist/types/common/type/parse.d.ts +1 -1
  18. package/dist/types/common/type/primitive.d.ts +1 -1
  19. package/dist/types/common/type/serialize.d.ts +1 -1
  20. package/dist/types/common/type/subtype.d.ts +1 -1
  21. package/dist/types/common/type/types.d.ts +102 -107
  22. package/dist/types/common/type/utils.d.ts +1 -1
  23. package/dist/types/common/utils.d.ts +1 -1
  24. package/dist/types/compute-engine/assume.d.ts +1 -1
  25. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +11 -14
  26. package/dist/types/compute-engine/boxed-expression/apply.d.ts +2 -2
  27. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +3 -3
  28. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +27 -0
  29. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +2 -2
  30. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  31. package/dist/types/compute-engine/boxed-expression/box.d.ts +5 -5
  32. package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +12 -13
  33. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +4 -7
  34. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +6 -8
  35. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +2 -2
  36. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +2 -3
  37. package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +2 -2
  38. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +6 -7
  39. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +5 -8
  40. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  41. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  42. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  43. package/dist/types/compute-engine/boxed-expression/expand.d.ts +3 -3
  44. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  45. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -3
  46. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  47. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  48. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  49. package/dist/types/compute-engine/boxed-expression/negate.d.ts +2 -2
  50. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +3 -3
  51. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  52. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  53. package/dist/types/compute-engine/boxed-expression/product.d.ts +5 -5
  54. package/dist/types/compute-engine/boxed-expression/rules.d.ts +2 -2
  55. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -3
  56. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -2
  59. package/dist/types/compute-engine/boxed-expression/terms.d.ts +2 -2
  60. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +2 -9
  61. package/dist/types/compute-engine/boxed-expression/utils.d.ts +13 -4
  62. package/dist/types/compute-engine/boxed-expression/validate.d.ts +8 -9
  63. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  64. package/dist/types/compute-engine/compile.d.ts +2 -4
  65. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  66. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  67. package/dist/types/compute-engine/{boxed-expression/public.d.ts → global-types.d.ts} +835 -807
  68. package/dist/types/compute-engine/{compute-engine.d.ts → index.d.ts} +7 -10
  69. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  70. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  71. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  72. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  73. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  74. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  75. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  76. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  77. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  78. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  79. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  80. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  81. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  82. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +2 -2
  83. package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +2 -2
  84. package/dist/types/compute-engine/latex-syntax/parse.d.ts +2 -2
  85. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
  86. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
  87. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
  88. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  89. package/dist/types/compute-engine/latex-syntax/{public.d.ts → types.d.ts} +3 -1
  90. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -2
  91. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  92. package/dist/types/compute-engine/library/collections.d.ts +2 -2
  93. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  94. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  95. package/dist/types/compute-engine/library/core.d.ts +1 -1
  96. package/dist/types/compute-engine/library/invisible-operator.d.ts +2 -2
  97. package/dist/types/compute-engine/library/library.d.ts +3 -3
  98. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  99. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  100. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  101. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  102. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  103. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  104. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  105. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  106. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  107. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +3 -4
  108. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +3 -5
  109. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +3 -4
  110. package/dist/types/compute-engine/numeric-value/{public.d.ts → types.d.ts} +9 -5
  111. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  112. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  113. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  114. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  115. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  116. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  117. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  118. package/dist/types/compute-engine/numerics/numeric.d.ts +2 -7
  119. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  120. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -5
  121. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  122. package/dist/types/compute-engine/numerics/special-functions.d.ts +4 -4
  123. package/dist/types/compute-engine/numerics/statistics.d.ts +2 -2
  124. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  125. package/dist/types/compute-engine/numerics/types.d.ts +30 -0
  126. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  127. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  128. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  129. package/dist/types/compute-engine/{boxed-expression → tensor}/tensor-fields.d.ts +19 -18
  130. package/dist/types/compute-engine/tensor/tensors.d.ts +9 -12
  131. package/dist/types/compute-engine/types.d.ts +11 -0
  132. package/dist/types/compute-engine.d.ts +3 -6
  133. package/dist/types/math-json/identifiers.d.ts +1 -1
  134. package/dist/types/math-json/types.d.ts +4 -2
  135. package/dist/types/math-json/utils.d.ts +1 -1
  136. package/dist/types/math-json.d.ts +2 -2
  137. package/package.json +7 -7
  138. package/dist/compute-engine.min.js +0 -145
  139. package/dist/types/common/buffer.d.ts +0 -9
  140. package/dist/types/common/styled-text.d.ts +0 -28
  141. package/dist/types/common/syntax-highlighter.d.ts +0 -40
  142. package/dist/types/common/terminal.d.ts +0 -19
  143. package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +0 -12
  144. package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +0 -16
  145. package/dist/types/compute-engine/debug.d.ts +0 -3
  146. package/dist/types/compute-engine/numerics/bignum.d.ts +0 -12
  147. package/dist/types/compute-engine/private.d.ts +0 -29
  148. package/dist/types/compute-engine/public.d.ts +0 -42
@@ -1,19 +1,16 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  import { Decimal } from 'decimal.js';
3
3
  import { Expression, MathJsonIdentifier, MathJsonNumber } from '../math-json/types';
4
- import type { LibraryCategory, LatexDictionaryEntry, LatexString, ParseLatexOptions } from './latex-syntax/public';
5
- import { AssumeResult, BoxedFunctionDefinition, BoxedSymbolDefinition, IComputeEngine, IdentifierDefinitions, ExpressionMapInterface, RuntimeScope, Scope, SymbolDefinition, BoxedRuleSet, Rule, ComputeEngineStats, Metadata, FunctionDefinition, BoxedSubstitution, AssignValue, AngularUnit, CanonicalOptions } from './public';
6
- import { Rational } from './numerics/rationals';
4
+ import { SymbolDefinition, FunctionDefinition, AngularUnit, AssignValue, AssumeResult, BoxedExpression, BoxedFunctionDefinition, BoxedRule, BoxedRuleSet, BoxedSubstitution, BoxedSymbolDefinition, CanonicalOptions, ComputeEngineStats, EvaluateOptions, ExpressionMapInterface, IdentifierDefinitions, Metadata, Rule, RuntimeScope, Scope, SemiBoxedExpression, ComputeEngine as IComputeEngine } from './global-types';
5
+ import type { BigNum, Rational } from './numerics/types';
7
6
  import { type IndexedLatexDictionary } from './latex-syntax/dictionary/definitions';
8
- import { BoxedExpression, BoxedRule, EvaluateOptions, SemiBoxedExpression } from './boxed-expression/public';
9
7
  import './boxed-expression/serialize';
10
- import { ExactNumericValueData, NumericValue, NumericValueData } from './numeric-value/public';
8
+ import { ExactNumericValueData, NumericValue, NumericValueData } from './numeric-value/types';
9
+ import type { LatexDictionaryEntry, LatexString, LibraryCategory, ParseLatexOptions } from './latex-syntax/types';
10
+ import type { OneOf } from '../common/one-of';
11
11
  import { Type, TypeString } from '../common/type/types';
12
- import { OneOf } from '../common/one-of';
13
- import { BigNum } from './numerics/bignum';
14
12
  import { BoxedType } from '../common/type/boxed-type';
15
- export type * from '../common/type/types';
16
- export * from '../common/type/subtype';
13
+ export * from './global-types';
17
14
  /**
18
15
  *
19
16
  * To use the Compute Engine, create a `ComputeEngine` instance:
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_ARITHMETIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_CALCULUS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_COMPLEX: LatexDictionary;
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_CORE: LatexDictionary;
3
3
  export declare const DELIMITERS_SHORTHAND: {
4
4
  '(': string;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_LINEAR_ALGEBRA: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_LOGIC: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_OTHERS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_INEQUALITIES: LatexDictionaryEntry[];
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_SETS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_STATISTICS: LatexDictionary;
@@ -1,3 +1,3 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const SYMBOLS: [string, string, number][];
3
3
  export declare const DEFINITIONS_SYMBOLS: LatexDictionary;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFINITIONS_TRIGONOMETRY: LatexDictionary;
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { Delimiter, EnvironmentParseHandler, ExpressionParseHandler, InfixParseHandler, LatexDictionary, LatexDictionaryEntry, LatexString, LatexToken, LibraryCategory, MatchfixParseHandler, PostfixParseHandler, Precedence, SerializeHandler } from '../public';
1
+ /* 0.29.0 */
2
+ import { Delimiter, EnvironmentParseHandler, ExpressionParseHandler, InfixParseHandler, LatexDictionary, LatexDictionaryEntry, LatexString, LatexToken, LibraryCategory, MatchfixParseHandler, PostfixParseHandler, Precedence, SerializeHandler } from '../types';
3
3
  export type CommonEntry = {
4
4
  /** Note: a name is required if a serialize handler is provided */
5
5
  name?: string;
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { Parser } from './public';
1
+ /* 0.29.0 */
2
+ import { Parser } from './types';
3
3
  /** For error handling, if we have a identifier prefix, assume
4
4
  * the identifier is invalid (it would have been captured by
5
5
  * `matchIdentifier()` otherwise) and return an error expression */
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { ParseLatexOptions, LatexToken, Terminator, Parser, SymbolTable, SymbolType } from './public';
1
+ /* 0.29.0 */
2
+ import { ParseLatexOptions, LatexToken, Terminator, Parser, SymbolTable, SymbolType } from './types';
3
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry, IndexedInfixEntry, IndexedPostfixEntry, IndexedPrefixEntry, IndexedSymbolEntry, IndexedExpressionEntry, IndexedFunctionEntry } from './dictionary/definitions';
4
4
  /**
5
5
  * ## THEORY OF OPERATIONS
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { NumberSerializationFormat } from './public';
1
+ /* 0.29.0 */
2
+ import { NumberSerializationFormat } from './types';
3
3
  /**
4
4
  * @param expr - A number, can be represented as a string
5
5
  * (particularly useful for arbitrary precision numbers) or a number (-12.45)
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { DelimiterScale } from './public';
1
+ /* 0.29.0 */
2
+ import { DelimiterScale } from './types';
3
3
  export declare function getApplyFunctionStyle(_expr: Expression, _level: number): DelimiterScale;
4
4
  export declare function getGroupStyle(_expr: Expression, _level: number): DelimiterScale;
5
5
  export declare function getRootStyle(_expr: Expression | null, level: number): 'radical' | 'quotient' | 'solidus';
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { LatexString, SerializeLatexOptions, DelimiterScale } from './public';
1
+ /* 0.29.0 */
2
+ import { LatexString, SerializeLatexOptions, DelimiterScale } from './types';
3
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
4
4
  export declare class Serializer {
5
5
  options: Readonly<SerializeLatexOptions>;
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.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}
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  import type { Expression, MathJsonIdentifier } from '../../math-json/types';
3
3
  import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
4
4
  export type SymbolType = 'symbol' | 'function' | 'unknown';
@@ -375,6 +375,7 @@ export declare function isEnvironmentEntry(entry: LatexDictionaryEntry): entry i
375
375
  export type LatexDictionary = ReadonlyArray<Partial<LatexDictionaryEntry>>;
376
376
  /**
377
377
  * These options control how numbers are parsed and serialized.
378
+ * @category Serialization
378
379
  */
379
380
  export type NumberFormat = {
380
381
  positiveInfinity: LatexString;
@@ -432,6 +433,7 @@ export type NumberFormat = {
432
433
  truncationMarker: LatexString;
433
434
  repeatingDecimal: 'auto' | 'vinculum' | 'dots' | 'parentheses' | 'arc' | 'none';
434
435
  };
436
+ /** @category Serialization */
435
437
  export type NumberSerializationFormat = NumberFormat & {
436
438
  /**
437
439
  * The maximum number of significant digits in serialized numbers.
@@ -1,5 +1,4 @@
1
- /* 0.28.0 */
2
- import { BoxedExpression } from '../boxed-expression/public';
1
+ /* 0.29.0 */
3
2
  export type CanonicalArithmeticOperators = 'Add' | 'Negate' | 'Multiply' | 'Divide' | 'Power' | 'Sqrt' | 'Root' | 'Ln';
4
3
  export declare const ARITHMETIC_LIBRARY: IdentifierDefinitions[];
5
4
  export declare function isPrime(expr: BoxedExpression): boolean | undefined;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const CALCULUS_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const DEFAULT_LINSPACE_COUNT = 50;
3
3
  export declare const COLLECTIONS_LIBRARY: IdentifierDefinitions;
4
4
  /**
@@ -24,4 +24,4 @@ export declare function rangeLast(r: [lower: number, upper: number, step: number
24
24
  */
25
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;
27
+ export declare function canonicalDictionary(engine: ComputeEngine, dict: BoxedExpression): BoxedExpression;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const COMPLEX_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const CONTROL_STRUCTURES_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const CORE_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function canonicalInvisibleOperator(ops: ReadonlyArray<BoxedExpression>, { engine: ce }: {
3
- engine: IComputeEngine;
3
+ engine: ComputeEngine;
4
4
  }): BoxedExpression | null;
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { IComputeEngine, IdentifierDefinitions } from '../public';
1
+ /* 0.29.0 */
2
+ import type { IdentifierDefinitions, ComputeEngine } from '../global-types';
3
3
  export declare function getStandardLibrary(categories: LibraryCategory[] | LibraryCategory | 'all'): readonly IdentifierDefinitions[];
4
4
  export declare const LIBRARIES: {
5
5
  [category in LibraryCategory]?: IdentifierDefinitions | IdentifierDefinitions[];
@@ -14,4 +14,4 @@ export declare const LIBRARIES: {
14
14
  * or function name that has not yet been added to the symbol table.
15
15
  *
16
16
  */
17
- export declare function setIdentifierDefinitions(engine: IComputeEngine, table: IdentifierDefinitions): void;
17
+ export declare function setIdentifierDefinitions(engine: ComputeEngine, table: IdentifierDefinitions): void;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const LINEAR_ALGEBRA_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const LOGIC_LIBRARY: IdentifierDefinitions;
3
3
  export declare function simplifyLogicFunction(x: BoxedExpression): {
4
4
  value: BoxedExpression;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const POLYNOMIALS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function randomExpression(level?: number): Expression;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const RELOP_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const SETS_LIBRARY: IdentifierDefinitions;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const STATISTICS_LIBRARY: IdentifierDefinitions[];
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const TRIGONOMETRY_LIBRARY: IdentifierDefinitions[];
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export type IndexingSet = {
3
3
  index: string | undefined;
4
4
  lower: number;
@@ -1,10 +1,9 @@
1
- /* 0.28.0 */
2
- import { NumericValue, NumericValueData } from './public';
1
+ /* 0.29.0 */
2
+ import { BigNumFactory, NumericValue, NumericValueData } from './types';
3
3
  import { ExactNumericValue } from './exact-numeric-value';
4
4
  import { Expression } from '../../math-json/types';
5
- import { SmallInteger } from '../numerics/numeric';
5
+ import { SmallInteger } from '../numerics/types';
6
6
  import { NumericType } from '../../common/type/types';
7
- export type BigNumFactory = (value: Decimal.Value) => Decimal;
8
7
  export declare class BigNumericValue extends NumericValue {
9
8
  __brand: 'BigNumericValue';
10
9
  decimal: Decimal;
@@ -1,9 +1,7 @@
1
- /* 0.28.0 */
2
- import { SmallInteger } from '../numerics/numeric';
3
- import { Rational } from '../numerics/rationals';
4
- import { ExactNumericValueData, NumericValue, NumericValueFactory } from './public';
1
+ /* 0.29.0 */
2
+ import { Rational, SmallInteger } from '../numerics/types';
3
+ import { BigNumFactory, ExactNumericValueData, NumericValue, NumericValueFactory } from './types';
5
4
  import { Expression } from '../../math-json/types';
6
- import { BigNumFactory } from './big-numeric-value';
7
5
  import { NumericType } from '../../common/type/types';
8
6
  /**
9
7
  * An ExactNumericValue is the sum of a Gaussian imaginary and the product of
@@ -1,9 +1,8 @@
1
- /* 0.28.0 */
2
- import { NumericValue, NumericValueData } from './public';
1
+ /* 0.29.0 */
2
+ import { BigNumFactory, NumericValue, NumericValueData } from './types';
3
3
  import type { Expression } from '../../math-json/types';
4
- import { SmallInteger } from '../numerics/numeric';
4
+ import type { SmallInteger } from '../numerics/types';
5
5
  import { NumericType } from '../../common/type/types';
6
- import { BigNumFactory } from './big-numeric-value';
7
6
  export declare class MachineNumericValue extends NumericValue {
8
7
  __brand: 'MachineNumericValue';
9
8
  decimal: number;
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  *
3
3
  * ## THEORY OF OPERATIONS
4
4
  *
@@ -23,20 +23,24 @@
23
23
  * A float numeric value is never converted to an exact one.
24
24
  *
25
25
  */
26
- import Decimal from 'decimal.js';
27
- import { SmallInteger } from '../numerics/numeric';
28
- import { Rational } from '../numerics/rationals';
26
+ import { Decimal } from 'decimal.js';
27
+ import type { Rational, SmallInteger } from '../numerics/types';
29
28
  import { NumericType } from '../../common/type/types';
30
- /** The value is equal to `(decimal * rational * sqrt(radical)) + im * i` */
29
+ export type BigNumFactory = (value: Decimal.Value) => Decimal;
30
+ /** The value is equal to `(decimal * rational * sqrt(radical)) + im * i`
31
+ * @category Numerics */
31
32
  export type ExactNumericValueData = {
32
33
  rational?: Rational;
33
34
  radical?: number;
34
35
  };
36
+ /** @category Numerics */
35
37
  export type NumericValueData = {
36
38
  re?: Decimal | number;
37
39
  im?: number;
38
40
  };
41
+ /** @category Numerics */
39
42
  export type NumericValueFactory = (data: number | Decimal | NumericValueData) => NumericValue;
43
+ /** @category Numerics */
40
44
  export declare abstract class NumericValue {
41
45
  abstract get type(): NumericType;
42
46
  /** True if numeric value is the product of a rational and the square root of an integer.
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function bigint(a: Decimal | number | bigint | string): bigint | null;
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.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.28.0 */
1
+ /* 0.29.0 */
2
2
  /** An interval is a continuous set of real numbers */
3
3
  export type Interval = {
4
4
  start: number;
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  * Return a numerical approximation of the integral
3
3
  * of the function `f` from `a` to `b` using Monte Carlo integration.
4
4
  *
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.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)
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function gcd(a: BigNum, b: BigNum): BigNum;
3
3
  export declare function lcm(a: BigNum, b: BigNum): BigNum;
4
4
  export declare function factorial2(ce: IBigNum, n: BigNum): BigNum;
@@ -1,3 +1,3 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function gamma(c: Complex): Complex;
3
3
  export declare function gammaln(c: Complex): Complex;
@@ -1,10 +1,8 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare const MACHINE_PRECISION_BITS = 53;
3
3
  export declare const MACHINE_PRECISION: number;
4
4
  export declare const DEFAULT_TOLERANCE = 1e-10;
5
5
  export declare const SMALL_INTEGER = 1000000;
6
- type IsInteger<N extends number> = `${N}` extends `${string}.${string}` ? never : `${N}` extends `-${string}.${string}` ? never : number;
7
- export type SmallInteger = IsInteger<number>;
8
6
  /** The largest number of digits of a bigint */
9
7
  export declare const MAX_BIGINT_DIGITS = 1024;
10
8
  export declare const MAX_ITERATION = 1000000;
@@ -33,9 +31,7 @@ export declare function chop(n: number, tolerance?: number): 0 | number;
33
31
  * The formula for the 8th-order centered difference approximation for the
34
32
  * first derivative is given by:
35
33
  *
36
- * \[
37
- * f'(x) \approx \frac{1}{280h} \left[ -f(x-4h) + \frac{4}{3}f(x-3h) - \frac{1}{5}f(x-2h) + \frac{8}{5}f(x-h) - \frac{8}{5}f(x+h) + \frac{1}{5}f(x+2h) - \frac{4}{3}f(x+3h) + f(x+4h) \right]
38
- * \]
34
+ * $$ f'(x) \approx \frac{1}{280h} \left[ -f(x-4h) + \frac{4}{3}f(x-3h) - \frac{1}{5}f(x-2h) + \frac{8}{5}f(x-h) - \frac{8}{5}f(x+h) + \frac{1}{5}f(x+2h) - \frac{4}{3}f(x+3h) + f(x+4h) \right]$$
39
35
  *
40
36
  * Note: Mathematica uses an 8th order approximation for the first derivative
41
37
  *
@@ -54,4 +50,3 @@ export declare function centeredDiff8thOrder(f: (number: any) => number, x: numb
54
50
  * @returns
55
51
  */
56
52
  export declare function limit(f: (x: number) => number, x: number, dir?: number): number;
57
- export {};
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function primeFactors(n: number): {
3
3
  [factor: number]: number;
4
4
  };
@@ -1,8 +1,4 @@
1
- /* 0.28.0 */
2
- /**
3
- * @category Boxed Expression
4
- */
5
- export type Rational = [SmallInteger, SmallInteger] | [bigint, bigint];
1
+ /* 0.29.0 */
6
2
  export declare function isRational(x: any | null): x is Rational;
7
3
  export declare function isMachineRational(x: any | null): x is [SmallInteger, SmallInteger];
8
4
  export declare function isBigRational(x: any | null): x is [bigint, bigint];
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
 
3
3
  Translated from https://github.com/JuliaMath/Richardson.jl/blob/master/src/Richardson.jl
4
4
 
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { BigNum } from './bignum';
1
+ /* 0.29.0 */
2
+ import type { BigNum } from './types';
3
3
  export declare function gammaln(z: number): number;
4
4
  export declare function gamma(z: number): number;
5
5
  /**
@@ -24,5 +24,5 @@ export declare function erfc(x: number): number;
24
24
  * - NIST: https://dlmf.nist.gov/7.24#i
25
25
  */
26
26
  export declare function erf(x: number): number;
27
- export declare function bigGammaln(ce: IComputeEngine, z: BigNum): BigNum;
28
- export declare function bigGamma(ce: IComputeEngine, z: BigNum): BigNum;
27
+ export declare function bigGammaln(ce: ComputeEngine, z: BigNum): BigNum;
28
+ export declare function bigGamma(ce: ComputeEngine, z: BigNum): BigNum;
@@ -1,5 +1,5 @@
1
- /* 0.28.0 */
2
- import { BigNum } from './bignum';
1
+ /* 0.29.0 */
2
+ import type { BigNum } from './types';
3
3
  export declare function mean(values: Iterable<number>): number;
4
4
  export declare function bigMean(bignum: BigNumFactory, values: Iterable<BigNum>): BigNum;
5
5
  export declare function median(values: Iterable<number>): number;
@@ -1,2 +1,2 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  export declare function numberToString(num: number | bigint, fractionalDigits?: number | string): string;
@@ -0,0 +1,30 @@
1
+ /* 0.29.0 */
2
+ type IsInteger<N extends number> = `${N}` extends `${string}.${string}` ? never : `${N}` extends `-${string}.${string}` ? never : number;
3
+ /** A `SmallInteger` is an integer < 1e6
4
+ * @category Numerics
5
+ */
6
+ export type SmallInteger = IsInteger<number>;
7
+ /**
8
+ * A rational number is a number that can be expressed as the quotient or fraction p/q of two integers,
9
+ * a numerator p and a non-zero denominator q.
10
+ *
11
+ * A rational can either be represented as a pair of small integers or
12
+ * a pair of big integers.
13
+ *
14
+ * @category Numerics
15
+ */
16
+ export type Rational = [SmallInteger, SmallInteger] | [bigint, bigint];
17
+ /** @category Numerics */
18
+ export type BigNum = Decimal;
19
+ /** @category Numerics */
20
+ export interface IBigNum {
21
+ readonly _BIGNUM_NAN: BigNum;
22
+ readonly _BIGNUM_ZERO: BigNum;
23
+ readonly _BIGNUM_ONE: BigNum;
24
+ readonly _BIGNUM_TWO: BigNum;
25
+ readonly _BIGNUM_HALF: BigNum;
26
+ readonly _BIGNUM_PI: BigNum;
27
+ readonly _BIGNUM_NEGATIVE_ONE: BigNum;
28
+ bignum(value: string | number | bigint | BigNum): BigNum;
29
+ }
30
+ export {};
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  /**
3
3
  *
4
4
  * @param fn The function to differentiate, a `["Function"]` expression or
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  /**
3
3
  *
4
4
  */
@@ -1,4 +1,4 @@
1
- /* 0.28.0 */
1
+ /* 0.29.0 */
2
2
  /**
3
3
  * @todo: a set to "tidy" an expression. Different from a canonical form, but
4
4
  * inline with the user's expectations.