@cortex-js/compute-engine 0.15.0 → 0.16.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 +3246 -1703
- package/dist/compute-engine.js +3246 -1703
- package/dist/compute-engine.min.esm.js +3246 -1705
- package/dist/compute-engine.min.js +3246 -1705
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +15 -0
- 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 +2 -2
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +9 -12
- package/dist/types/compute-engine/boxed-expression/box.d.ts +8 -3
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +6 -6
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +27 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +7 -19
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +3 -3
- 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 +11 -10
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +17 -11
- 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 +30 -9
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +1 -1
- package/dist/types/compute-engine/compute-engine.d.ts +55 -23
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/domain-utils.d.ts +4 -19
- package/dist/types/compute-engine/function-utils.d.ts +84 -0
- 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-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-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +2 -2
- 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 +19 -5
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-divide.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-multiply.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +3 -2
- package/dist/types/compute-engine/library/calculus.d.ts +2 -2
- package/dist/types/compute-engine/library/collections.d.ts +2 -2
- package/dist/types/compute-engine/library/complex.d.ts +2 -2
- package/dist/types/compute-engine/library/control-structures.d.ts +2 -0
- package/dist/types/compute-engine/library/core.d.ts +2 -2
- package/dist/types/compute-engine/library/domains.d.ts +7 -8
- package/dist/types/compute-engine/library/library.d.ts +5 -5
- package/dist/types/compute-engine/library/linear-algebra.d.ts +2 -0
- package/dist/types/compute-engine/library/logic.d.ts +2 -2
- package/dist/types/compute-engine/library/polynomials.d.ts +2 -2
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +2 -2
- package/dist/types/compute-engine/library/sets.d.ts +2 -2
- package/dist/types/compute-engine/library/statistics.d.ts +2 -2
- package/dist/types/compute-engine/library/trigonometry.d.ts +2 -2
- package/dist/types/compute-engine/library/utils.d.ts +3 -3
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +3 -2
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +2 -2
- package/dist/types/compute-engine/numerics/numeric.d.ts +60 -2
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/public.d.ts +205 -91
- package/dist/types/compute-engine/rules.d.ts +1 -1
- package/dist/types/compute-engine/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/solve.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +6 -0
- package/dist/types/compute-engine/symbolic/expand.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/flatten.d.ts +1 -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 +1 -1
- package/dist/types/compute-engine/symbolic/sum.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 +23 -21
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.16.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
5
|
export declare function factorial(ce: IComputeEngine, n: Decimal): Decimal;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function factorial2(ce: IComputeEngine, n: Decimal): Decimal;
|
|
7
|
+
export declare function gammaln(ce: IComputeEngine, z: Decimal): Decimal;
|
|
7
8
|
export declare function gamma(ce: IComputeEngine, z: Decimal): Decimal;
|
|
8
9
|
/**
|
|
9
10
|
* If the exponent of the bignum is in the range of the exponents
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.16.0 */
|
|
2
2
|
export declare function gamma(c: Complex): Complex;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function gammaln(c: Complex): Complex;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.16.0 */
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import { BoxedExpression } from '../public';
|
|
4
4
|
export declare const MACHINE_PRECISION_BITS = 53;
|
|
@@ -30,7 +30,8 @@ export declare function factorPower(n: number, exponent: number): [factor: numbe
|
|
|
30
30
|
export declare function gcd(a: number, b: number): number;
|
|
31
31
|
export declare function lcm(a: number, b: number): number;
|
|
32
32
|
export declare function factorial(n: number): number;
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function factorial2(n: number): number;
|
|
34
|
+
export declare function gammaln(z: number): number;
|
|
34
35
|
export declare function gamma(z: number): number;
|
|
35
36
|
export declare function fromDigits(s: string, base?: number): [value: number, rest: string];
|
|
36
37
|
export declare function asFloat(expr: BoxedExpression): number | null;
|
|
@@ -39,4 +40,61 @@ export declare function asSmallInteger(expr: BoxedExpression): number | null;
|
|
|
39
40
|
export declare function chop(n: number, tolerance: number): number;
|
|
40
41
|
export declare function chop(n: Decimal, tolerance: number): 0 | Decimal;
|
|
41
42
|
export declare function chop(n: Complex, tolerance: number): 0 | Complex;
|
|
43
|
+
/**
|
|
44
|
+
* An approximation of the gaussian error function, Erf(), using
|
|
45
|
+
* Abramowitz and Stegun approximation.
|
|
46
|
+
*
|
|
47
|
+
* Thoughts for future improvements:
|
|
48
|
+
* - https://math.stackexchange.com/questions/321569/approximating-the-error-function-erf-by-analytical-functions
|
|
49
|
+
* - https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions
|
|
50
|
+
|
|
51
|
+
*
|
|
52
|
+
* References:
|
|
53
|
+
* - NIST: https://dlmf.nist.gov/7.24#i
|
|
54
|
+
*/
|
|
42
55
|
export declare function erf(x: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* Trivial function, used when compiling.
|
|
58
|
+
*/
|
|
59
|
+
export declare function erfc(x: number): number;
|
|
60
|
+
/**
|
|
61
|
+
* Inverse Error Function.
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
export declare function erfInv(x: number): number;
|
|
65
|
+
/**
|
|
66
|
+
* An 8th-order centered difference approximation can be used to get a highly
|
|
67
|
+
* accurate approximation of the first derivative of a function.
|
|
68
|
+
* The formula for the 8th-order centered difference approximation for the
|
|
69
|
+
* first derivative is given by:
|
|
70
|
+
*
|
|
71
|
+
* \[
|
|
72
|
+
* f'(x) \approx \frac{-f(x-4h) + 9f(x-3h) - 45f(x-2h) + 186f(x-h) - 186f(x+h) + 45f(x+2h) - 9f(x+3h) + f(x+4h)}{60h}
|
|
73
|
+
* \]
|
|
74
|
+
*
|
|
75
|
+
* Note: Mathematica uses an 8th order approximation for the first derivative
|
|
76
|
+
*
|
|
77
|
+
* f: the function
|
|
78
|
+
* x: the point at which to approximate the derivative
|
|
79
|
+
* h: the step size
|
|
80
|
+
*/
|
|
81
|
+
export declare function centeredDiff8thOrder(f: (number: any) => number, x: number, h?: number): number;
|
|
82
|
+
/**
|
|
83
|
+
* Return a numerical approximation of the integral
|
|
84
|
+
* of the function `f` from `a` to `b` using Monte Carlo integration.
|
|
85
|
+
*
|
|
86
|
+
* Thoughts for future improvements:
|
|
87
|
+
* - use a MISER algorithm to improve the accuracy
|
|
88
|
+
* - use a stratified sampling to improve the accuracy
|
|
89
|
+
* - use a quasi-Monte Carlo method to improve the accuracy
|
|
90
|
+
* - use a Markov Chain Monte Carlo method to improve the accuracy
|
|
91
|
+
* - use a Metropolis-Hastings algorithm to improve the accuracy
|
|
92
|
+
* - use a Hamiltonian Monte Carlo algorithm to improve the accuracy
|
|
93
|
+
* - use a Gibbs sampling algorithm to improve the accuracy
|
|
94
|
+
*
|
|
95
|
+
*
|
|
96
|
+
* See:
|
|
97
|
+
* - https://64.github.io/monte-carlo/
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
export declare function monteCarloEstimate(f: (x: number) => number, a: number, b: number, n?: number): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* 0.
|
|
1
|
+
/* 0.16.0 */
|
|
2
2
|
export declare function isPrime(n: number): boolean | undefined;
|