mathjs 11.3.2 → 11.4.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/HISTORY.md +25 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesLyap.generated.js +26 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesPolynomialRoot.generated.js +42 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSchur.generated.js +30 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSylvester.generated.js +46 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +28 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +21 -17
- package/lib/cjs/entry/pureFunctionsAny.generated.js +100 -48
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +8 -0
- package/lib/cjs/expression/embeddedDocs/function/algebra/polynomialRoot.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/sqrtm.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/lyap.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/schur.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/sylvester.js +15 -0
- package/lib/cjs/factoriesAny.js +28 -0
- package/lib/cjs/function/algebra/decomposition/schur.js +75 -0
- package/lib/cjs/function/algebra/lyap.js +57 -0
- package/lib/cjs/function/algebra/polynomialRoot.js +139 -0
- package/lib/cjs/function/algebra/simplify/wildcards.js +38 -0
- package/lib/cjs/function/algebra/simplify.js +104 -44
- package/lib/cjs/function/algebra/simplifyConstant.js +29 -12
- package/lib/cjs/function/algebra/sylvester.js +127 -0
- package/lib/cjs/function/matrix/forEach.js +1 -1
- package/lib/cjs/function/matrix/sqrtm.js +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/SparseMatrix.js +4 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesLyap.generated.js +18 -0
- package/lib/esm/entry/dependenciesAny/dependenciesPolynomialRoot.generated.js +34 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSchur.generated.js +22 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSylvester.generated.js +38 -0
- package/lib/esm/entry/dependenciesAny.generated.js +4 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +22 -18
- package/lib/esm/entry/pureFunctionsAny.generated.js +87 -39
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/algebra/polynomialRoot.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/arithmetic/sqrtm.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/lyap.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/schur.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/sylvester.js +8 -0
- package/lib/esm/factoriesAny.js +4 -0
- package/lib/esm/function/algebra/decomposition/schur.js +70 -0
- package/lib/esm/function/algebra/lyap.js +52 -0
- package/lib/esm/function/algebra/polynomialRoot.js +122 -0
- package/lib/esm/function/algebra/simplify/wildcards.js +20 -0
- package/lib/esm/function/algebra/simplify.js +105 -45
- package/lib/esm/function/algebra/simplifyConstant.js +29 -12
- package/lib/esm/function/algebra/sylvester.js +118 -0
- package/lib/esm/function/matrix/forEach.js +1 -1
- package/lib/esm/function/matrix/sqrtm.js +1 -1
- package/lib/esm/type/matrix/SparseMatrix.js +4 -2
- package/lib/esm/version.js +1 -1
- package/package.json +13 -13
- package/types/index.d.ts +85 -7
package/types/index.d.ts
CHANGED
@@ -287,8 +287,8 @@ declare namespace math {
|
|
287
287
|
interface FunctionNodeCtor {
|
288
288
|
new <TFn = SymbolNode, TArgs extends MathNode[] = MathNode[]>(
|
289
289
|
fn: TFn,
|
290
|
-
args:
|
291
|
-
): FunctionNode<
|
290
|
+
args: TArgs
|
291
|
+
): FunctionNode<TFn, TArgs>
|
292
292
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
293
293
|
onUndefinedFunction: (name: string) => any
|
294
294
|
}
|
@@ -465,6 +465,11 @@ declare namespace math {
|
|
465
465
|
R: MathCollection
|
466
466
|
}
|
467
467
|
|
468
|
+
interface SchurDecomposition {
|
469
|
+
U: MathCollection
|
470
|
+
T: MathCollection
|
471
|
+
}
|
472
|
+
|
468
473
|
interface FractionDefinition {
|
469
474
|
a: number
|
470
475
|
b: number
|
@@ -894,6 +899,22 @@ declare namespace math {
|
|
894
899
|
threshold?: number
|
895
900
|
): MathArray
|
896
901
|
|
902
|
+
/* Finds the roots of a polynomial of degree three or less. Coefficients are given constant first
|
903
|
+
* followed by linear and higher powers in order; coefficients beyond the degree of the polynomial
|
904
|
+
* need not be specified.
|
905
|
+
* @param {number|Complex} constantCoeff
|
906
|
+
* @param {number|Complex} linearCoeff
|
907
|
+
* @param {number|Complex} quadraticCoeff
|
908
|
+
* @param {number|Complex} cubicCoeff
|
909
|
+
* @returns {Array<number|Complex>} array of roots of specified polynomial
|
910
|
+
*/
|
911
|
+
polynomialRoot(
|
912
|
+
constantCoeff: number | Complex,
|
913
|
+
linearCoeff: number | Complex,
|
914
|
+
quadraticCoeff?: number | Complex,
|
915
|
+
cubicCoeff?: number | Complex
|
916
|
+
): (number | Complex)[]
|
917
|
+
|
897
918
|
/**
|
898
919
|
* Calculate the Matrix QR decomposition. Matrix A is decomposed in two
|
899
920
|
* matrices (Q, R) where Q is an orthogonal matrix and R is an upper
|
@@ -1807,6 +1828,41 @@ declare namespace math {
|
|
1807
1828
|
*/
|
1808
1829
|
expm(x: Matrix): Matrix
|
1809
1830
|
|
1831
|
+
/**
|
1832
|
+
* Solves the real-valued Sylvester equation AX-XB=C for X, where A, B and C are
|
1833
|
+
* matrices of appropriate dimensions, being A and B squared. The method used is
|
1834
|
+
* the Bartels-Stewart algorithm.
|
1835
|
+
* https://en.wikipedia.org/wiki/Sylvester_equation
|
1836
|
+
* @param A Matrix A
|
1837
|
+
* @param B Matrix B
|
1838
|
+
* @param C Matrix C
|
1839
|
+
* @returns Matrix X, solving the Sylvester equation
|
1840
|
+
*/
|
1841
|
+
sylvester(
|
1842
|
+
A: Matrix | MathArray,
|
1843
|
+
B: Matrix | MathArray,
|
1844
|
+
C: Matrix | MathArray
|
1845
|
+
): Matrix | MathArray
|
1846
|
+
|
1847
|
+
/**
|
1848
|
+
* Performs a real Schur decomposition of the real matrix A = UTU' where U is orthogonal
|
1849
|
+
* and T is upper quasi-triangular.
|
1850
|
+
* https://en.wikipedia.org/wiki/Schur_decomposition
|
1851
|
+
* @param A Matrix A
|
1852
|
+
* @returns Object containing both matrix U and T of the Schur Decomposition A=UTU'
|
1853
|
+
*/
|
1854
|
+
schur(A: Matrix | MathArray): SchurDecomposition
|
1855
|
+
|
1856
|
+
/**
|
1857
|
+
* Solves the Continuous-time Lyapunov equation AP+PA'=Q for P, where Q is a positive semidefinite
|
1858
|
+
* matrix.
|
1859
|
+
* https://en.wikipedia.org/wiki/Lyapunov_equation
|
1860
|
+
* @param A Matrix A
|
1861
|
+
* @param Q Matrix Q
|
1862
|
+
* @returns Matrix P solution to the Continuous-time Lyapunov equation AP+PA'=Q
|
1863
|
+
*/
|
1864
|
+
lyap(A: Matrix | MathArray, Q: Matrix | MathArray): Matrix | MathArray
|
1865
|
+
|
1810
1866
|
/**
|
1811
1867
|
* Create a 2-dimensional identity matrix with size m x n or n x n. The
|
1812
1868
|
* matrix has ones on the diagonal and zeros elsewhere.
|
@@ -3572,6 +3628,9 @@ declare namespace math {
|
|
3572
3628
|
invDependencies: FactoryFunctionMap
|
3573
3629
|
expmDependencies: FactoryFunctionMap
|
3574
3630
|
sqrtmDependencies: FactoryFunctionMap
|
3631
|
+
sylvesterDependencies: FactoryFunctionMap
|
3632
|
+
schurDependencies: FactoryFunctionMap
|
3633
|
+
lyapDependencies: FactoryFunctionMap
|
3575
3634
|
divideDependencies: FactoryFunctionMap
|
3576
3635
|
distanceDependencies: FactoryFunctionMap
|
3577
3636
|
intersectDependencies: FactoryFunctionMap
|
@@ -3977,8 +4036,8 @@ declare namespace math {
|
|
3977
4036
|
*/
|
3978
4037
|
forEach(
|
3979
4038
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3980
|
-
callback: (node: MathNode, path: string, parent: MathNode) =>
|
3981
|
-
):
|
4039
|
+
callback: (node: MathNode, path: string, parent: MathNode) => void
|
4040
|
+
): void
|
3982
4041
|
|
3983
4042
|
/**
|
3984
4043
|
* Transform a node. Creates a new MathNode having it’s child's be the
|
@@ -4071,8 +4130,7 @@ declare namespace math {
|
|
4071
4130
|
*/
|
4072
4131
|
traverse(
|
4073
4132
|
callback: (node: MathNode, path: string, parent: MathNode) => void
|
4074
|
-
|
4075
|
-
): any
|
4133
|
+
): void
|
4076
4134
|
}
|
4077
4135
|
|
4078
4136
|
interface Parser {
|
@@ -5273,6 +5331,26 @@ declare namespace math {
|
|
5273
5331
|
|
5274
5332
|
expm(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5275
5333
|
|
5334
|
+
/**
|
5335
|
+
* Performs a real Schur decomposition of the real matrix A = UTU' where U is orthogonal
|
5336
|
+
* and T is upper quasi-triangular.
|
5337
|
+
* https://en.wikipedia.org/wiki/Schur_decomposition
|
5338
|
+
* @returns Object containing both matrix U and T of the Schur Decomposition A=UTU'
|
5339
|
+
*/
|
5340
|
+
schur(this: MathJsChain<Matrix | MathArray>): SchurDecomposition
|
5341
|
+
|
5342
|
+
/**
|
5343
|
+
* Solves the Continuous-time Lyapunov equation AP+PA'=Q for P, where Q is a positive semidefinite
|
5344
|
+
* matrix.
|
5345
|
+
* https://en.wikipedia.org/wiki/Lyapunov_equation
|
5346
|
+
* @param Q Matrix Q
|
5347
|
+
* @returns Matrix P solution to the Continuous-time Lyapunov equation AP+PA'=Q
|
5348
|
+
*/
|
5349
|
+
lyap(
|
5350
|
+
this: MathJsChain<Matrix | MathArray>,
|
5351
|
+
Q: Matrix | MathArray
|
5352
|
+
): MathJsChain<Matrix | MathArray>
|
5353
|
+
|
5276
5354
|
/**
|
5277
5355
|
* Create a 2-dimensional identity matrix with size m x n or n x n. The
|
5278
5356
|
* matrix has ones on the diagonal and zeros elsewhere.
|
@@ -5323,7 +5401,7 @@ declare namespace math {
|
|
5323
5401
|
this: MathJsChain<T>,
|
5324
5402
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5325
5403
|
callback: (value: any, index: any, matrix: T) => void
|
5326
|
-
):
|
5404
|
+
): void
|
5327
5405
|
|
5328
5406
|
/**
|
5329
5407
|
* Calculate the inverse of a square matrix.
|