mathjs 10.5.3 → 10.6.2
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 +29 -0
- package/lib/browser/math.js +6 -5
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesFft.generated.js +41 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesIfft.generated.js +29 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +16 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +66 -64
- package/lib/cjs/entry/pureFunctionsAny.generated.js +189 -171
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/fft.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/ifft.js +15 -0
- package/lib/cjs/factoriesAny.js +16 -0
- package/lib/cjs/function/algebra/derivative.js +1 -1
- package/lib/cjs/function/matrix/fft.js +128 -0
- package/lib/cjs/function/matrix/ifft.js +49 -0
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesFft.generated.js +24 -0
- package/lib/esm/entry/dependenciesAny/dependenciesIfft.generated.js +16 -0
- package/lib/esm/entry/dependenciesAny.generated.js +2 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +63 -61
- package/lib/esm/entry/pureFunctionsAny.generated.js +161 -145
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +4 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/fft.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/ifft.js +8 -0
- package/lib/esm/factoriesAny.js +2 -0
- package/lib/esm/function/algebra/derivative.js +1 -1
- package/lib/esm/function/matrix/fft.js +104 -0
- package/lib/esm/function/matrix/ifft.js +38 -0
- package/lib/esm/version.js +1 -1
- package/package.json +19 -16
- package/types/index.d.ts +1072 -308
- package/types/index.ts +763 -7
package/types/index.d.ts
CHANGED
@@ -161,6 +161,10 @@ declare namespace math {
|
|
161
161
|
isHexDigit(c: string): boolean
|
162
162
|
}
|
163
163
|
|
164
|
+
interface NodeCtor {
|
165
|
+
new (): Node
|
166
|
+
}
|
167
|
+
|
164
168
|
interface AccessorNode extends MathNodeCommon {
|
165
169
|
type: 'AccessorNode'
|
166
170
|
isAccessorNode: true
|
@@ -276,32 +280,77 @@ declare namespace math {
|
|
276
280
|
new (properties: Record<string, MathNode>): ObjectNode
|
277
281
|
}
|
278
282
|
|
279
|
-
|
283
|
+
type OperatorNodeMap = {
|
284
|
+
xor: 'xor'
|
285
|
+
and: 'and'
|
286
|
+
bitOr: '|'
|
287
|
+
bitXor: '^|'
|
288
|
+
bitAnd: '&'
|
289
|
+
equal: '=='
|
290
|
+
unequal: '!='
|
291
|
+
smaller: '<'
|
292
|
+
larger: '>'
|
293
|
+
smallerEq: '<='
|
294
|
+
leftShift: '<<'
|
295
|
+
rightArithShift: '>>'
|
296
|
+
rightLogShift: '>>>'
|
297
|
+
to: 'to'
|
298
|
+
add: '+'
|
299
|
+
subtract: '-'
|
300
|
+
multiply: '*'
|
301
|
+
divide: '/'
|
302
|
+
dotMultiply: '.*'
|
303
|
+
dotDivide: './'
|
304
|
+
mod: 'mod'
|
305
|
+
unaryPlus: '+'
|
306
|
+
unaryMinus: '-'
|
307
|
+
bitNot: '~'
|
308
|
+
not: 'not'
|
309
|
+
pow: '^'
|
310
|
+
dotPow: '.^'
|
311
|
+
factorial: '!'
|
312
|
+
}
|
313
|
+
|
314
|
+
type OperatorNodeOp = OperatorNodeMap[keyof OperatorNodeMap]
|
315
|
+
type OperatorNodeFn = keyof OperatorNodeMap
|
316
|
+
|
317
|
+
interface OperatorNode<
|
318
|
+
TOp extends OperatorNodeMap[TFn] = never,
|
319
|
+
TFn extends OperatorNodeFn = never,
|
320
|
+
TArgs extends MathNode[] = MathNode[]
|
321
|
+
> extends MathNodeCommon {
|
280
322
|
type: 'OperatorNode'
|
281
323
|
isOperatorNode: true
|
282
|
-
op:
|
283
|
-
fn:
|
284
|
-
args:
|
324
|
+
op: TOp
|
325
|
+
fn: TFn
|
326
|
+
args: TArgs
|
285
327
|
implicit: boolean
|
286
328
|
isUnary(): boolean
|
287
329
|
isBinary(): boolean
|
288
330
|
}
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
331
|
+
|
332
|
+
interface OperatorNodeCtor extends MathNodeCommon {
|
333
|
+
new <
|
334
|
+
TOp extends OperatorNodeMap[TFn],
|
335
|
+
TFn extends OperatorNodeFn,
|
336
|
+
TArgs extends MathNode[]
|
337
|
+
>(
|
338
|
+
op: TOp,
|
339
|
+
fn: TFn,
|
340
|
+
args: TArgs,
|
294
341
|
implicit?: boolean
|
295
|
-
): OperatorNode
|
342
|
+
): OperatorNode<TOp, TFn, TArgs>
|
296
343
|
}
|
297
|
-
|
298
|
-
|
344
|
+
interface ParenthesisNode<TContent extends MathNode = MathNode>
|
345
|
+
extends MathNodeCommon {
|
299
346
|
type: 'ParenthesisNode'
|
300
347
|
isParenthesisNode: true
|
301
|
-
content:
|
348
|
+
content: TContent
|
302
349
|
}
|
303
350
|
interface ParenthesisNodeCtor {
|
304
|
-
new
|
351
|
+
new <TContent extends MathNode>(
|
352
|
+
content: TContent
|
353
|
+
): ParenthesisNode<TContent>
|
305
354
|
}
|
306
355
|
|
307
356
|
interface RangeNode extends MathNodeCommon {
|
@@ -345,7 +394,7 @@ declare namespace math {
|
|
345
394
|
| FunctionNode
|
346
395
|
| IndexNode
|
347
396
|
| ObjectNode
|
348
|
-
| OperatorNode
|
397
|
+
| OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
349
398
|
| ParenthesisNode
|
350
399
|
| RangeNode
|
351
400
|
| RelationalNode
|
@@ -353,6 +402,26 @@ declare namespace math {
|
|
353
402
|
|
354
403
|
type MathJsFunctionName = keyof MathJsStatic
|
355
404
|
|
405
|
+
interface LUDecomposition {
|
406
|
+
L: MathCollection
|
407
|
+
U: MathCollection
|
408
|
+
p: number[]
|
409
|
+
}
|
410
|
+
|
411
|
+
interface SLUDecomposition extends LUDecomposition {
|
412
|
+
q: number[]
|
413
|
+
}
|
414
|
+
|
415
|
+
interface QRDecomposition {
|
416
|
+
Q: MathCollection
|
417
|
+
R: MathCollection
|
418
|
+
}
|
419
|
+
|
420
|
+
interface FractionDefinition {
|
421
|
+
a: number
|
422
|
+
b: number
|
423
|
+
}
|
424
|
+
|
356
425
|
interface MathJsStatic extends FactoryDependencies {
|
357
426
|
e: number
|
358
427
|
pi: number
|
@@ -369,6 +438,7 @@ declare namespace math {
|
|
369
438
|
tau: number
|
370
439
|
|
371
440
|
// Class-like constructors
|
441
|
+
Node: NodeCtor
|
372
442
|
AccessorNode: AccessorNodeCtor
|
373
443
|
ArrayNode: ArrayNodeCtor
|
374
444
|
AssignmentNode: AssignmentNodeCtor
|
@@ -468,9 +538,8 @@ declare namespace math {
|
|
468
538
|
* @param x A value of any type
|
469
539
|
* @returns The boolean value
|
470
540
|
*/
|
471
|
-
boolean(
|
472
|
-
|
473
|
-
): boolean | MathCollection
|
541
|
+
boolean(x: string | number | boolean | null): boolean
|
542
|
+
boolean(x: MathCollection): MathCollection
|
474
543
|
|
475
544
|
/**
|
476
545
|
* Wrap any value in a chain, allowing to perform chained operations on
|
@@ -486,7 +555,7 @@ declare namespace math {
|
|
486
555
|
* @returns The created chain
|
487
556
|
*/
|
488
557
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
489
|
-
chain(value?:
|
558
|
+
chain<TValue>(value?: TValue): MathJsChain<TValue>
|
490
559
|
|
491
560
|
/**
|
492
561
|
* Create a complex value or convert a value to a complex value.
|
@@ -540,9 +609,10 @@ declare namespace math {
|
|
540
609
|
* fraction
|
541
610
|
* @returns Returns a fraction
|
542
611
|
*/
|
543
|
-
fraction(
|
544
|
-
|
545
|
-
|
612
|
+
fraction(
|
613
|
+
value: number | string | BigNumber | Fraction | FractionDefinition
|
614
|
+
): Fraction
|
615
|
+
fraction(values: MathCollection): MathCollection
|
546
616
|
/**
|
547
617
|
* @param numerator Argument specifying the numerator of the fraction
|
548
618
|
* @param denominator Argument specifying the denominator of the
|
@@ -589,16 +659,9 @@ declare namespace math {
|
|
589
659
|
* @returns The created number
|
590
660
|
*/
|
591
661
|
number(
|
592
|
-
value?:
|
593
|
-
|
594
|
-
|
595
|
-
| BigNumber
|
596
|
-
| Fraction
|
597
|
-
| boolean
|
598
|
-
| MathCollection
|
599
|
-
| Unit
|
600
|
-
| null
|
601
|
-
): number | MathCollection
|
662
|
+
value?: string | number | BigNumber | Fraction | boolean | Unit | null
|
663
|
+
): number
|
664
|
+
number(value?: MathCollection): number | MathCollection
|
602
665
|
/**
|
603
666
|
* @param value Value to be converted
|
604
667
|
* @param valuelessUnit A valueless unit, used to convert a unit to a
|
@@ -633,7 +696,8 @@ declare namespace math {
|
|
633
696
|
* @param value A value to convert to a string
|
634
697
|
* @returns The created string
|
635
698
|
*/
|
636
|
-
string(value:
|
699
|
+
string(value: MathNumericType | string | Unit | null): string
|
700
|
+
string(value: MathCollection): MathCollection
|
637
701
|
|
638
702
|
/**
|
639
703
|
* Create a unit. Depending on the passed arguments, the function will
|
@@ -653,7 +717,8 @@ declare namespace math {
|
|
653
717
|
* @param unit The unit to be created
|
654
718
|
* @returns The created unit
|
655
719
|
*/
|
656
|
-
unit(value: number |
|
720
|
+
unit(value: number | BigNumber, unit: string): Unit
|
721
|
+
unit(value: MathCollection, unit: string): Unit[]
|
657
722
|
|
658
723
|
/*************************************************************************
|
659
724
|
* Expression functions
|
@@ -672,6 +737,7 @@ declare namespace math {
|
|
672
737
|
*/
|
673
738
|
compile(exprs: MathExpression[]): EvalFunction[]
|
674
739
|
|
740
|
+
// TODO properly type this
|
675
741
|
/**
|
676
742
|
* Evaluate an expression.
|
677
743
|
* @param expr The expression to be evaluated
|
@@ -679,10 +745,15 @@ declare namespace math {
|
|
679
745
|
* @returns The result of the expression
|
680
746
|
*/
|
681
747
|
evaluate(
|
682
|
-
expr: MathExpression |
|
748
|
+
expr: MathExpression | Matrix,
|
683
749
|
scope?: object
|
684
750
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
685
751
|
): any
|
752
|
+
evaluate(
|
753
|
+
expr: MathExpression[],
|
754
|
+
scope?: object
|
755
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
756
|
+
): any[]
|
686
757
|
|
687
758
|
/**
|
688
759
|
* Retrieve help on a function or data type. Help files are retrieved
|
@@ -729,7 +800,8 @@ declare namespace math {
|
|
729
800
|
* @param b A column vector with the b values
|
730
801
|
* @returns A column vector with the linear system solution (x)
|
731
802
|
*/
|
732
|
-
lsolve(L: Matrix
|
803
|
+
lsolve(L: Matrix, b: Matrix | MathArray): Matrix
|
804
|
+
lsolve(L: MathArray, b: Matrix | MathArray): MathArray
|
733
805
|
|
734
806
|
/**
|
735
807
|
* Calculate the Matrix LU decomposition with partial pivoting. Matrix A
|
@@ -740,11 +812,7 @@ declare namespace math {
|
|
740
812
|
* @returns The lower triangular matrix, the upper triangular matrix and
|
741
813
|
* the permutation matrix.
|
742
814
|
*/
|
743
|
-
lup(A?: Matrix | MathArray):
|
744
|
-
L: MathCollection
|
745
|
-
U: MathCollection
|
746
|
-
P: number[]
|
747
|
-
}
|
815
|
+
lup(A?: Matrix | MathArray): LUDecomposition
|
748
816
|
|
749
817
|
/**
|
750
818
|
* Solves the linear system A * x = b where A is an [n x n] matrix and b
|
@@ -759,11 +827,18 @@ declare namespace math {
|
|
759
827
|
* b
|
760
828
|
*/
|
761
829
|
lusolve(
|
762
|
-
A: Matrix
|
830
|
+
A: Matrix,
|
763
831
|
b: Matrix | MathArray,
|
764
832
|
order?: number,
|
765
833
|
threshold?: number
|
766
|
-
): Matrix
|
834
|
+
): Matrix
|
835
|
+
|
836
|
+
lusolve(
|
837
|
+
A: MathArray,
|
838
|
+
b: Matrix | MathArray,
|
839
|
+
order?: number,
|
840
|
+
threshold?: number
|
841
|
+
): MathArray
|
767
842
|
|
768
843
|
/**
|
769
844
|
* Calculate the Matrix QR decomposition. Matrix A is decomposed in two
|
@@ -773,7 +848,7 @@ declare namespace math {
|
|
773
848
|
* decomposition.
|
774
849
|
* @returns Q: the orthogonal matrix and R: the upper triangular matrix
|
775
850
|
*/
|
776
|
-
qr(A: Matrix | MathArray):
|
851
|
+
qr(A: Matrix | MathArray): QRDecomposition
|
777
852
|
|
778
853
|
rationalize(
|
779
854
|
expr: MathNode | string,
|
@@ -844,7 +919,7 @@ declare namespace math {
|
|
844
919
|
* @returns The lower triangular matrix, the upper triangular matrix and
|
845
920
|
* the permutation vectors.
|
846
921
|
*/
|
847
|
-
slu(A: Matrix, order: number, threshold: number):
|
922
|
+
slu(A: Matrix, order: number, threshold: number): SLUDecomposition
|
848
923
|
|
849
924
|
/**
|
850
925
|
* Solves the linear equation system by backward substitution. Matrix
|
@@ -853,7 +928,8 @@ declare namespace math {
|
|
853
928
|
* @param b A column vector with the b values
|
854
929
|
* @returns A column vector with the linear system solution (x)
|
855
930
|
*/
|
856
|
-
usolve(U: Matrix
|
931
|
+
usolve(U: Matrix, b: Matrix | MathArray): Matrix
|
932
|
+
usolve(U: MathArray, b: Matrix | MathArray): MathArray
|
857
933
|
|
858
934
|
/*************************************************************************
|
859
935
|
* Arithmetic functions
|
@@ -894,11 +970,9 @@ declare namespace math {
|
|
894
970
|
*/
|
895
971
|
cbrt(x: number, allRoots?: boolean): number
|
896
972
|
cbrt(x: BigNumber, allRoots?: boolean): BigNumber
|
897
|
-
cbrt(x: Fraction, allRoots?: boolean): Fraction
|
898
973
|
cbrt(x: Complex, allRoots?: boolean): Complex
|
899
974
|
cbrt(x: MathArray, allRoots?: boolean): MathArray
|
900
975
|
cbrt(x: Matrix, allRoots?: boolean): Matrix
|
901
|
-
cbrt(x: Unit, allRoots?: boolean): Unit
|
902
976
|
|
903
977
|
// Rounding functions, grouped for similarity, even though it breaks
|
904
978
|
// the alphabetic order among arithmetic functions.
|
@@ -1456,9 +1530,9 @@ declare namespace math {
|
|
1456
1530
|
* @param x A complex number or array with complex numbers
|
1457
1531
|
* @returns The imaginary part of x
|
1458
1532
|
*/
|
1459
|
-
im(
|
1460
|
-
|
1461
|
-
):
|
1533
|
+
im(x: MathJsChain<number | Complex>): MathJsChain<number>
|
1534
|
+
im(x: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
1535
|
+
im(x: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
1462
1536
|
|
1463
1537
|
/**
|
1464
1538
|
* Get the real part of a complex number. For a complex number a + bi,
|
@@ -1467,9 +1541,9 @@ declare namespace math {
|
|
1467
1541
|
* @param x A complex number or array of complex numbers
|
1468
1542
|
* @returns The real part of x
|
1469
1543
|
*/
|
1470
|
-
re(
|
1471
|
-
|
1472
|
-
):
|
1544
|
+
re(x: MathJsChain<number | Complex>): MathJsChain<number>
|
1545
|
+
re(x: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
1546
|
+
re(x: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
1473
1547
|
|
1474
1548
|
/*************************************************************************
|
1475
1549
|
* Geometry functions
|
@@ -1973,6 +2047,20 @@ declare namespace math {
|
|
1973
2047
|
*/
|
1974
2048
|
zeros(m: number, n: number, format?: string): MathCollection
|
1975
2049
|
|
2050
|
+
/**
|
2051
|
+
* Calculate N-dimensional fourier transform
|
2052
|
+
* @param {Array | Matrix} arr An array or matrix
|
2053
|
+
* @return {Array | Matrix} N-dimensional fourier transformation of the array
|
2054
|
+
*/
|
2055
|
+
fft<T extends MathCollection>(arr: T): T
|
2056
|
+
|
2057
|
+
/**
|
2058
|
+
* Calculate N-dimensional inverse fourier transform
|
2059
|
+
* @param {Array | Matrix} arr An array or matrix
|
2060
|
+
* @return {Array | Matrix} N-dimensional fourier transformation of the array
|
2061
|
+
*/
|
2062
|
+
ifft<T extends MathCollection>(arr: T): T
|
2063
|
+
|
1976
2064
|
/*************************************************************************
|
1977
2065
|
* Probability functions
|
1978
2066
|
************************************************************************/
|
@@ -2596,6 +2684,7 @@ declare namespace math {
|
|
2596
2684
|
* @returns The variance
|
2597
2685
|
*/
|
2598
2686
|
variance(...args: Array<number | BigNumber | Fraction>): number
|
2687
|
+
|
2599
2688
|
/**
|
2600
2689
|
* Compute the variance of a matrix or a list with values. In case of a
|
2601
2690
|
* (multi dimensional) array or matrix, the variance over all elements
|
@@ -3056,7 +3145,9 @@ declare namespace math {
|
|
3056
3145
|
|
3057
3146
|
isObjectNode(x: unknown): x is ObjectNode
|
3058
3147
|
|
3059
|
-
isOperatorNode(
|
3148
|
+
isOperatorNode(
|
3149
|
+
x: unknown
|
3150
|
+
): x is OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
3060
3151
|
|
3061
3152
|
isParenthesisNode(x: unknown): x is ParenthesisNode
|
3062
3153
|
|
@@ -3064,7 +3155,7 @@ declare namespace math {
|
|
3064
3155
|
|
3065
3156
|
isSymbolNode(x: unknown): x is SymbolNode
|
3066
3157
|
|
3067
|
-
isChain(x: unknown): x is MathJsChain
|
3158
|
+
isChain(x: unknown): x is MathJsChain<unknown>
|
3068
3159
|
|
3069
3160
|
/*************************************************************************
|
3070
3161
|
* Functions -> Utils
|
@@ -3076,7 +3167,7 @@ declare namespace math {
|
|
3076
3167
|
* @returns A clone of object x
|
3077
3168
|
*/
|
3078
3169
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3079
|
-
clone(x:
|
3170
|
+
clone<TType>(x: TType): TType
|
3080
3171
|
|
3081
3172
|
/**
|
3082
3173
|
* Test whether a value is an numeric value. In case of a string,
|
@@ -3202,10 +3293,12 @@ declare namespace math {
|
|
3202
3293
|
factories: FactoryFunctionMap,
|
3203
3294
|
config?: ConfigOptions
|
3204
3295
|
) => MathJsStatic
|
3205
|
-
factory: <T>(
|
3296
|
+
factory: <T, TDeps extends readonly MathJsFunctionName[]>(
|
3206
3297
|
name: string,
|
3207
|
-
dependencies:
|
3208
|
-
create: (
|
3298
|
+
dependencies: TDeps,
|
3299
|
+
create: (
|
3300
|
+
injected: Pick<MathJsStatic, Extract<MathJsFunctionName, TDeps[number]>>
|
3301
|
+
) => T,
|
3209
3302
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3210
3303
|
meta?: any
|
3211
3304
|
) => FactoryFunction<T>
|
@@ -3723,22 +3816,7 @@ declare namespace math {
|
|
3723
3816
|
interface MathNodeCommon {
|
3724
3817
|
isNode: true
|
3725
3818
|
comment: string
|
3726
|
-
type:
|
3727
|
-
| 'AccessorNode'
|
3728
|
-
| 'ArrayNode'
|
3729
|
-
| 'AssignmentNode'
|
3730
|
-
| 'BlockNode'
|
3731
|
-
| 'ConditionalNode'
|
3732
|
-
| 'ConstantNode'
|
3733
|
-
| 'FunctionAssignmentNode'
|
3734
|
-
| 'FunctionNode'
|
3735
|
-
| 'IndexNode'
|
3736
|
-
| 'ObjectNode'
|
3737
|
-
| 'OperatorNode'
|
3738
|
-
| 'ParenthesisNode'
|
3739
|
-
| 'RangeNode'
|
3740
|
-
| 'RelationalNode'
|
3741
|
-
| 'SymbolNode'
|
3819
|
+
type: string
|
3742
3820
|
|
3743
3821
|
isUpdateNode?: boolean
|
3744
3822
|
|
@@ -3746,12 +3824,12 @@ declare namespace math {
|
|
3746
3824
|
* Create a shallow clone of the node. The node itself is cloned, its
|
3747
3825
|
* childs are not cloned.
|
3748
3826
|
*/
|
3749
|
-
clone():
|
3827
|
+
clone(): this
|
3750
3828
|
/**
|
3751
3829
|
* Create a deep clone of the node. Both the node as well as all its
|
3752
3830
|
* childs are cloned recursively.
|
3753
3831
|
*/
|
3754
|
-
cloneDeep():
|
3832
|
+
cloneDeep(): this
|
3755
3833
|
/**
|
3756
3834
|
* Compile an expression into optimized JavaScript code. compile returns
|
3757
3835
|
* an object with a function evaluate([scope]) to evaluate. Example:
|
@@ -3862,9 +3940,9 @@ declare namespace math {
|
|
3862
3940
|
* transformed.toString(); // returns '(3 ^ 2) + (5 * 3)'
|
3863
3941
|
* ```
|
3864
3942
|
*/
|
3865
|
-
transform(
|
3866
|
-
callback: (node:
|
3867
|
-
):
|
3943
|
+
transform<TResult>(
|
3944
|
+
callback: (node: this, path: string, parent: MathNode) => TResult
|
3945
|
+
): TResult
|
3868
3946
|
|
3869
3947
|
/**
|
3870
3948
|
* `traverse(callback)`
|
@@ -3977,9 +4055,9 @@ declare namespace math {
|
|
3977
4055
|
randomSeed?: string | null
|
3978
4056
|
}
|
3979
4057
|
|
3980
|
-
interface MathJsChain {
|
4058
|
+
interface MathJsChain<TValue> {
|
3981
4059
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
3982
|
-
done():
|
4060
|
+
done(): TValue
|
3983
4061
|
|
3984
4062
|
/*************************************************************************
|
3985
4063
|
* Construction functions
|
@@ -3990,7 +4068,12 @@ declare namespace math {
|
|
3990
4068
|
* When a matrix is provided, all elements will be converted to
|
3991
4069
|
* BigNumber.
|
3992
4070
|
*/
|
3993
|
-
bignumber(
|
4071
|
+
bignumber(
|
4072
|
+
this: MathJsChain<
|
4073
|
+
number | string | Fraction | BigNumber | boolean | Fraction | null
|
4074
|
+
>
|
4075
|
+
): MathJsChain<BigNumber>
|
4076
|
+
bignumber<T extends MathCollection>(this: MathJsChain<T>): MathJsChain<T>
|
3994
4077
|
|
3995
4078
|
/**
|
3996
4079
|
* Create a boolean or convert a string or number to a boolean. In case
|
@@ -3998,14 +4081,21 @@ declare namespace math {
|
|
3998
4081
|
* of zero. Strings can be 'true' or 'false', or can contain a number.
|
3999
4082
|
* When value is a matrix, all elements will be converted to boolean.
|
4000
4083
|
*/
|
4001
|
-
boolean(
|
4084
|
+
boolean(
|
4085
|
+
this: MathJsChain<string | number | boolean | null>
|
4086
|
+
): MathJsChain<boolean>
|
4087
|
+
boolean(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4002
4088
|
|
4003
4089
|
/**
|
4004
4090
|
* Create a complex value or convert a value to a complex value.
|
4005
4091
|
* @param im Argument specifying the imaginary part of the complex
|
4006
4092
|
* number
|
4007
4093
|
*/
|
4008
|
-
complex(
|
4094
|
+
complex(
|
4095
|
+
this: MathJsChain<Complex | string | PolarCoordinates>,
|
4096
|
+
im?: number
|
4097
|
+
): MathJsChain<Complex>
|
4098
|
+
complex(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4009
4099
|
|
4010
4100
|
/**
|
4011
4101
|
* Create a user-defined unit and register it with the Unit type.
|
@@ -4020,9 +4110,10 @@ declare namespace math {
|
|
4020
4110
|
* 0.
|
4021
4111
|
*/
|
4022
4112
|
createUnit(
|
4113
|
+
this: MathJsChain<string>,
|
4023
4114
|
definition?: string | UnitDefinition,
|
4024
4115
|
options?: CreateUnitOptions
|
4025
|
-
): MathJsChain
|
4116
|
+
): MathJsChain<Unit>
|
4026
4117
|
/**
|
4027
4118
|
* Create a user-defined unit and register it with the Unit type.
|
4028
4119
|
* @param options (optional) An object containing any of the following
|
@@ -4033,21 +4124,31 @@ declare namespace math {
|
|
4033
4124
|
* the unit. For example, the offset for celsius is 273.15. Default is
|
4034
4125
|
* 0.
|
4035
4126
|
*/
|
4036
|
-
createUnit(
|
4127
|
+
createUnit(
|
4128
|
+
this: MathJsChain<Record<string, string | UnitDefinition>>,
|
4129
|
+
options?: CreateUnitOptions
|
4130
|
+
): MathJsChain<Unit>
|
4037
4131
|
|
4038
4132
|
/**
|
4039
4133
|
* Create a fraction convert a value to a fraction.
|
4040
4134
|
* @param denominator Argument specifying the denominator of the
|
4041
4135
|
* fraction
|
4042
4136
|
*/
|
4043
|
-
fraction(
|
4137
|
+
fraction(
|
4138
|
+
this: MathJsChain<
|
4139
|
+
number | string | BigNumber | Fraction | FractionDefinition
|
4140
|
+
>,
|
4141
|
+
denominator?: number
|
4142
|
+
): MathJsChain<Fraction>
|
4143
|
+
fraction(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4044
4144
|
|
4045
4145
|
/**
|
4046
4146
|
* Create an index. An Index can store ranges having start, step, and
|
4047
4147
|
* end for multiple dimensions. Matrix.get, Matrix.set, and math.subset
|
4048
4148
|
* accept an Index as input.
|
4049
4149
|
*/
|
4050
|
-
|
4150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4151
|
+
index(this: MathJsChain<any[]>): MathJsChain<Index>
|
4051
4152
|
|
4052
4153
|
/**
|
4053
4154
|
* Create a Matrix. The function creates a new math.type.Matrix object
|
@@ -4055,7 +4156,11 @@ declare namespace math {
|
|
4055
4156
|
* in the matrix, like getting the size and getting or setting values in
|
4056
4157
|
* the matrix. Supported storage formats are 'dense' and 'sparse'.
|
4057
4158
|
*/
|
4058
|
-
matrix(
|
4159
|
+
matrix(
|
4160
|
+
this: MathJsChain<MathCollection>,
|
4161
|
+
format?: 'sparse' | 'dense',
|
4162
|
+
dataType?: string
|
4163
|
+
): MathJsChain<Matrix>
|
4059
4164
|
|
4060
4165
|
/**
|
4061
4166
|
* Create a number or convert a string, boolean, or unit to a number.
|
@@ -4063,7 +4168,16 @@ declare namespace math {
|
|
4063
4168
|
* @param valuelessUnit A valueless unit, used to convert a unit to a
|
4064
4169
|
* number
|
4065
4170
|
*/
|
4066
|
-
number(
|
4171
|
+
number(
|
4172
|
+
this: MathJsChain<
|
4173
|
+
string | number | BigNumber | Fraction | boolean | Unit | null
|
4174
|
+
>,
|
4175
|
+
valuelessUnit?: Unit | string
|
4176
|
+
): MathJsChain<number>
|
4177
|
+
number(
|
4178
|
+
this: MathJsChain<MathCollection>,
|
4179
|
+
valuelessUnit?: Unit | string
|
4180
|
+
): MathJsChain<MathCollection>
|
4067
4181
|
|
4068
4182
|
/**
|
4069
4183
|
* Create a Sparse Matrix. The function creates a new math.type.Matrix
|
@@ -4072,20 +4186,26 @@ declare namespace math {
|
|
4072
4186
|
* values in the matrix.
|
4073
4187
|
* @param dataType Sparse Matrix data type
|
4074
4188
|
*/
|
4075
|
-
sparse(
|
4189
|
+
sparse(
|
4190
|
+
this: MathJsChain<MathCollection>,
|
4191
|
+
dataType?: string
|
4192
|
+
): MathJsChain<Matrix>
|
4076
4193
|
|
4077
4194
|
/**
|
4078
4195
|
* Split a unit in an array of units whose sum is equal to the original
|
4079
4196
|
* unit.
|
4080
4197
|
* @param parts An array of strings or valueless units
|
4081
4198
|
*/
|
4082
|
-
splitUnit(parts: Unit[]): MathJsChain
|
4199
|
+
splitUnit(this: MathJsChain<Unit>, parts: Unit[]): MathJsChain<Unit[]>
|
4083
4200
|
|
4084
4201
|
/**
|
4085
4202
|
* Create a string or convert any object into a string. Elements of
|
4086
4203
|
* Arrays and Matrices are processed element wise.
|
4087
4204
|
*/
|
4088
|
-
string(
|
4205
|
+
string(
|
4206
|
+
this: MathJsChain<MathNumericType | string | Unit | null>
|
4207
|
+
): MathJsChain<string>
|
4208
|
+
string(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4089
4209
|
|
4090
4210
|
/**
|
4091
4211
|
* Create a unit. Depending on the passed arguments, the function will
|
@@ -4093,7 +4213,13 @@ declare namespace math {
|
|
4093
4213
|
* provided, all elements will be converted to units.
|
4094
4214
|
* @param unit The unit to be created
|
4095
4215
|
*/
|
4096
|
-
unit(unit?: string): MathJsChain
|
4216
|
+
unit(this: MathJsChain<string>, unit?: string): MathJsChain<Unit>
|
4217
|
+
unit(this: MathJsChain<Unit>, unit?: string): MathJsChain<Unit>
|
4218
|
+
unit(
|
4219
|
+
this: MathJsChain<number | BigNumber>,
|
4220
|
+
unit?: string
|
4221
|
+
): MathJsChain<Unit>
|
4222
|
+
unit(this: MathJsChain<MathCollection>, unit?: string): MathJsChain<Unit[]>
|
4097
4223
|
|
4098
4224
|
/*************************************************************************
|
4099
4225
|
* Expression functions
|
@@ -4103,45 +4229,64 @@ declare namespace math {
|
|
4103
4229
|
* Parse and compile an expression. Returns a an object with a function
|
4104
4230
|
* evaluate([scope]) to evaluate the compiled expression.
|
4105
4231
|
*/
|
4106
|
-
compile(): MathJsChain
|
4232
|
+
compile(this: MathJsChain<MathExpression>): MathJsChain<EvalFunction>
|
4107
4233
|
|
4234
|
+
// TODO properly type this
|
4108
4235
|
/**
|
4109
4236
|
* Evaluate an expression.
|
4110
4237
|
* @param scope Scope to read/write variables
|
4111
4238
|
*/
|
4112
|
-
evaluate(
|
4239
|
+
evaluate(
|
4240
|
+
this: MathJsChain<MathExpression | Matrix>,
|
4241
|
+
scope?: object
|
4242
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4243
|
+
): MathJsChain<any>
|
4244
|
+
evaluate(
|
4245
|
+
this: MathJsChain<MathExpression[]>,
|
4246
|
+
scope?: object
|
4247
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4248
|
+
): MathJsChain<any[]>
|
4113
4249
|
|
4114
4250
|
/**
|
4115
4251
|
* Retrieve help on a function or data type. Help files are retrieved
|
4116
4252
|
* from the documentation in math.expression.docs.
|
4117
4253
|
*/
|
4118
|
-
help(): MathJsChain
|
4254
|
+
help(this: MathJsChain<unknown>): MathJsChain<unknown>
|
4119
4255
|
|
4120
|
-
/**
|
4121
|
-
* Parse an expression. Returns a node tree, which can be evaluated by
|
4122
|
-
* invoking node.evaluate();
|
4123
|
-
* @param options Available options: nodes - a set of custome nodes
|
4124
|
-
*/
|
4125
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4126
|
-
parse(options?: any): MathJsChain
|
4127
4256
|
/**
|
4128
4257
|
* @param options Available options: nodes - a set of custome nodes
|
4129
4258
|
*/
|
4130
|
-
|
4131
|
-
|
4259
|
+
parse(
|
4260
|
+
this: MathJsChain<MathExpression[]>,
|
4261
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4262
|
+
options?: any
|
4263
|
+
): MathJsChain<MathNode[]>
|
4132
4264
|
|
4133
4265
|
/**
|
4134
|
-
*
|
4135
|
-
*
|
4266
|
+
* Parse an expression. Returns a node tree, which can be evaluated by
|
4267
|
+
* invoking node.evaluate();
|
4268
|
+
* @param options Available options: nodes - a set of custome nodes
|
4136
4269
|
*/
|
4137
|
-
|
4270
|
+
parse(
|
4271
|
+
this: MathJsChain<MathExpression>,
|
4272
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4273
|
+
options?: any
|
4274
|
+
): MathJsChain<MathNode>
|
4138
4275
|
|
4139
4276
|
/**
|
4140
4277
|
* Replaces variable nodes with their scoped values
|
4141
4278
|
* @param scope Scope to read/write variables
|
4142
4279
|
*/
|
4143
|
-
|
4144
|
-
|
4280
|
+
resolve(
|
4281
|
+
this: MathJsChain<MathNode>,
|
4282
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4283
|
+
scope?: Record<string, any>
|
4284
|
+
): MathJsChain<MathNode>
|
4285
|
+
resolve(
|
4286
|
+
this: MathJsChain<MathNode[]>,
|
4287
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4288
|
+
scope?: Record<string, any>
|
4289
|
+
): MathJsChain<MathNode[]>
|
4145
4290
|
|
4146
4291
|
/*************************************************************************
|
4147
4292
|
* Algebra functions
|
@@ -4152,23 +4297,31 @@ declare namespace math {
|
|
4152
4297
|
* by default. When false, output will not be simplified.
|
4153
4298
|
*/
|
4154
4299
|
derivative(
|
4300
|
+
this: MathJsChain<MathNode | string>,
|
4155
4301
|
variable: MathNode | string,
|
4156
4302
|
options?: { simplify: boolean }
|
4157
|
-
): MathJsChain
|
4303
|
+
): MathJsChain<MathNode>
|
4158
4304
|
|
4159
4305
|
/**
|
4160
4306
|
* Solves the linear equation system by forwards substitution. Matrix
|
4161
4307
|
* must be a lower triangular matrix.
|
4162
4308
|
* @param b A column vector with the b values
|
4163
4309
|
*/
|
4164
|
-
lsolve(
|
4310
|
+
lsolve(
|
4311
|
+
this: MathJsChain<Matrix>,
|
4312
|
+
b: Matrix | MathArray
|
4313
|
+
): MathJsChain<Matrix>
|
4314
|
+
lsolve(
|
4315
|
+
this: MathJsChain<MathArray>,
|
4316
|
+
b: Matrix | MathArray
|
4317
|
+
): MathJsChain<MathArray>
|
4165
4318
|
|
4166
4319
|
/**
|
4167
4320
|
* Calculate the Matrix LU decomposition with partial pivoting. Matrix A
|
4168
4321
|
* is decomposed in two matrices (L, U) and a row permutation vector p
|
4169
4322
|
* where A[p,:] = L * U
|
4170
4323
|
*/
|
4171
|
-
lup(): MathJsChain
|
4324
|
+
lup(this: MathJsChain<Matrix | MathArray>): MathJsChain<LUDecomposition>
|
4172
4325
|
|
4173
4326
|
/**
|
4174
4327
|
* Solves the linear system A * x = b where A is an [n x n] matrix and b
|
@@ -4180,17 +4333,25 @@ declare namespace math {
|
|
4180
4333
|
* see slu for details. Matrix must be a SparseMatrix.
|
4181
4334
|
*/
|
4182
4335
|
lusolve(
|
4336
|
+
this: MathJsChain<Matrix>,
|
4337
|
+
b: Matrix | MathArray,
|
4338
|
+
order?: number,
|
4339
|
+
threshold?: number
|
4340
|
+
): MathJsChain<Matrix>
|
4341
|
+
|
4342
|
+
lusolve(
|
4343
|
+
this: MathJsChain<MathArray>,
|
4183
4344
|
b: Matrix | MathArray,
|
4184
4345
|
order?: number,
|
4185
4346
|
threshold?: number
|
4186
|
-
): MathJsChain
|
4347
|
+
): MathJsChain<MathArray>
|
4187
4348
|
|
4188
4349
|
/**
|
4189
4350
|
* Calculate the Matrix QR decomposition. Matrix A is decomposed in two
|
4190
4351
|
* matrices (Q, R) where Q is an orthogonal matrix and R is an upper
|
4191
4352
|
* triangular matrix.
|
4192
4353
|
*/
|
4193
|
-
qr(): MathJsChain
|
4354
|
+
qr(this: MathJsChain<Matrix | MathArray>): MathJsChain<QRDecomposition>
|
4194
4355
|
|
4195
4356
|
/**
|
4196
4357
|
* Transform a rationalizable expression in a rational fraction. If
|
@@ -4202,7 +4363,11 @@ declare namespace math {
|
|
4202
4363
|
* @param detailed optional True if return an object, false if return
|
4203
4364
|
* expression node (default)
|
4204
4365
|
*/
|
4205
|
-
rationalize(
|
4366
|
+
rationalize(
|
4367
|
+
this: MathJsChain<MathNode | string>,
|
4368
|
+
optional?: object | boolean,
|
4369
|
+
detailed?: boolean
|
4370
|
+
): MathJsChain<MathNode>
|
4206
4371
|
|
4207
4372
|
/**
|
4208
4373
|
* Simplify an expression tree.
|
@@ -4212,8 +4377,13 @@ declare namespace math {
|
|
4212
4377
|
* can be specified as an object, string, or function.
|
4213
4378
|
* @param scope Scope to variables
|
4214
4379
|
*/
|
4215
|
-
simplify(
|
4380
|
+
simplify(
|
4381
|
+
this: MathJsChain<MathNode | string>,
|
4382
|
+
rules?: SimplifyRule[],
|
4383
|
+
scope?: object
|
4384
|
+
): MathJsChain<MathNode>
|
4216
4385
|
|
4386
|
+
// TODO check that this should even be here...
|
4217
4387
|
simplifyCore(expr: MathNode): MathNode
|
4218
4388
|
|
4219
4389
|
/**
|
@@ -4231,14 +4401,25 @@ declare namespace math {
|
|
4231
4401
|
* with more than 10*sqr(columns) entries.
|
4232
4402
|
* @param threshold Partial pivoting threshold (1 for partial pivoting)
|
4233
4403
|
*/
|
4234
|
-
slu(
|
4404
|
+
slu(
|
4405
|
+
this: MathJsChain<Matrix>,
|
4406
|
+
order: number,
|
4407
|
+
threshold: number
|
4408
|
+
): MathJsChain<SLUDecomposition>
|
4235
4409
|
|
4236
4410
|
/**
|
4237
4411
|
* Solves the linear equation system by backward substitution. Matrix
|
4238
4412
|
* must be an upper triangular matrix. U * x = b
|
4239
4413
|
* @param b A column vector with the b values
|
4240
4414
|
*/
|
4241
|
-
usolve(
|
4415
|
+
usolve(
|
4416
|
+
this: MathJsChain<Matrix>,
|
4417
|
+
b: Matrix | MathArray
|
4418
|
+
): MathJsChain<Matrix>
|
4419
|
+
usolve(
|
4420
|
+
this: MathJsChain<MathArray>,
|
4421
|
+
b: Matrix | MathArray
|
4422
|
+
): MathJsChain<MathArray>
|
4242
4423
|
|
4243
4424
|
/*************************************************************************
|
4244
4425
|
* Arithmetic functions
|
@@ -4248,14 +4429,21 @@ declare namespace math {
|
|
4248
4429
|
* Calculate the absolute value of a number. For matrices, the function
|
4249
4430
|
* is evaluated element wise.
|
4250
4431
|
*/
|
4251
|
-
abs(): MathJsChain
|
4432
|
+
abs(this: MathJsChain<number>): MathJsChain<number>
|
4433
|
+
abs(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4434
|
+
abs(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4435
|
+
abs(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4436
|
+
abs(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4437
|
+
abs(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4438
|
+
abs(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4252
4439
|
|
4253
4440
|
/**
|
4254
4441
|
* Add two values, x + y. For matrices, the function is evaluated
|
4255
4442
|
* element wise.
|
4256
4443
|
* @param y Second value to add
|
4257
4444
|
*/
|
4258
|
-
add(y:
|
4445
|
+
add<T extends MathType>(this: MathJsChain<T>, y: T): MathJsChain<T>
|
4446
|
+
add(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4259
4447
|
|
4260
4448
|
/**
|
4261
4449
|
* Apply a function that maps an array to a scalar along a given axis of the
|
@@ -4266,10 +4454,11 @@ declare namespace math {
|
|
4266
4454
|
* array or 1-d matrix as an input and return a number.
|
4267
4455
|
* @returns The residual matrix with the function applied over some dimension.
|
4268
4456
|
*/
|
4269
|
-
apply(
|
4457
|
+
apply<T extends MathCollection>(
|
4458
|
+
this: MathJsChain<T>,
|
4270
4459
|
dim: number,
|
4271
4460
|
callback: (array: Array<MathType> | Matrix) => number
|
4272
|
-
): MathJsChain
|
4461
|
+
): MathJsChain<T>
|
4273
4462
|
|
4274
4463
|
/**
|
4275
4464
|
* Calculate the cubic root of a value. For matrices, the function is
|
@@ -4278,7 +4467,17 @@ declare namespace math {
|
|
4278
4467
|
* a number or complex number. If true, all complex roots are returned,
|
4279
4468
|
* if false (default) the principal root is returned.
|
4280
4469
|
*/
|
4281
|
-
cbrt(allRoots?: boolean): MathJsChain
|
4470
|
+
cbrt(this: MathJsChain<number>, allRoots?: boolean): MathJsChain<number>
|
4471
|
+
cbrt(
|
4472
|
+
this: MathJsChain<BigNumber>,
|
4473
|
+
allRoots?: boolean
|
4474
|
+
): MathJsChain<BigNumber>
|
4475
|
+
cbrt(this: MathJsChain<Complex>, allRoots?: boolean): MathJsChain<Complex>
|
4476
|
+
cbrt(
|
4477
|
+
this: MathJsChain<MathArray>,
|
4478
|
+
allRoots?: boolean
|
4479
|
+
): MathJsChain<MathArray>
|
4480
|
+
cbrt(this: MathJsChain<Matrix>, allRoots?: boolean): MathJsChain<Matrix>
|
4282
4481
|
|
4283
4482
|
// Rounding functions grouped for similarity
|
4284
4483
|
|
@@ -4288,28 +4487,56 @@ declare namespace math {
|
|
4288
4487
|
* function is evaluated element wise.
|
4289
4488
|
* @param n Number of decimals Default value: 0.
|
4290
4489
|
*/
|
4291
|
-
ceil(
|
4490
|
+
ceil(
|
4491
|
+
this: MathJsChain<MathNumericType>,
|
4492
|
+
n?: number | BigNumber | MathCollection
|
4493
|
+
): MathJsChain<MathNumericType>
|
4494
|
+
ceil(
|
4495
|
+
this: MathJsChain<MathCollection>,
|
4496
|
+
n?: number | BigNumber | MathCollection
|
4497
|
+
): MathJsChain<MathCollection>
|
4292
4498
|
|
4293
4499
|
/**
|
4294
4500
|
* Round a value towards zero. For matrices, the function is evaluated
|
4295
4501
|
* element wise.
|
4296
4502
|
* @param n Number of decimals Default value: 0.
|
4297
4503
|
*/
|
4298
|
-
fix(
|
4504
|
+
fix(
|
4505
|
+
this: MathJsChain<MathNumericType>,
|
4506
|
+
n?: number | BigNumber | MathCollection
|
4507
|
+
): MathJsChain<MathNumericType>
|
4508
|
+
fix(
|
4509
|
+
this: MathJsChain<MathCollection>,
|
4510
|
+
n?: number | BigNumber | MathCollection
|
4511
|
+
): MathJsChain<MathCollection>
|
4299
4512
|
|
4300
4513
|
/**
|
4301
4514
|
* Round a value towards minus infinity. For matrices, the function is
|
4302
4515
|
* evaluated element wise.
|
4303
4516
|
* @param n Number of decimals Default value: 0.
|
4304
4517
|
*/
|
4305
|
-
floor(
|
4518
|
+
floor(
|
4519
|
+
this: MathJsChain<MathNumericType>,
|
4520
|
+
n?: number | BigNumber | MathCollection
|
4521
|
+
): MathJsChain<MathNumericType>
|
4522
|
+
floor(
|
4523
|
+
this: MathJsChain<MathCollection>,
|
4524
|
+
n?: number | BigNumber | MathCollection
|
4525
|
+
): MathJsChain<MathCollection>
|
4306
4526
|
|
4307
4527
|
/**
|
4308
4528
|
* Round a value towards the nearest integer. For matrices, the function
|
4309
4529
|
* is evaluated element wise.
|
4310
4530
|
* @param n Number of decimals Default value: 0.
|
4311
4531
|
*/
|
4312
|
-
round(
|
4532
|
+
round(
|
4533
|
+
this: MathJsChain<MathNumericType>,
|
4534
|
+
n?: number | BigNumber | MathCollection
|
4535
|
+
): MathJsChain<MathNumericType>
|
4536
|
+
round(
|
4537
|
+
this: MathJsChain<MathCollection>,
|
4538
|
+
n?: number | BigNumber | MathCollection
|
4539
|
+
): MathJsChain<MathCollection>
|
4313
4540
|
|
4314
4541
|
// End of rounding group
|
4315
4542
|
|
@@ -4317,52 +4544,79 @@ declare namespace math {
|
|
4317
4544
|
* Compute the cube of a value, x * x * x. For matrices, the function is
|
4318
4545
|
* evaluated element wise.
|
4319
4546
|
*/
|
4320
|
-
cube(): MathJsChain
|
4547
|
+
cube(this: MathJsChain<number>): MathJsChain<number>
|
4548
|
+
cube(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4549
|
+
cube(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4550
|
+
cube(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4551
|
+
cube(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4552
|
+
cube(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4553
|
+
cube(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4321
4554
|
|
4322
4555
|
/**
|
4323
4556
|
* Divide two values, x / y. To divide matrices, x is multiplied with
|
4324
4557
|
* the inverse of y: x * inv(y).
|
4325
4558
|
* @param y Denominator
|
4326
4559
|
*/
|
4327
|
-
divide(y:
|
4560
|
+
divide(this: MathJsChain<Unit>, y: Unit): MathJsChain<Unit | number>
|
4561
|
+
divide(this: MathJsChain<Unit>, y: number): MathJsChain<Unit>
|
4562
|
+
divide(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4563
|
+
divide(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4328
4564
|
|
4329
4565
|
/**
|
4330
4566
|
* Divide two matrices element wise. The function accepts both matrices
|
4331
4567
|
* and scalar values.
|
4332
4568
|
* @param y Denominator
|
4333
4569
|
*/
|
4334
|
-
dotDivide(y: MathType): MathJsChain
|
4570
|
+
dotDivide(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4335
4571
|
|
4336
4572
|
/**
|
4337
4573
|
* Multiply two matrices element wise. The function accepts both
|
4338
4574
|
* matrices and scalar values.
|
4339
4575
|
* @param y Right hand value
|
4340
4576
|
*/
|
4341
|
-
dotMultiply(y: MathType): MathJsChain
|
4577
|
+
dotMultiply(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4342
4578
|
|
4343
4579
|
/**
|
4344
4580
|
* Calculates the power of x to y element wise.
|
4345
4581
|
* @param y The exponent
|
4346
4582
|
*/
|
4347
|
-
dotPow(y: MathType): MathJsChain
|
4583
|
+
dotPow(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4348
4584
|
|
4349
4585
|
/**
|
4350
4586
|
* Calculate the exponent of a value. For matrices, the function is
|
4351
4587
|
* evaluated element wise.
|
4352
4588
|
*/
|
4353
|
-
exp(): MathJsChain
|
4589
|
+
exp(this: MathJsChain<number>): MathJsChain<number>
|
4590
|
+
exp(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4591
|
+
exp(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4592
|
+
exp(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4593
|
+
exp(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4354
4594
|
|
4355
4595
|
/**
|
4356
4596
|
* Calculate the value of subtracting 1 from the exponential value. For
|
4357
4597
|
* matrices, the function is evaluated element wise.
|
4358
4598
|
*/
|
4359
|
-
expm1(): MathJsChain
|
4599
|
+
expm1(this: MathJsChain<number>): MathJsChain<number>
|
4600
|
+
expm1(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4601
|
+
expm1(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4602
|
+
expm1(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4603
|
+
expm1(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4360
4604
|
|
4361
4605
|
/**
|
4362
4606
|
* Calculate the greatest common divisor for two or more values or
|
4363
4607
|
* arrays. For matrices, the function is evaluated element wise.
|
4364
4608
|
*/
|
4365
|
-
gcd(): MathJsChain
|
4609
|
+
gcd(this: MathJsChain<number[]>, ...args: number[]): MathJsChain<number>
|
4610
|
+
gcd(
|
4611
|
+
this: MathJsChain<BigNumber[]>,
|
4612
|
+
...args: BigNumber[]
|
4613
|
+
): MathJsChain<BigNumber>
|
4614
|
+
gcd(this: MathJsChain<Complex[]>, ...args: Fraction[]): MathJsChain<Complex>
|
4615
|
+
gcd(
|
4616
|
+
this: MathJsChain<MathArray[]>,
|
4617
|
+
...args: MathArray[]
|
4618
|
+
): MathJsChain<MathArray>
|
4619
|
+
gcd(this: MathJsChain<Matrix[]>, ...args: Matrix[]): MathJsChain<Matrix>
|
4366
4620
|
|
4367
4621
|
/**
|
4368
4622
|
* Calculate the hypotenusa of a list with values. The hypotenusa is
|
@@ -4370,7 +4624,8 @@ declare namespace math {
|
|
4370
4624
|
* matrix input, the hypotenusa is calculated for all values in the
|
4371
4625
|
* matrix.
|
4372
4626
|
*/
|
4373
|
-
hypot(): MathJsChain
|
4627
|
+
hypot(this: MathJsChain<number[]>): MathJsChain<number>
|
4628
|
+
hypot(this: MathJsChain<BigNumber[]>): MathJsChain<BigNumber>
|
4374
4629
|
|
4375
4630
|
/**
|
4376
4631
|
* Calculate the least common multiple for two or more values or arrays.
|
@@ -4378,7 +4633,10 @@ declare namespace math {
|
|
4378
4633
|
* the function is evaluated element wise.
|
4379
4634
|
* @param b An integer number
|
4380
4635
|
*/
|
4381
|
-
lcm(
|
4636
|
+
lcm(this: MathJsChain<number>, b: number): MathJsChain<number>
|
4637
|
+
lcm(this: MathJsChain<BigNumber>, b: BigNumber): MathJsChain<BigNumber>
|
4638
|
+
lcm(this: MathJsChain<MathArray>, b: MathArray): MathJsChain<MathArray>
|
4639
|
+
lcm(this: MathJsChain<Matrix>, b: Matrix): MathJsChain<Matrix>
|
4382
4640
|
|
4383
4641
|
/**
|
4384
4642
|
* Calculate the logarithm of a value. For matrices, the function is
|
@@ -4386,24 +4644,58 @@ declare namespace math {
|
|
4386
4644
|
* @param base Optional base for the logarithm. If not provided, the
|
4387
4645
|
* natural logarithm of x is calculated. Default value: e.
|
4388
4646
|
*/
|
4389
|
-
log
|
4647
|
+
log<T extends number | BigNumber | Complex | MathCollection>(
|
4648
|
+
this: MathJsChain<T>,
|
4649
|
+
base?: number | BigNumber | Complex
|
4650
|
+
): MathJsChain<NoLiteralType<T>>
|
4390
4651
|
|
4391
4652
|
/**
|
4392
4653
|
* Calculate the 10-base of a value. This is the same as calculating
|
4393
4654
|
* log(x, 10). For matrices, the function is evaluated element wise.
|
4394
4655
|
*/
|
4395
|
-
|
4656
|
+
|
4657
|
+
log10(this: MathJsChain<number>): MathJsChain<number>
|
4658
|
+
log10(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4659
|
+
log10(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4660
|
+
log10(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4661
|
+
log10(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4396
4662
|
|
4397
4663
|
/**
|
4398
4664
|
* Calculate the logarithm of a value+1. For matrices, the function is
|
4399
4665
|
* evaluated element wise.
|
4400
4666
|
*/
|
4401
|
-
log1p(
|
4667
|
+
log1p(
|
4668
|
+
this: MathJsChain<number>,
|
4669
|
+
base?: number | BigNumber | Complex
|
4670
|
+
): MathJsChain<number>
|
4671
|
+
log1p(
|
4672
|
+
this: MathJsChain<BigNumber>,
|
4673
|
+
base?: number | BigNumber | Complex
|
4674
|
+
): MathJsChain<BigNumber>
|
4675
|
+
log1p(
|
4676
|
+
this: MathJsChain<Complex>,
|
4677
|
+
base?: number | BigNumber | Complex
|
4678
|
+
): MathJsChain<Complex>
|
4679
|
+
log1p(
|
4680
|
+
this: MathJsChain<MathArray>,
|
4681
|
+
base?: number | BigNumber | Complex
|
4682
|
+
): MathJsChain<MathArray>
|
4683
|
+
log1p(
|
4684
|
+
this: MathJsChain<Matrix>,
|
4685
|
+
base?: number | BigNumber | Complex
|
4686
|
+
): MathJsChain<Matrix>
|
4687
|
+
|
4402
4688
|
/**
|
4403
4689
|
* Calculate the 2-base of a value. This is the same as calculating
|
4404
4690
|
* log(x, 2). For matrices, the function is evaluated element wise.
|
4405
4691
|
*/
|
4406
|
-
|
4692
|
+
|
4693
|
+
log2(this: MathJsChain<number>): MathJsChain<number>
|
4694
|
+
log2(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4695
|
+
log2(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4696
|
+
log2(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4697
|
+
log2(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4698
|
+
|
4407
4699
|
/**
|
4408
4700
|
* Calculates the modulus, the remainder of an integer division. For
|
4409
4701
|
* matrices, the function is evaluated element wise. The modulus is
|
@@ -4411,14 +4703,23 @@ declare namespace math {
|
|
4411
4703
|
* @see http://en.wikipedia.org/wiki/Modulo_operation.
|
4412
4704
|
* @param y Divisor
|
4413
4705
|
*/
|
4414
|
-
mod
|
4706
|
+
mod<T extends number | BigNumber | Fraction | MathCollection>(
|
4707
|
+
this: MathJsChain<T>,
|
4708
|
+
y: number | BigNumber | Fraction | MathCollection
|
4709
|
+
): MathJsChain<NoLiteralType<T>>
|
4415
4710
|
|
4416
4711
|
/**
|
4417
4712
|
* Multiply two values, x * y. The result is squeezed. For matrices, the
|
4418
4713
|
* matrix product is calculated.
|
4419
4714
|
* @param y The second value to multiply
|
4420
4715
|
*/
|
4421
|
-
multiply
|
4716
|
+
multiply<T extends Matrix | MathArray>(
|
4717
|
+
this: MathJsChain<T>,
|
4718
|
+
y: MathType
|
4719
|
+
): MathJsChain<T>
|
4720
|
+
multiply(this: MathJsChain<Unit>, y: Unit): MathJsChain<Unit>
|
4721
|
+
multiply(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4722
|
+
multiply(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4422
4723
|
|
4423
4724
|
/**
|
4424
4725
|
* Calculate the norm of a number, vector or matrix. The second
|
@@ -4427,7 +4728,10 @@ declare namespace math {
|
|
4427
4728
|
* -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The
|
4428
4729
|
* Frobenius norm) Default value: 2.
|
4429
4730
|
*/
|
4430
|
-
norm(
|
4731
|
+
norm(
|
4732
|
+
this: MathJsChain<number | BigNumber | Complex | MathCollection>,
|
4733
|
+
p?: number | BigNumber | string
|
4734
|
+
): MathJsChain<number | BigNumber>
|
4431
4735
|
|
4432
4736
|
/**
|
4433
4737
|
* Calculate the nth root of a value. The principal nth root of a
|
@@ -4435,14 +4739,20 @@ declare namespace math {
|
|
4435
4739
|
* x^root = A For matrices, the function is evaluated element wise.
|
4436
4740
|
* @param root The root. Default value: 2.
|
4437
4741
|
*/
|
4438
|
-
nthRoot(
|
4742
|
+
nthRoot(
|
4743
|
+
this: MathJsChain<number | BigNumber | MathCollection | Complex>,
|
4744
|
+
root?: number | BigNumber
|
4745
|
+
): MathJsChain<number | Complex | MathCollection>
|
4439
4746
|
|
4440
4747
|
/**
|
4441
4748
|
* Calculates the power of x to y, x ^ y. Matrix exponentiation is
|
4442
4749
|
* supported for square matrices x, and positive integer exponents y.
|
4443
4750
|
* @param y The exponent
|
4444
4751
|
*/
|
4445
|
-
pow(
|
4752
|
+
pow(
|
4753
|
+
this: MathJsChain<MathType>,
|
4754
|
+
y: number | BigNumber | Complex
|
4755
|
+
): MathJsChain<MathType>
|
4446
4756
|
|
4447
4757
|
/**
|
4448
4758
|
* Compute the sign of a value. The sign of a value x is: 1 when x > 1
|
@@ -4451,26 +4761,46 @@ declare namespace math {
|
|
4451
4761
|
* @param x The number for which to determine the sign
|
4452
4762
|
* @returns The sign of x
|
4453
4763
|
*/
|
4454
|
-
sign(
|
4764
|
+
sign(this: MathJsChain<number>): MathJsChain<number>
|
4765
|
+
sign(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4766
|
+
sign(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4767
|
+
sign(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4768
|
+
sign(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4769
|
+
sign(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4770
|
+
sign(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4455
4771
|
|
4456
4772
|
/**
|
4457
4773
|
* Calculate the square root of a value. For matrices, the function is
|
4458
4774
|
* evaluated element wise.
|
4459
4775
|
*/
|
4460
|
-
|
4776
|
+
|
4777
|
+
sqrt(this: MathJsChain<number>): MathJsChain<number>
|
4778
|
+
sqrt(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4779
|
+
sqrt(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4780
|
+
sqrt(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4781
|
+
sqrt(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4782
|
+
sqrt(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4461
4783
|
|
4462
4784
|
/**
|
4463
4785
|
* Compute the square of a value, x * x. For matrices, the function is
|
4464
4786
|
* evaluated element wise.
|
4465
4787
|
*/
|
4466
|
-
|
4788
|
+
|
4789
|
+
square(this: MathJsChain<number>): MathJsChain<number>
|
4790
|
+
square(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4791
|
+
square(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4792
|
+
square(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4793
|
+
square(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4794
|
+
square(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4795
|
+
square(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4467
4796
|
|
4468
4797
|
/**
|
4469
4798
|
* Subtract two values, x - y. For matrices, the function is evaluated
|
4470
4799
|
* element wise.
|
4471
4800
|
* @param y Value to subtract from x
|
4472
4801
|
*/
|
4473
|
-
subtract(y:
|
4802
|
+
subtract<T extends MathType>(this: MathJsChain<T>, y: T): MathJsChain<T>
|
4803
|
+
subtract(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
|
4474
4804
|
|
4475
4805
|
/**
|
4476
4806
|
* Inverse the sign of a value, apply a unary minus operation. For
|
@@ -4478,21 +4808,39 @@ declare namespace math {
|
|
4478
4808
|
* strings will be converted to a number. For complex numbers, both real
|
4479
4809
|
* and complex value are inverted.
|
4480
4810
|
*/
|
4481
|
-
|
4811
|
+
|
4812
|
+
unaryMinus(this: MathJsChain<number>): MathJsChain<number>
|
4813
|
+
unaryMinus(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4814
|
+
unaryMinus(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4815
|
+
unaryMinus(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4816
|
+
unaryMinus(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4817
|
+
unaryMinus(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4818
|
+
unaryMinus(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4482
4819
|
|
4483
4820
|
/**
|
4484
4821
|
* Unary plus operation. Boolean values and strings will be converted to
|
4485
4822
|
* a number, numeric values will be returned as is. For matrices, the
|
4486
4823
|
* function is evaluated element wise.
|
4487
4824
|
*/
|
4488
|
-
|
4825
|
+
|
4826
|
+
unaryPlus(this: MathJsChain<number>): MathJsChain<number>
|
4827
|
+
unaryPlus(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4828
|
+
unaryPlus(this: MathJsChain<Fraction>): MathJsChain<Fraction>
|
4829
|
+
unaryPlus(this: MathJsChain<string>): MathJsChain<string>
|
4830
|
+
unaryPlus(this: MathJsChain<Complex>): MathJsChain<Complex>
|
4831
|
+
unaryPlus(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4832
|
+
unaryPlus(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4833
|
+
unaryPlus(this: MathJsChain<Unit>): MathJsChain<Unit>
|
4489
4834
|
|
4490
4835
|
/**
|
4491
4836
|
* Calculate the extended greatest common divisor for two values. See
|
4492
4837
|
* http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.
|
4493
4838
|
* @param b An integer number
|
4494
4839
|
*/
|
4495
|
-
xgcd(
|
4840
|
+
xgcd(
|
4841
|
+
this: MathJsChain<number | BigNumber>,
|
4842
|
+
b: number | BigNumber
|
4843
|
+
): MathJsChain<MathArray>
|
4496
4844
|
|
4497
4845
|
/*************************************************************************
|
4498
4846
|
* Bitwise functions
|
@@ -4503,14 +4851,21 @@ declare namespace math {
|
|
4503
4851
|
* evaluated element wise.
|
4504
4852
|
* @param y Second value to and
|
4505
4853
|
*/
|
4506
|
-
bitAnd
|
4854
|
+
bitAnd<T extends number | BigNumber | MathCollection>(
|
4855
|
+
this: MathJsChain<T>,
|
4856
|
+
y: number | BigNumber | MathCollection
|
4857
|
+
): MathJsChain<NoLiteralType<T>>
|
4507
4858
|
|
4508
4859
|
/**
|
4509
4860
|
* Bitwise NOT value, ~x. For matrices, the function is evaluated
|
4510
4861
|
* element wise. For units, the function is evaluated on the best prefix
|
4511
4862
|
* base.
|
4512
4863
|
*/
|
4513
|
-
|
4864
|
+
|
4865
|
+
bitNot(this: MathJsChain<number>): MathJsChain<number>
|
4866
|
+
bitNot(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4867
|
+
bitNot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4868
|
+
bitNot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4514
4869
|
|
4515
4870
|
/**
|
4516
4871
|
* Bitwise OR two values, x | y. For matrices, the function is evaluated
|
@@ -4518,14 +4873,20 @@ declare namespace math {
|
|
4518
4873
|
* print base.
|
4519
4874
|
* @param y Second value to or
|
4520
4875
|
*/
|
4521
|
-
bitOr(
|
4876
|
+
bitOr(this: MathJsChain<number>, y: number): MathJsChain<number>
|
4877
|
+
bitOr(this: MathJsChain<BigNumber>, y: BigNumber): MathJsChain<BigNumber>
|
4878
|
+
bitOr(this: MathJsChain<MathArray>, y: MathArray): MathJsChain<MathArray>
|
4879
|
+
bitOr(this: MathJsChain<Matrix>, y: Matrix): MathJsChain<Matrix>
|
4522
4880
|
|
4523
4881
|
/**
|
4524
4882
|
* Bitwise XOR two values, x ^ y. For matrices, the function is
|
4525
4883
|
* evaluated element wise.
|
4526
4884
|
* @param y Second value to xor
|
4527
4885
|
*/
|
4528
|
-
bitXor
|
4886
|
+
bitXor<T extends number | BigNumber | MathCollection>(
|
4887
|
+
this: MathJsChain<T>,
|
4888
|
+
y: number | BigNumber | MathCollection
|
4889
|
+
): MathJsChain<NoLiteralType<T>>
|
4529
4890
|
|
4530
4891
|
/**
|
4531
4892
|
* Bitwise left logical shift of a value x by y number of bits, x << y.
|
@@ -4533,7 +4894,10 @@ declare namespace math {
|
|
4533
4894
|
* function is evaluated on the best prefix base.
|
4534
4895
|
* @param y Amount of shifts
|
4535
4896
|
*/
|
4536
|
-
leftShift
|
4897
|
+
leftShift<T extends number | BigNumber | MathCollection>(
|
4898
|
+
this: MathJsChain<T>,
|
4899
|
+
y: number | BigNumber
|
4900
|
+
): MathJsChain<NoLiteralType<T>>
|
4537
4901
|
|
4538
4902
|
/**
|
4539
4903
|
* Bitwise right arithmetic shift of a value x by y number of bits, x >>
|
@@ -4541,7 +4905,10 @@ declare namespace math {
|
|
4541
4905
|
* the function is evaluated on the best prefix base.
|
4542
4906
|
* @param y Amount of shifts
|
4543
4907
|
*/
|
4544
|
-
rightArithShift
|
4908
|
+
rightArithShift<T extends number | BigNumber | MathCollection>(
|
4909
|
+
this: MathJsChain<T>,
|
4910
|
+
y: number | BigNumber
|
4911
|
+
): MathJsChain<NoLiteralType<T>>
|
4545
4912
|
|
4546
4913
|
/**
|
4547
4914
|
* Bitwise right logical shift of value x by y number of bits, x >>> y.
|
@@ -4549,7 +4916,10 @@ declare namespace math {
|
|
4549
4916
|
* function is evaluated on the best prefix base.
|
4550
4917
|
* @param y Amount of shifts
|
4551
4918
|
*/
|
4552
|
-
rightLogShift
|
4919
|
+
rightLogShift<T extends number | MathCollection>(
|
4920
|
+
this: MathJsChain<T>,
|
4921
|
+
y: number
|
4922
|
+
): MathJsChain<NoLiteralType<T>>
|
4553
4923
|
|
4554
4924
|
/*************************************************************************
|
4555
4925
|
* Combinatorics functions
|
@@ -4561,21 +4931,28 @@ declare namespace math {
|
|
4561
4931
|
* takes integer arguments. The following condition must be enforced: n
|
4562
4932
|
* >= 0
|
4563
4933
|
*/
|
4564
|
-
|
4934
|
+
|
4935
|
+
bellNumbers(this: MathJsChain<number>): MathJsChain<number>
|
4936
|
+
bellNumbers(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4565
4937
|
|
4566
4938
|
/**
|
4567
4939
|
* The Catalan Numbers enumerate combinatorial structures of many
|
4568
4940
|
* different types. catalan only takes integer arguments. The following
|
4569
4941
|
* condition must be enforced: n >= 0
|
4570
4942
|
*/
|
4571
|
-
|
4943
|
+
|
4944
|
+
catalan(this: MathJsChain<number>): MathJsChain<number>
|
4945
|
+
catalan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
4572
4946
|
|
4573
4947
|
/**
|
4574
4948
|
* The composition counts of n into k parts. Composition only takes
|
4575
4949
|
* integer arguments. The following condition must be enforced: k <= n.
|
4576
4950
|
* @param k Number of objects in the subset
|
4577
4951
|
*/
|
4578
|
-
composition
|
4952
|
+
composition<T extends number | BigNumber>(
|
4953
|
+
this: MathJsChain<T>,
|
4954
|
+
k: number | BigNumber
|
4955
|
+
): MathJsChain<NoLiteralType<T>>
|
4579
4956
|
|
4580
4957
|
/**
|
4581
4958
|
* The Stirling numbers of the second kind, counts the number of ways to
|
@@ -4585,7 +4962,10 @@ declare namespace math {
|
|
4585
4962
|
* 1
|
4586
4963
|
* @param k Number of objects in the subset
|
4587
4964
|
*/
|
4588
|
-
stirlingS2
|
4965
|
+
stirlingS2<T extends number | BigNumber>(
|
4966
|
+
this: MathJsChain<T>,
|
4967
|
+
k: number | BigNumber
|
4968
|
+
): MathJsChain<NoLiteralType<T>>
|
4589
4969
|
|
4590
4970
|
/*************************************************************************
|
4591
4971
|
* Complex functions
|
@@ -4596,28 +4976,38 @@ declare namespace math {
|
|
4596
4976
|
* the argument is computed as atan2(b, a). For matrices, the function
|
4597
4977
|
* is evaluated element wise.
|
4598
4978
|
*/
|
4599
|
-
|
4979
|
+
|
4980
|
+
arg(this: MathJsChain<number | Complex>): MathJsChain<number>
|
4981
|
+
arg(this: MathJsChain<BigNumber | Complex>): MathJsChain<BigNumber>
|
4982
|
+
arg(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
4983
|
+
arg(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4600
4984
|
|
4601
4985
|
/**
|
4602
4986
|
* Compute the complex conjugate of a complex value. If x = a+bi, the
|
4603
4987
|
* complex conjugate of x is a - bi. For matrices, the function is
|
4604
4988
|
* evaluated element wise.
|
4605
4989
|
*/
|
4606
|
-
conj(
|
4990
|
+
conj<T extends number | BigNumber | Complex | MathCollection>(
|
4991
|
+
this: MathJsChain<T>
|
4992
|
+
): MathJsChain<NoLiteralType<T>>
|
4607
4993
|
|
4608
4994
|
/**
|
4609
4995
|
* Get the imaginary part of a complex number. For a complex number a +
|
4610
4996
|
* bi, the function returns b. For matrices, the function is evaluated
|
4611
4997
|
* element wise.
|
4612
4998
|
*/
|
4613
|
-
im(): MathJsChain
|
4999
|
+
im(this: MathJsChain<number | Complex>): MathJsChain<number>
|
5000
|
+
im(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
5001
|
+
im(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4614
5002
|
|
4615
5003
|
/**
|
4616
5004
|
* Get the real part of a complex number. For a complex number a + bi,
|
4617
5005
|
* the function returns a. For matrices, the function is evaluated
|
4618
5006
|
* element wise.
|
4619
5007
|
*/
|
4620
|
-
re(): MathJsChain
|
5008
|
+
re(this: MathJsChain<number | Complex>): MathJsChain<number>
|
5009
|
+
re(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
5010
|
+
re(this: MathJsChain<MathCollection>): MathJsChain<MathCollection>
|
4621
5011
|
|
4622
5012
|
/*************************************************************************
|
4623
5013
|
* Geometry functions
|
@@ -4633,7 +5023,10 @@ declare namespace math {
|
|
4633
5023
|
* c)
|
4634
5024
|
* @param y Coordinates of the second point
|
4635
5025
|
*/
|
4636
|
-
distance(
|
5026
|
+
distance(
|
5027
|
+
this: MathJsChain<MathCollection | object>,
|
5028
|
+
y: MathCollection | object
|
5029
|
+
): MathJsChain<number | BigNumber>
|
4637
5030
|
|
4638
5031
|
/**
|
4639
5032
|
* Calculates the point of intersection of two lines in two or three
|
@@ -4649,10 +5042,11 @@ declare namespace math {
|
|
4649
5042
|
* the calculation is for line and plane
|
4650
5043
|
*/
|
4651
5044
|
intersect(
|
5045
|
+
this: MathJsChain<MathCollection>,
|
4652
5046
|
x: MathCollection,
|
4653
5047
|
y: MathCollection,
|
4654
5048
|
z: MathCollection
|
4655
|
-
): MathJsChain
|
5049
|
+
): MathJsChain<MathArray>
|
4656
5050
|
|
4657
5051
|
/*************************************************************************
|
4658
5052
|
* Logical functions
|
@@ -4664,13 +5058,18 @@ declare namespace math {
|
|
4664
5058
|
* element wise.
|
4665
5059
|
* @param y Second value to and
|
4666
5060
|
*/
|
4667
|
-
and(
|
5061
|
+
and(
|
5062
|
+
this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5063
|
+
y: number | BigNumber | Complex | Unit | MathCollection
|
5064
|
+
): MathJsChain<boolean | MathCollection>
|
4668
5065
|
|
4669
5066
|
/**
|
4670
5067
|
* Logical not. Flips boolean value of a given parameter. For matrices,
|
4671
5068
|
* the function is evaluated element wise.
|
4672
5069
|
*/
|
4673
|
-
not(
|
5070
|
+
not(
|
5071
|
+
this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>
|
5072
|
+
): MathJsChain<boolean | MathCollection>
|
4674
5073
|
|
4675
5074
|
/**
|
4676
5075
|
* Logical or. Test if at least one value is defined with a
|
@@ -4678,7 +5077,10 @@ declare namespace math {
|
|
4678
5077
|
* element wise.
|
4679
5078
|
* @param y Second value to or
|
4680
5079
|
*/
|
4681
|
-
or(
|
5080
|
+
or(
|
5081
|
+
this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5082
|
+
y: number | BigNumber | Complex | Unit | MathCollection
|
5083
|
+
): MathJsChain<boolean | MathCollection>
|
4682
5084
|
|
4683
5085
|
/**
|
4684
5086
|
* Logical xor. Test whether one and only one value is defined with a
|
@@ -4686,7 +5088,10 @@ declare namespace math {
|
|
4686
5088
|
* element wise.
|
4687
5089
|
* @param y Second value to xor
|
4688
5090
|
*/
|
4689
|
-
xor(
|
5091
|
+
xor(
|
5092
|
+
this: MathJsChain<number | BigNumber | Complex | Unit | MathCollection>,
|
5093
|
+
y: number | BigNumber | Complex | Unit | MathCollection
|
5094
|
+
): MathJsChain<boolean | MathCollection>
|
4690
5095
|
|
4691
5096
|
/*************************************************************************
|
4692
5097
|
* Matrix functions
|
@@ -4697,7 +5102,10 @@ declare namespace math {
|
|
4697
5102
|
* dimension over which to concatenate the matrices. By default the last
|
4698
5103
|
* dimension of the matrices.
|
4699
5104
|
*/
|
4700
|
-
|
5105
|
+
|
5106
|
+
concat(
|
5107
|
+
this: MathJsChain<Array<MathCollection | number | BigNumber>>
|
5108
|
+
): MathJsChain<MathCollection>
|
4701
5109
|
|
4702
5110
|
/**
|
4703
5111
|
* Calculate the cross product for two vectors in three dimensional
|
@@ -4706,12 +5114,16 @@ declare namespace math {
|
|
4706
5114
|
* * b2 - a2 * b1 ]
|
4707
5115
|
* @param y Second vector
|
4708
5116
|
*/
|
4709
|
-
cross(
|
5117
|
+
cross(
|
5118
|
+
this: MathJsChain<MathCollection>,
|
5119
|
+
y: MathCollection
|
5120
|
+
): MathJsChain<Matrix | MathArray>
|
4710
5121
|
|
4711
5122
|
/**
|
4712
5123
|
* Calculate the determinant of a matrix.
|
4713
5124
|
*/
|
4714
|
-
|
5125
|
+
|
5126
|
+
det(this: MathJsChain<MathCollection>): MathJsChain<number>
|
4715
5127
|
|
4716
5128
|
/**
|
4717
5129
|
* Create a diagonal matrix or retrieve the diagonal of a matrix. When x
|
@@ -4724,8 +5136,15 @@ declare namespace math {
|
|
4724
5136
|
* retrieved. Default value: 0.
|
4725
5137
|
* @param format The matrix storage format. Default value: 'dense'.
|
4726
5138
|
*/
|
4727
|
-
diag(
|
4728
|
-
|
5139
|
+
diag(
|
5140
|
+
this: MathJsChain<MathCollection>,
|
5141
|
+
format?: string
|
5142
|
+
): MathJsChain<Matrix>
|
5143
|
+
diag(
|
5144
|
+
this: MathJsChain<MathCollection>,
|
5145
|
+
k: number | BigNumber,
|
5146
|
+
format?: string
|
5147
|
+
): MathJsChain<Matrix | MathArray>
|
4729
5148
|
|
4730
5149
|
/**
|
4731
5150
|
* Calculate the dot product of two vectors. The dot product of A = [a1,
|
@@ -4733,7 +5152,10 @@ declare namespace math {
|
|
4733
5152
|
* B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn
|
4734
5153
|
* @param y Second vector
|
4735
5154
|
*/
|
4736
|
-
dot(
|
5155
|
+
dot(
|
5156
|
+
this: MathJsChain<MathCollection>,
|
5157
|
+
y: MathCollection
|
5158
|
+
): MathJsChain<number>
|
4737
5159
|
|
4738
5160
|
/**
|
4739
5161
|
* Compute the matrix exponential, expm(A) = e^A. The matrix must be
|
@@ -4742,52 +5164,77 @@ declare namespace math {
|
|
4742
5164
|
* approximant with scaling and squaring; see “Nineteen Dubious Ways to
|
4743
5165
|
* Compute the Exponential of a Matrix,” by Moler and Van Loan.
|
4744
5166
|
*/
|
4745
|
-
|
5167
|
+
|
5168
|
+
expm(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
4746
5169
|
|
4747
5170
|
/**
|
4748
5171
|
* Create a 2-dimensional identity matrix with size m x n or n x n. The
|
4749
5172
|
* matrix has ones on the diagonal and zeros elsewhere.
|
4750
5173
|
* @param format The Matrix storage format
|
4751
5174
|
*/
|
4752
|
-
identity(
|
5175
|
+
identity(
|
5176
|
+
this: MathJsChain<number | number[] | Matrix | MathArray>,
|
5177
|
+
format?: string
|
5178
|
+
): MathJsChain<Matrix | MathArray | number>
|
5179
|
+
|
4753
5180
|
/**
|
4754
5181
|
* @param n The y dimension for the matrix
|
4755
5182
|
* @param format The Matrix storage format
|
4756
5183
|
*/
|
4757
|
-
identity(
|
5184
|
+
identity(
|
5185
|
+
this: MathJsChain<number>,
|
5186
|
+
n: number,
|
5187
|
+
format?: string
|
5188
|
+
): MathJsChain<Matrix | MathArray | number>
|
4758
5189
|
|
4759
5190
|
/**
|
4760
5191
|
* Filter the items in an array or one dimensional matrix.
|
4761
5192
|
*/
|
4762
5193
|
filter(
|
4763
|
-
|
4764
|
-
|
4765
|
-
|
5194
|
+
this: MathJsChain<Matrix | MathArray | string[]>,
|
5195
|
+
test:
|
5196
|
+
| ((
|
5197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5198
|
+
value: any,
|
5199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5200
|
+
index: any,
|
5201
|
+
matrix: Matrix | MathArray | string[]
|
5202
|
+
) => boolean)
|
5203
|
+
| RegExp
|
5204
|
+
): MathJsChain<Matrix | MathArray>
|
4766
5205
|
|
4767
5206
|
/**
|
4768
5207
|
* Flatten a multi dimensional matrix into a single dimensional matrix.
|
4769
5208
|
*/
|
4770
|
-
|
5209
|
+
|
5210
|
+
flatten<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
4771
5211
|
|
4772
5212
|
/**
|
4773
5213
|
* Iterate over all elements of a matrix/array, and executes the given
|
4774
5214
|
* callback function.
|
4775
5215
|
*/
|
4776
|
-
forEach(
|
5216
|
+
forEach<T extends Matrix | MathArray>(
|
5217
|
+
this: MathJsChain<T>,
|
4777
5218
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4778
|
-
callback: (value: any, index: any, matrix:
|
4779
|
-
): MathJsChain
|
5219
|
+
callback: (value: any, index: any, matrix: T) => void
|
5220
|
+
): MathJsChain<T>
|
4780
5221
|
|
4781
5222
|
/**
|
4782
5223
|
* Calculate the inverse of a square matrix.
|
4783
5224
|
*/
|
4784
|
-
|
5225
|
+
|
5226
|
+
inv<T extends number | Complex | MathCollection>(
|
5227
|
+
this: MathJsChain<T>
|
5228
|
+
): MathJsChain<NoLiteralType<T>>
|
4785
5229
|
|
4786
5230
|
/**
|
4787
5231
|
* Calculate the kronecker product of two matrices or vectors
|
4788
5232
|
* @param y Second vector
|
4789
5233
|
*/
|
4790
|
-
kron(
|
5234
|
+
kron(
|
5235
|
+
this: MathJsChain<Matrix | MathArray>,
|
5236
|
+
y: Matrix | MathArray
|
5237
|
+
): MathJsChain<Matrix>
|
4791
5238
|
|
4792
5239
|
/**
|
4793
5240
|
* Iterate over all elements of a matrix/array, and executes the given
|
@@ -4796,26 +5243,31 @@ declare namespace math {
|
|
4796
5243
|
* parameters: the value of the element, the index of the element, and
|
4797
5244
|
* the Matrix/array being traversed.
|
4798
5245
|
*/
|
4799
|
-
map(
|
4800
|
-
|
4801
|
-
|
4802
|
-
|
4803
|
-
|
4804
|
-
index: any,
|
4805
|
-
matrix: Matrix | MathArray
|
4806
|
-
) => Matrix | MathArray
|
4807
|
-
): MathJsChain
|
5246
|
+
map<T extends Matrix | MathArray>(
|
5247
|
+
this: MathJsChain<T>,
|
5248
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5249
|
+
callback: (value: any, index: any, matrix: T) => MathType | string
|
5250
|
+
): MathJsChain<T>
|
4808
5251
|
|
4809
5252
|
/**
|
4810
5253
|
* Create a matrix filled with ones. The created matrix can have one or
|
4811
5254
|
* multiple dimensions.
|
4812
5255
|
* @param format The matrix storage format
|
4813
5256
|
*/
|
4814
|
-
ones(
|
5257
|
+
ones(
|
5258
|
+
this: MathJsChain<number | number[]>,
|
5259
|
+
format?: string
|
5260
|
+
): MathJsChain<MathCollection>
|
5261
|
+
|
4815
5262
|
/**
|
4816
5263
|
* @param format The matrix storage format
|
4817
5264
|
*/
|
4818
|
-
ones(
|
5265
|
+
ones(
|
5266
|
+
this: MathJsChain<number>,
|
5267
|
+
n: number,
|
5268
|
+
format?: string
|
5269
|
+
): MathJsChain<MathCollection>
|
5270
|
+
|
4819
5271
|
/**
|
4820
5272
|
* Partition-based selection of an array or 1D matrix. Will find the kth
|
4821
5273
|
* smallest value, and mutates the input array. Uses Quickselect.
|
@@ -4825,10 +5277,11 @@ declare namespace math {
|
|
4825
5277
|
* and 0 when a == b. Default value: 'asc'.
|
4826
5278
|
*/
|
4827
5279
|
partitionSelect(
|
5280
|
+
this: MathJsChain<MathCollection>,
|
4828
5281
|
k: number,
|
4829
5282
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4830
5283
|
compare?: 'asc' | 'desc' | ((a: any, b: any) => number)
|
4831
|
-
): MathJsChain
|
5284
|
+
): MathJsChain<MathCollection>
|
4832
5285
|
|
4833
5286
|
/**
|
4834
5287
|
* Create an array from a range. By default, the range end is excluded.
|
@@ -4839,20 +5292,28 @@ declare namespace math {
|
|
4839
5292
|
* @param includeEnd: Option to specify whether to include the end or
|
4840
5293
|
* not. False by default
|
4841
5294
|
*/
|
4842
|
-
range(includeEnd?: boolean): Matrix
|
4843
|
-
range(
|
5295
|
+
range(this: MathJsChain<string>, includeEnd?: boolean): MathJsChain<Matrix>
|
5296
|
+
range(
|
5297
|
+
this: MathJsChain<number | BigNumber>,
|
5298
|
+
end: number | BigNumber,
|
5299
|
+
includeEnd?: boolean
|
5300
|
+
): MathJsChain<Matrix>
|
4844
5301
|
range(
|
5302
|
+
this: MathJsChain<number | BigNumber>,
|
4845
5303
|
end: number | BigNumber,
|
4846
5304
|
step: number | BigNumber,
|
4847
5305
|
includeEnd?: boolean
|
4848
|
-
): MathJsChain
|
5306
|
+
): MathJsChain<Matrix>
|
4849
5307
|
|
4850
5308
|
/**
|
4851
5309
|
* Reshape a multi dimensional array to fit the specified dimensions
|
4852
5310
|
* @param sizes One dimensional array with integral sizes for each
|
4853
5311
|
* dimension
|
4854
5312
|
*/
|
4855
|
-
reshape
|
5313
|
+
reshape<T extends MathCollection>(
|
5314
|
+
this: MathJsChain<T>,
|
5315
|
+
sizes: number[]
|
5316
|
+
): MathJsChain<T>
|
4856
5317
|
|
4857
5318
|
/**
|
4858
5319
|
* Resize a matrix
|
@@ -4860,12 +5321,20 @@ declare namespace math {
|
|
4860
5321
|
* @param defaultValue Zero by default, except in case of a string, in
|
4861
5322
|
* that case defaultValue = ' ' Default value: 0.
|
4862
5323
|
*/
|
4863
|
-
resize
|
5324
|
+
resize<T extends MathCollection>(
|
5325
|
+
this: MathJsChain<T>,
|
5326
|
+
size: MathCollection,
|
5327
|
+
defaultValue?: number | string
|
5328
|
+
): MathJsChain<T>
|
4864
5329
|
|
4865
5330
|
/**
|
4866
5331
|
* Calculate the size of a matrix or scalar.
|
4867
5332
|
*/
|
4868
|
-
size(
|
5333
|
+
size(
|
5334
|
+
this: MathJsChain<
|
5335
|
+
boolean | number | Complex | Unit | string | MathCollection
|
5336
|
+
>
|
5337
|
+
): MathJsChain<MathCollection>
|
4869
5338
|
|
4870
5339
|
/**
|
4871
5340
|
* Sort the items in a matrix
|
@@ -4873,22 +5342,25 @@ declare namespace math {
|
|
4873
5342
|
* is called as compare(a, b), and must return 1 when a > b, -1 when a <
|
4874
5343
|
* b, and 0 when a == b. Default value: ‘asc’
|
4875
5344
|
*/
|
4876
|
-
sort(
|
5345
|
+
sort<T extends Matrix | MathArray>(
|
5346
|
+
this: MathJsChain<T>,
|
4877
5347
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4878
5348
|
compare: ((a: any, b: any) => number) | 'asc' | 'desc' | 'natural'
|
4879
|
-
): MathJsChain
|
5349
|
+
): MathJsChain<T>
|
4880
5350
|
|
4881
5351
|
/**
|
4882
5352
|
* Calculate the principal square root of a square matrix. The principal
|
4883
5353
|
* square root matrix X of another matrix A is such that X * X = A.
|
4884
5354
|
*/
|
4885
|
-
|
5355
|
+
|
5356
|
+
sqrtm<T extends MathCollection>(A: MathJsChain<T>): MathJsChain<T>
|
4886
5357
|
|
4887
5358
|
/**
|
4888
5359
|
* Squeeze a matrix, remove inner and outer singleton dimensions from a
|
4889
5360
|
* matrix.
|
4890
5361
|
*/
|
4891
|
-
|
5362
|
+
|
5363
|
+
squeeze<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
4892
5364
|
|
4893
5365
|
/**
|
4894
5366
|
* Get or set a subset of a matrix or string.
|
@@ -4901,19 +5373,28 @@ declare namespace math {
|
|
4901
5373
|
* undefined. Default value: undefined.
|
4902
5374
|
*/
|
4903
5375
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4904
|
-
subset
|
5376
|
+
subset<T extends MathCollection | string>(
|
5377
|
+
this: MathJsChain<T>,
|
5378
|
+
index: Index,
|
5379
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5380
|
+
replacement?: any,
|
5381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5382
|
+
defaultValue?: any
|
5383
|
+
): MathJsChain<T>
|
4905
5384
|
|
4906
5385
|
/**
|
4907
5386
|
* Calculate the trace of a matrix: the sum of the elements on the main
|
4908
5387
|
* diagonal of a square matrix.
|
4909
5388
|
*/
|
4910
|
-
|
5389
|
+
|
5390
|
+
trace(this: MathJsChain<MathCollection>): MathJsChain<number>
|
4911
5391
|
|
4912
5392
|
/**
|
4913
5393
|
* Transpose a matrix. All values of the matrix are reflected over its
|
4914
5394
|
* main diagonal. Only two dimensional matrices are supported.
|
4915
5395
|
*/
|
4916
|
-
|
5396
|
+
|
5397
|
+
transpose<T extends MathCollection>(x: MathJsChain<T>): MathJsChain<T>
|
4917
5398
|
|
4918
5399
|
/**
|
4919
5400
|
* Create a matrix filled with zeros. The created matrix can have one or
|
@@ -4921,12 +5402,20 @@ declare namespace math {
|
|
4921
5402
|
* @param format The matrix storage format
|
4922
5403
|
* @returns A matrix filled with zeros
|
4923
5404
|
*/
|
4924
|
-
zeros(
|
5405
|
+
zeros(
|
5406
|
+
this: MathJsChain<number | number[]>,
|
5407
|
+
format?: string
|
5408
|
+
): MathJsChain<MathCollection>
|
5409
|
+
|
4925
5410
|
/**
|
4926
5411
|
* @param n The y dimension of the matrix
|
4927
5412
|
* @param format The matrix storage format
|
4928
5413
|
*/
|
4929
|
-
zeros(
|
5414
|
+
zeros(
|
5415
|
+
this: MathJsChain<number>,
|
5416
|
+
n: number,
|
5417
|
+
format?: string
|
5418
|
+
): MathJsChain<MathCollection>
|
4930
5419
|
|
4931
5420
|
/*************************************************************************
|
4932
5421
|
* Probability functions
|
@@ -4938,28 +5427,40 @@ declare namespace math {
|
|
4938
5427
|
* following condition must be enforced: k <= n.
|
4939
5428
|
* @param k Number of objects in the subset
|
4940
5429
|
*/
|
4941
|
-
combinations
|
5430
|
+
combinations<T extends number | BigNumber>(
|
5431
|
+
n: MathJsChain<T>,
|
5432
|
+
k: number | BigNumber
|
5433
|
+
): MathJsChain<NoLiteralType<T>>
|
4942
5434
|
|
4943
5435
|
/**
|
4944
5436
|
* Compute the factorial of a value Factorial only supports an integer
|
4945
5437
|
* value as argument. For matrices, the function is evaluated element
|
4946
5438
|
* wise.
|
4947
5439
|
*/
|
4948
|
-
|
5440
|
+
|
5441
|
+
factorial<T extends number | BigNumber | MathCollection>(
|
5442
|
+
n: MathJsChain<T>
|
5443
|
+
): MathJsChain<NoLiteralType<T>>
|
4949
5444
|
|
4950
5445
|
/**
|
4951
5446
|
* Compute the gamma function of a value using Lanczos approximation for
|
4952
5447
|
* small values, and an extended Stirling approximation for large
|
4953
5448
|
* values. For matrices, the function is evaluated element wise.
|
4954
5449
|
*/
|
4955
|
-
|
5450
|
+
|
5451
|
+
gamma<T extends number | BigNumber | Complex | MathCollection>(
|
5452
|
+
n: MathJsChain<T>
|
5453
|
+
): MathJsChain<NoLiteralType<T>>
|
4956
5454
|
|
4957
5455
|
/**
|
4958
5456
|
* Calculate the Kullback-Leibler (KL) divergence between two
|
4959
5457
|
* distributions
|
4960
5458
|
* @param p Second vector
|
4961
5459
|
*/
|
4962
|
-
kldivergence(
|
5460
|
+
kldivergence(
|
5461
|
+
this: MathJsChain<MathCollection>,
|
5462
|
+
p: MathCollection
|
5463
|
+
): MathJsChain<number>
|
4963
5464
|
|
4964
5465
|
/**
|
4965
5466
|
* Multinomial Coefficients compute the number of ways of picking a1,
|
@@ -4967,7 +5468,10 @@ declare namespace math {
|
|
4967
5468
|
* takes one array of integers as an argument. The following condition
|
4968
5469
|
* must be enforced: every ai <= 0
|
4969
5470
|
*/
|
4970
|
-
|
5471
|
+
|
5472
|
+
multinomial<T extends number | BigNumber>(
|
5473
|
+
a: MathJsChain<T[]>
|
5474
|
+
): MathJsChain<NoLiteralType<T>>
|
4971
5475
|
|
4972
5476
|
/**
|
4973
5477
|
* Compute the number of ways of obtaining an ordered subset of k
|
@@ -4975,7 +5479,10 @@ declare namespace math {
|
|
4975
5479
|
* arguments. The following condition must be enforced: k <= n.
|
4976
5480
|
* @param k The number of objects in the subset
|
4977
5481
|
*/
|
4978
|
-
permutations
|
5482
|
+
permutations<T extends number | BigNumber>(
|
5483
|
+
n: MathJsChain<T>,
|
5484
|
+
k?: number | BigNumber
|
5485
|
+
): MathJsChain<NoLiteralType<T>>
|
4979
5486
|
|
4980
5487
|
/**
|
4981
5488
|
* Random pick a value from a one dimensional array. Array element is
|
@@ -4983,7 +5490,11 @@ declare namespace math {
|
|
4983
5490
|
* @param number An int or float
|
4984
5491
|
* @param weights An array of ints or floats
|
4985
5492
|
*/
|
4986
|
-
pickRandom(
|
5493
|
+
pickRandom(
|
5494
|
+
array: MathJsChain<number[]>,
|
5495
|
+
number?: number,
|
5496
|
+
weights?: number[]
|
5497
|
+
): MathJsChain<number | number[]>
|
4987
5498
|
|
4988
5499
|
/**
|
4989
5500
|
* Return a random number larger or equal to min and smaller than max
|
@@ -4991,9 +5502,14 @@ declare namespace math {
|
|
4991
5502
|
* @param min Minimum boundary for the random value, included
|
4992
5503
|
* @param max Maximum boundary for the random value, excluded
|
4993
5504
|
*/
|
4994
|
-
random(max?: number): MathJsChain
|
5505
|
+
random(this: MathJsChain<number>, max?: number): MathJsChain<number>
|
5506
|
+
|
4995
5507
|
// tslint:disable-next-line unified-signatures
|
4996
|
-
random
|
5508
|
+
random<T extends MathCollection>(
|
5509
|
+
this: MathJsChain<T>,
|
5510
|
+
min?: number,
|
5511
|
+
max?: number
|
5512
|
+
): MathJsChain<T>
|
4997
5513
|
|
4998
5514
|
/**
|
4999
5515
|
* Return a random integer number larger or equal to min and smaller
|
@@ -5001,9 +5517,20 @@ declare namespace math {
|
|
5001
5517
|
* @param min Minimum boundary for the random value, included
|
5002
5518
|
* @param max Maximum boundary for the random value, excluded
|
5003
5519
|
*/
|
5004
|
-
randomInt
|
5520
|
+
randomInt<T extends MathCollection>(
|
5521
|
+
this: MathJsChain<T>,
|
5522
|
+
max?: number
|
5523
|
+
): MathJsChain<T>
|
5524
|
+
randomInt<T extends MathCollection>(
|
5525
|
+
this: MathJsChain<T>,
|
5526
|
+
max?: number
|
5527
|
+
): MathJsChain<T>
|
5005
5528
|
// tslint:disable-next-line unified-signatures
|
5006
|
-
randomInt
|
5529
|
+
randomInt<T extends MathCollection>(
|
5530
|
+
this: MathJsChain<T>,
|
5531
|
+
min: number,
|
5532
|
+
max: number
|
5533
|
+
): MathJsChain<T>
|
5007
5534
|
|
5008
5535
|
/*************************************************************************
|
5009
5536
|
* Relational functions
|
@@ -5017,7 +5544,10 @@ declare namespace math {
|
|
5017
5544
|
* For matrices, the function is evaluated element wise.
|
5018
5545
|
* @param y Second value to compare
|
5019
5546
|
*/
|
5020
|
-
compare(
|
5547
|
+
compare(
|
5548
|
+
this: MathJsChain<MathType | string>,
|
5549
|
+
y: MathType | string
|
5550
|
+
): MathJsChain<number | BigNumber | Fraction | MathCollection>
|
5021
5551
|
|
5022
5552
|
/**
|
5023
5553
|
* Compare two values of any type in a deterministic, natural way. For
|
@@ -5027,7 +5557,7 @@ declare namespace math {
|
|
5027
5557
|
* @param y Second value to compare
|
5028
5558
|
*/
|
5029
5559
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5030
|
-
compareNatural(y: any): MathJsChain
|
5560
|
+
compareNatural(this: MathJsChain<any>, y: any): MathJsChain<number>
|
5031
5561
|
|
5032
5562
|
/**
|
5033
5563
|
* Compare two strings lexically. Comparison is case sensitive. Returns
|
@@ -5035,14 +5565,22 @@ declare namespace math {
|
|
5035
5565
|
* function is evaluated element wise.
|
5036
5566
|
* @param y Second string to compare
|
5037
5567
|
*/
|
5038
|
-
compareText(
|
5568
|
+
compareText(
|
5569
|
+
this: MathJsChain<string | MathCollection>,
|
5570
|
+
y: string | MathCollection
|
5571
|
+
): MathJsChain<number | MathCollection>
|
5039
5572
|
|
5040
5573
|
/**
|
5041
5574
|
* Test element wise whether two matrices are equal. The function
|
5042
5575
|
* accepts both matrices and scalar values.
|
5043
5576
|
* @param y Second amtrix to compare
|
5044
5577
|
*/
|
5045
|
-
deepEqual(
|
5578
|
+
deepEqual(
|
5579
|
+
this: MathJsChain<MathType>,
|
5580
|
+
y: MathType
|
5581
|
+
): MathJsChain<
|
5582
|
+
number | BigNumber | Fraction | Complex | Unit | MathCollection
|
5583
|
+
>
|
5046
5584
|
|
5047
5585
|
/**
|
5048
5586
|
* Test whether two values are equal.
|
@@ -5056,14 +5594,20 @@ declare namespace math {
|
|
5056
5594
|
* else, and undefined is only equal to undefined and nothing else.
|
5057
5595
|
* @param y Second value to compare
|
5058
5596
|
*/
|
5059
|
-
equal(
|
5597
|
+
equal(
|
5598
|
+
this: MathJsChain<MathType | string>,
|
5599
|
+
y: MathType | string
|
5600
|
+
): MathJsChain<boolean | MathCollection>
|
5060
5601
|
|
5061
5602
|
/**
|
5062
5603
|
* Check equality of two strings. Comparison is case sensitive. For
|
5063
5604
|
* matrices, the function is evaluated element wise.
|
5064
5605
|
* @param y Second string to compare
|
5065
5606
|
*/
|
5066
|
-
equalText(
|
5607
|
+
equalText(
|
5608
|
+
this: MathJsChain<string | MathCollection>,
|
5609
|
+
y: string | MathCollection
|
5610
|
+
): MathJsChain<number | MathCollection>
|
5067
5611
|
|
5068
5612
|
/**
|
5069
5613
|
* Test whether value x is larger than y. The function returns true when
|
@@ -5073,7 +5617,10 @@ declare namespace math {
|
|
5073
5617
|
* function is evaluated element wise.
|
5074
5618
|
* @param y Second value to compare
|
5075
5619
|
*/
|
5076
|
-
larger(
|
5620
|
+
larger(
|
5621
|
+
this: MathJsChain<MathType | string>,
|
5622
|
+
y: MathType | string
|
5623
|
+
): MathJsChain<boolean | MathCollection>
|
5077
5624
|
|
5078
5625
|
/**
|
5079
5626
|
* Test whether value x is larger or equal to y. The function returns
|
@@ -5083,7 +5630,10 @@ declare namespace math {
|
|
5083
5630
|
* the function is evaluated element wise.
|
5084
5631
|
* @param y Second value to vcompare
|
5085
5632
|
*/
|
5086
|
-
largerEq(
|
5633
|
+
largerEq(
|
5634
|
+
this: MathJsChain<MathType | string>,
|
5635
|
+
y: MathType | string
|
5636
|
+
): MathJsChain<boolean | MathCollection>
|
5087
5637
|
|
5088
5638
|
/**
|
5089
5639
|
* Test whether value x is smaller than y. The function returns true
|
@@ -5093,7 +5643,10 @@ declare namespace math {
|
|
5093
5643
|
* the function is evaluated element wise.
|
5094
5644
|
* @param y Second value to vcompare
|
5095
5645
|
*/
|
5096
|
-
smaller(
|
5646
|
+
smaller(
|
5647
|
+
this: MathJsChain<MathType | string>,
|
5648
|
+
y: MathType | string
|
5649
|
+
): MathJsChain<boolean | MathCollection>
|
5097
5650
|
|
5098
5651
|
/**
|
5099
5652
|
* Test whether value x is smaller or equal to y. The function returns
|
@@ -5103,7 +5656,10 @@ declare namespace math {
|
|
5103
5656
|
* matrices, the function is evaluated element wise.
|
5104
5657
|
* @param y Second value to compare
|
5105
5658
|
*/
|
5106
|
-
smallerEq(
|
5659
|
+
smallerEq(
|
5660
|
+
this: MathJsChain<MathType | string>,
|
5661
|
+
y: MathType | string
|
5662
|
+
): MathJsChain<boolean | MathCollection>
|
5107
5663
|
|
5108
5664
|
/**
|
5109
5665
|
* Test whether two values are unequal. The function tests whether the
|
@@ -5116,7 +5672,10 @@ declare namespace math {
|
|
5116
5672
|
* undefined is unequal with everything except undefined.
|
5117
5673
|
* @param y Second value to vcompare
|
5118
5674
|
*/
|
5119
|
-
unequal(
|
5675
|
+
unequal(
|
5676
|
+
this: MathJsChain<MathType | string>,
|
5677
|
+
y: MathType | string
|
5678
|
+
): MathJsChain<boolean | MathCollection>
|
5120
5679
|
|
5121
5680
|
/*************************************************************************
|
5122
5681
|
* Set functions
|
@@ -5128,7 +5687,10 @@ declare namespace math {
|
|
5128
5687
|
* will be sorted in ascending order before the operation.
|
5129
5688
|
* @param a2 A (multi)set
|
5130
5689
|
*/
|
5131
|
-
setCartesian
|
5690
|
+
setCartesian<T extends MathCollection>(
|
5691
|
+
this: MathJsChain<T>,
|
5692
|
+
a2: MathCollection
|
5693
|
+
): MathJsChain<T>
|
5132
5694
|
|
5133
5695
|
/**
|
5134
5696
|
* Create the difference of two (multi)sets: every element of set1, that
|
@@ -5136,20 +5698,27 @@ declare namespace math {
|
|
5136
5698
|
* to single-dimension arrays before the operation
|
5137
5699
|
* @param a2 A (multi)set
|
5138
5700
|
*/
|
5139
|
-
setDifference
|
5701
|
+
setDifference<T extends MathCollection>(
|
5702
|
+
this: MathJsChain<T>,
|
5703
|
+
a2: MathCollection
|
5704
|
+
): MathJsChain<T>
|
5140
5705
|
|
5141
5706
|
/**
|
5142
5707
|
* Collect the distinct elements of a multiset. A multi-dimension array
|
5143
5708
|
* will be converted to a single-dimension array before the operation.
|
5144
5709
|
*/
|
5145
|
-
|
5710
|
+
|
5711
|
+
setDistinct<T extends MathCollection>(a: MathJsChain<T>): MathJsChain<T>
|
5146
5712
|
|
5147
5713
|
/**
|
5148
5714
|
* Create the intersection of two (multi)sets. Multi-dimension arrays
|
5149
5715
|
* will be converted to single-dimension arrays before the operation.
|
5150
5716
|
* @param a2 A (multi)set
|
5151
5717
|
*/
|
5152
|
-
setIntersect
|
5718
|
+
setIntersect<T extends MathCollection>(
|
5719
|
+
this: MathJsChain<T>,
|
5720
|
+
a2: MathCollection
|
5721
|
+
): MathJsChain<T>
|
5153
5722
|
|
5154
5723
|
/**
|
5155
5724
|
* Check whether a (multi)set is a subset of another (multi)set. (Every
|
@@ -5157,7 +5726,10 @@ declare namespace math {
|
|
5157
5726
|
* be converted to single-dimension arrays before the operation.
|
5158
5727
|
* @param a2 A (multi)set
|
5159
5728
|
*/
|
5160
|
-
setIsSubset(
|
5729
|
+
setIsSubset(
|
5730
|
+
this: MathJsChain<MathCollection>,
|
5731
|
+
a2: MathCollection
|
5732
|
+
): MathJsChain<boolean>
|
5161
5733
|
|
5162
5734
|
/**
|
5163
5735
|
* Count the multiplicity of an element in a multiset. A multi-dimension
|
@@ -5165,21 +5737,26 @@ declare namespace math {
|
|
5165
5737
|
* operation.
|
5166
5738
|
* @param a A multiset
|
5167
5739
|
*/
|
5168
|
-
setMultiplicity(
|
5740
|
+
setMultiplicity(
|
5741
|
+
e: MathJsChain<number | BigNumber | Fraction | Complex>,
|
5742
|
+
a: MathCollection
|
5743
|
+
): MathJsChain<number>
|
5169
5744
|
|
5170
5745
|
/**
|
5171
5746
|
* Create the powerset of a (multi)set. (The powerset contains very
|
5172
5747
|
* possible subsets of a (multi)set.) A multi-dimension array will be
|
5173
5748
|
* converted to a single-dimension array before the operation.
|
5174
5749
|
*/
|
5175
|
-
|
5750
|
+
|
5751
|
+
setPowerset<T extends MathCollection>(a: MathJsChain<T>): MathJsChain<T>
|
5176
5752
|
|
5177
5753
|
/**
|
5178
5754
|
* Count the number of elements of a (multi)set. When a second parameter
|
5179
5755
|
* is ‘true’, count only the unique values. A multi-dimension array will
|
5180
5756
|
* be converted to a single-dimension array before the operation.
|
5181
5757
|
*/
|
5182
|
-
|
5758
|
+
|
5759
|
+
setSize(this: MathJsChain<MathCollection>): MathJsChain<number>
|
5183
5760
|
|
5184
5761
|
/**
|
5185
5762
|
* Create the symmetric difference of two (multi)sets. Multi-dimension
|
@@ -5187,14 +5764,20 @@ declare namespace math {
|
|
5187
5764
|
* operation.
|
5188
5765
|
* @param a2 A (multi)set
|
5189
5766
|
*/
|
5190
|
-
setSymDifference
|
5767
|
+
setSymDifference<T extends MathCollection>(
|
5768
|
+
this: MathJsChain<T>,
|
5769
|
+
a2: MathCollection
|
5770
|
+
): MathJsChain<T>
|
5191
5771
|
|
5192
5772
|
/**
|
5193
5773
|
* Create the union of two (multi)sets. Multi-dimension arrays will be
|
5194
5774
|
* converted to single-dimension arrays before the operation.
|
5195
5775
|
* @param a2 A (multi)set
|
5196
5776
|
*/
|
5197
|
-
setUnion
|
5777
|
+
setUnion<T extends MathCollection>(
|
5778
|
+
this: MathJsChain<T>,
|
5779
|
+
a2: MathCollection
|
5780
|
+
): MathJsChain<T>
|
5198
5781
|
|
5199
5782
|
/*************************************************************************
|
5200
5783
|
* Special functions
|
@@ -5204,7 +5787,9 @@ declare namespace math {
|
|
5204
5787
|
* Compute the erf function of a value using a rational Chebyshev
|
5205
5788
|
* approximations for different intervals of x.
|
5206
5789
|
*/
|
5207
|
-
erf(
|
5790
|
+
erf<T extends number | MathCollection>(
|
5791
|
+
this: MathJsChain<T>
|
5792
|
+
): MathJsChain<NoLiteralType<T>>
|
5208
5793
|
|
5209
5794
|
/*************************************************************************
|
5210
5795
|
* Statistics functions
|
@@ -5215,7 +5800,8 @@ declare namespace math {
|
|
5215
5800
|
* values. The median absolute deviation is defined as the median of the
|
5216
5801
|
* absolute deviations from the median.
|
5217
5802
|
*/
|
5218
|
-
|
5803
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5804
|
+
mad(this: MathJsChain<MathCollection>): MathJsChain<any>
|
5219
5805
|
|
5220
5806
|
/**
|
5221
5807
|
* Compute the maximum value of a matrix or a list with values. In case
|
@@ -5224,7 +5810,11 @@ declare namespace math {
|
|
5224
5810
|
* dimension will be calculated. Parameter dim is zero-based.
|
5225
5811
|
* @param dim The maximum over the selected dimension
|
5226
5812
|
*/
|
5227
|
-
|
5813
|
+
|
5814
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5815
|
+
max(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5816
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5817
|
+
max(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5228
5818
|
|
5229
5819
|
/**
|
5230
5820
|
* Compute the mean value of matrix or a list with values. In case of a
|
@@ -5233,7 +5823,10 @@ declare namespace math {
|
|
5233
5823
|
* dimension will be calculated. Parameter dim is zero-based.
|
5234
5824
|
* @param dim The mean over the selected dimension
|
5235
5825
|
*/
|
5236
|
-
|
5826
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5827
|
+
mean(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5828
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5829
|
+
mean(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5237
5830
|
|
5238
5831
|
/**
|
5239
5832
|
* Compute the median of a matrix or a list with values. The values are
|
@@ -5243,7 +5836,10 @@ declare namespace math {
|
|
5243
5836
|
* dimensional) array or matrix, the median of all elements will be
|
5244
5837
|
* calculated.
|
5245
5838
|
*/
|
5246
|
-
|
5839
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5840
|
+
median(this: MathJsChain<MathType[]>, dim?: number): MathJsChain<any>
|
5841
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5842
|
+
median(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5247
5843
|
|
5248
5844
|
/**
|
5249
5845
|
* Compute the maximum value of a matrix or a list of values. In case of
|
@@ -5252,21 +5848,26 @@ declare namespace math {
|
|
5252
5848
|
* dimension will be calculated. Parameter dim is zero-based.
|
5253
5849
|
* @param dim The minimum over the selected dimension
|
5254
5850
|
*/
|
5255
|
-
|
5851
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5852
|
+
min(this: MathJsChain<MathType[]>): MathJsChain<MathType[]>
|
5853
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5854
|
+
min(this: MathJsChain<MathCollection>, dim?: number): MathJsChain<any>
|
5256
5855
|
|
5257
5856
|
/**
|
5258
5857
|
* Computes the mode of a set of numbers or a list with values(numbers
|
5259
5858
|
* or characters). If there are more than one modes, it returns a list
|
5260
5859
|
* of those values.
|
5261
5860
|
*/
|
5262
|
-
|
5861
|
+
|
5862
|
+
mode(this: MathJsChain<MathType[]>): MathJsChain<MathType[]>
|
5263
5863
|
|
5264
5864
|
/**
|
5265
5865
|
* Compute the product of a matrix or a list with values. In case of a
|
5266
5866
|
* (multi dimensional) array or matrix, the sum of all elements will be
|
5267
5867
|
* calculated.
|
5268
5868
|
*/
|
5269
|
-
|
5869
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5870
|
+
prod(this: MathJsChain<MathType[]>): MathJsChain<any>
|
5270
5871
|
|
5271
5872
|
/**
|
5272
5873
|
* Compute the prob order quantile of a matrix or a list with values.
|
@@ -5281,9 +5882,11 @@ declare namespace math {
|
|
5281
5882
|
* @param sorted =false is data sorted in ascending order
|
5282
5883
|
*/
|
5283
5884
|
quantileSeq(
|
5885
|
+
A: MathJsChain<MathCollection>,
|
5284
5886
|
prob: number | BigNumber | MathArray,
|
5285
5887
|
sorted?: boolean
|
5286
|
-
): MathJsChain
|
5888
|
+
): MathJsChain<number | BigNumber | Unit | MathArray>
|
5889
|
+
|
5287
5890
|
/**
|
5288
5891
|
* Compute the standard deviation of a matrix or a list with values. The
|
5289
5892
|
* standard deviations is defined as the square root of the variance:
|
@@ -5301,9 +5904,11 @@ declare namespace math {
|
|
5301
5904
|
* @returns The standard deviation
|
5302
5905
|
*/
|
5303
5906
|
std(
|
5907
|
+
this: MathJsChain<number[]>,
|
5304
5908
|
dim?: number,
|
5305
5909
|
normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5306
|
-
): MathJsChain
|
5910
|
+
): MathJsChain<number>
|
5911
|
+
|
5307
5912
|
/**
|
5308
5913
|
* Compute the standard deviation of a matrix or a list with values. The
|
5309
5914
|
* standard deviations is defined as the square root of the variance:
|
@@ -5319,14 +5924,22 @@ declare namespace math {
|
|
5319
5924
|
* ‘unbiased’.
|
5320
5925
|
* @returns The standard deviation
|
5321
5926
|
*/
|
5322
|
-
std(
|
5927
|
+
std(
|
5928
|
+
this: MathJsChain<MathCollection>,
|
5929
|
+
dimension?: number,
|
5930
|
+
normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5931
|
+
): MathJsChain<number[]>
|
5323
5932
|
|
5324
5933
|
/**
|
5325
5934
|
* Compute the sum of a matrix or a list with values. In case of a
|
5326
5935
|
* (multi dimensional) array or matrix, the sum of all elements will be
|
5327
5936
|
* calculated.
|
5328
5937
|
*/
|
5329
|
-
|
5938
|
+
std(
|
5939
|
+
this: MathJsChain<MathCollection>,
|
5940
|
+
normalization: 'unbiased' | 'uncorrected' | 'biased'
|
5941
|
+
): MathJsChain<number>
|
5942
|
+
|
5330
5943
|
/**
|
5331
5944
|
* Compute the variance of a matrix or a list with values. In case of a
|
5332
5945
|
* (multi dimensional) array or matrix, the variance over all elements
|
@@ -5345,9 +5958,9 @@ declare namespace math {
|
|
5345
5958
|
* @returns The variance
|
5346
5959
|
*/
|
5347
5960
|
variance(
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5961
|
+
this: MathJsChain<Array<Array<number | BigNumber | Fraction>>>
|
5962
|
+
): MathJsChain<number>
|
5963
|
+
|
5351
5964
|
/**
|
5352
5965
|
* Compute the variance of a matrix or a list with values. In case of a
|
5353
5966
|
* (multi dimensional) array or matrix, the variance over all elements
|
@@ -5364,7 +5977,16 @@ declare namespace math {
|
|
5364
5977
|
* Default value: ‘unbiased’.
|
5365
5978
|
* @returns The variance
|
5366
5979
|
*/
|
5367
|
-
variance(
|
5980
|
+
variance(
|
5981
|
+
this: MathJsChain<MathCollection>,
|
5982
|
+
dimension?: number,
|
5983
|
+
normalization?: 'unbiased' | 'uncorrected' | 'biased'
|
5984
|
+
): MathJsChain<number[]>
|
5985
|
+
|
5986
|
+
variance(
|
5987
|
+
this: MathJsChain<MathCollection>,
|
5988
|
+
normalization: 'unbiased' | 'uncorrected' | 'biased'
|
5989
|
+
): MathJsChain<number>
|
5368
5990
|
|
5369
5991
|
/*************************************************************************
|
5370
5992
|
* String functions
|
@@ -5382,13 +6004,15 @@ declare namespace math {
|
|
5382
6004
|
* @see http://mathjs.org/docs/reference/functions/format.html
|
5383
6005
|
*/
|
5384
6006
|
format(
|
6007
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6008
|
+
this: MathJsChain<any>,
|
5385
6009
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5386
6010
|
value: any,
|
5387
6011
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5388
6012
|
options?: FormatOptions | number | ((item: any) => string),
|
5389
6013
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5390
6014
|
callback?: (value: any) => string
|
5391
|
-
): MathJsChain
|
6015
|
+
): MathJsChain<string>
|
5392
6016
|
|
5393
6017
|
/**
|
5394
6018
|
* Interpolate values into a string template.
|
@@ -5400,11 +6024,12 @@ declare namespace math {
|
|
5400
6024
|
* numbers. See function math.format for a description of all options.
|
5401
6025
|
*/
|
5402
6026
|
print(
|
6027
|
+
this: MathJsChain<string>,
|
5403
6028
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5404
6029
|
values: any,
|
5405
6030
|
precision?: number,
|
5406
6031
|
options?: number | object
|
5407
|
-
): MathJsChain
|
6032
|
+
): MathJsChain<string>
|
5408
6033
|
|
5409
6034
|
/*************************************************************************
|
5410
6035
|
* Trigonometry functions
|
@@ -5414,161 +6039,271 @@ declare namespace math {
|
|
5414
6039
|
* Calculate the inverse cosine of a value. For matrices, the function
|
5415
6040
|
* is evaluated element wise.
|
5416
6041
|
*/
|
5417
|
-
|
6042
|
+
|
6043
|
+
acos(this: MathJsChain<number>): MathJsChain<number>
|
6044
|
+
acos(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6045
|
+
acos(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6046
|
+
acos(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6047
|
+
acos(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5418
6048
|
|
5419
6049
|
/**
|
5420
6050
|
* Calculate the hyperbolic arccos of a value, defined as acosh(x) =
|
5421
6051
|
* ln(sqrt(x^2 - 1) + x). For matrices, the function is evaluated
|
5422
6052
|
* element wise.
|
5423
6053
|
*/
|
5424
|
-
|
6054
|
+
|
6055
|
+
acosh(this: MathJsChain<number>): MathJsChain<number>
|
6056
|
+
acosh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6057
|
+
acosh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6058
|
+
acosh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6059
|
+
acosh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5425
6060
|
|
5426
6061
|
/**
|
5427
6062
|
* Calculate the inverse cotangent of a value. For matrices, the
|
5428
6063
|
* function is evaluated element wise.
|
5429
6064
|
*/
|
5430
|
-
|
6065
|
+
|
6066
|
+
acot(this: MathJsChain<number>): MathJsChain<number>
|
6067
|
+
acot(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6068
|
+
acot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6069
|
+
acot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5431
6070
|
|
5432
6071
|
/**
|
5433
6072
|
* Calculate the hyperbolic arccotangent of a value, defined as acoth(x)
|
5434
6073
|
* = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is
|
5435
6074
|
* evaluated element wise.
|
5436
6075
|
*/
|
5437
|
-
|
6076
|
+
|
6077
|
+
acoth(this: MathJsChain<number>): MathJsChain<number>
|
6078
|
+
acoth(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6079
|
+
acoth(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6080
|
+
acoth(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5438
6081
|
|
5439
6082
|
/**
|
5440
6083
|
* Calculate the inverse cosecant of a value. For matrices, the function
|
5441
6084
|
* is evaluated element wise.
|
5442
6085
|
*/
|
5443
|
-
|
6086
|
+
|
6087
|
+
acsc(this: MathJsChain<number>): MathJsChain<number>
|
6088
|
+
acsc(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6089
|
+
acsc(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6090
|
+
acsc(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5444
6091
|
|
5445
6092
|
/**
|
5446
6093
|
* Calculate the hyperbolic arccosecant of a value, defined as acsch(x)
|
5447
6094
|
* = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated
|
5448
6095
|
* element wise.
|
5449
6096
|
*/
|
5450
|
-
|
6097
|
+
|
6098
|
+
acsch(this: MathJsChain<number>): MathJsChain<number>
|
6099
|
+
acsch(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6100
|
+
acsch(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6101
|
+
acsch(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5451
6102
|
|
5452
6103
|
/**
|
5453
6104
|
* Calculate the inverse secant of a value. For matrices, the function
|
5454
6105
|
* is evaluated element wise.
|
5455
6106
|
*/
|
5456
|
-
|
6107
|
+
|
6108
|
+
asec(this: MathJsChain<number>): MathJsChain<number>
|
6109
|
+
asec(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6110
|
+
asec(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6111
|
+
asec(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5457
6112
|
|
5458
6113
|
/**
|
5459
6114
|
* Calculate the hyperbolic arcsecant of a value, defined as asech(x) =
|
5460
6115
|
* ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated
|
5461
6116
|
* element wise.
|
5462
6117
|
*/
|
5463
|
-
|
6118
|
+
|
6119
|
+
asech(this: MathJsChain<number>): MathJsChain<number>
|
6120
|
+
asech(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6121
|
+
asech(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6122
|
+
asech(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5464
6123
|
|
5465
6124
|
/**
|
5466
6125
|
* Calculate the inverse sine of a value. For matrices, the function is
|
5467
6126
|
* evaluated element wise.
|
5468
6127
|
*/
|
5469
|
-
|
6128
|
+
|
6129
|
+
asin(this: MathJsChain<number>): MathJsChain<number>
|
6130
|
+
asin(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6131
|
+
asin(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6132
|
+
asin(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6133
|
+
asin(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5470
6134
|
|
5471
6135
|
/**
|
5472
6136
|
* Calculate the hyperbolic arcsine of a value, defined as asinh(x) =
|
5473
6137
|
* ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated
|
5474
6138
|
* element wise.
|
5475
6139
|
*/
|
5476
|
-
|
6140
|
+
|
6141
|
+
asinh(this: MathJsChain<number>): MathJsChain<number>
|
6142
|
+
asinh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6143
|
+
asinh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6144
|
+
asinh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5477
6145
|
|
5478
6146
|
/**
|
5479
6147
|
* Calculate the inverse tangent of a value. For matrices, the function
|
5480
6148
|
* is evaluated element wise.
|
5481
6149
|
*/
|
5482
|
-
|
6150
|
+
|
6151
|
+
atan(this: MathJsChain<number>): MathJsChain<number>
|
6152
|
+
atan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6153
|
+
atan(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6154
|
+
atan(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5483
6155
|
|
5484
6156
|
/**
|
5485
6157
|
* Calculate the inverse tangent function with two arguments, y/x. By
|
5486
6158
|
* providing two arguments, the right quadrant of the computed angle can
|
5487
6159
|
* be determined. For matrices, the function is evaluated element wise.
|
5488
6160
|
*/
|
5489
|
-
|
6161
|
+
|
6162
|
+
atan2(this: MathJsChain<number>, x: number): MathJsChain<number>
|
6163
|
+
atan2(
|
6164
|
+
this: MathJsChain<MathCollection>,
|
6165
|
+
x: MathCollection
|
6166
|
+
): MathJsChain<MathCollection>
|
5490
6167
|
|
5491
6168
|
/**
|
5492
6169
|
* Calculate the hyperbolic arctangent of a value, defined as atanh(x) =
|
5493
6170
|
* ln((1 + x)/(1 - x)) / 2. For matrices, the function is evaluated
|
5494
6171
|
* element wise.
|
5495
6172
|
*/
|
5496
|
-
|
6173
|
+
|
6174
|
+
atanh(this: MathJsChain<number>): MathJsChain<number>
|
6175
|
+
atanh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6176
|
+
atanh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6177
|
+
atanh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5497
6178
|
|
5498
6179
|
/**
|
5499
6180
|
* Calculate the cosine of a value. For matrices, the function is
|
5500
6181
|
* evaluated element wise.
|
5501
6182
|
*/
|
5502
|
-
|
6183
|
+
|
6184
|
+
cos(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6185
|
+
cos(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6186
|
+
cos(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6187
|
+
cos(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6188
|
+
cos(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5503
6189
|
|
5504
6190
|
/**
|
5505
6191
|
* Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2
|
5506
6192
|
* * (exp(x) + exp(-x)). For matrices, the function is evaluated element
|
5507
6193
|
* wise.
|
5508
6194
|
*/
|
5509
|
-
|
6195
|
+
|
6196
|
+
cosh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6197
|
+
cosh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6198
|
+
cosh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6199
|
+
cosh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6200
|
+
cosh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5510
6201
|
|
5511
6202
|
/**
|
5512
6203
|
* Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x).
|
5513
6204
|
* For matrices, the function is evaluated element wise.
|
5514
6205
|
*/
|
5515
|
-
|
6206
|
+
|
6207
|
+
cot(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6208
|
+
cot(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6209
|
+
cot(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6210
|
+
cot(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5516
6211
|
|
5517
6212
|
/**
|
5518
6213
|
* Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1
|
5519
6214
|
* / tanh(x). For matrices, the function is evaluated element wise.
|
5520
6215
|
*/
|
5521
|
-
|
6216
|
+
|
6217
|
+
coth(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6218
|
+
coth(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6219
|
+
coth(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6220
|
+
coth(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5522
6221
|
|
5523
6222
|
/**
|
5524
6223
|
* Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For
|
5525
6224
|
* matrices, the function is evaluated element wise.
|
5526
6225
|
*/
|
5527
|
-
|
6226
|
+
|
6227
|
+
csc(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6228
|
+
csc(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6229
|
+
csc(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6230
|
+
csc(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5528
6231
|
|
5529
6232
|
/**
|
5530
6233
|
* Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1
|
5531
6234
|
* / sinh(x). For matrices, the function is evaluated element wise.
|
5532
6235
|
*/
|
5533
|
-
|
6236
|
+
|
6237
|
+
csch(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6238
|
+
csch(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6239
|
+
csch(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6240
|
+
csch(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5534
6241
|
|
5535
6242
|
/**
|
5536
6243
|
* Calculate the secant of a value, defined as sec(x) = 1/cos(x). For
|
5537
6244
|
* matrices, the function is evaluated element wise.
|
5538
6245
|
*/
|
5539
|
-
|
6246
|
+
|
6247
|
+
sec(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6248
|
+
sec(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6249
|
+
sec(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6250
|
+
sec(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5540
6251
|
|
5541
6252
|
/**
|
5542
6253
|
* Calculate the hyperbolic secant of a value, defined as sech(x) = 1 /
|
5543
6254
|
* cosh(x). For matrices, the function is evaluated element wise.
|
5544
6255
|
*/
|
5545
|
-
|
6256
|
+
|
6257
|
+
sech(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6258
|
+
sech(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6259
|
+
sech(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6260
|
+
sech(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5546
6261
|
|
5547
6262
|
/**
|
5548
6263
|
* Calculate the sine of a value. For matrices, the function is
|
5549
6264
|
* evaluated element wise.
|
5550
6265
|
*/
|
5551
|
-
|
6266
|
+
|
6267
|
+
sin(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6268
|
+
sin(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6269
|
+
sin(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6270
|
+
sin(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6271
|
+
sin(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5552
6272
|
|
5553
6273
|
/**
|
5554
6274
|
* Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 *
|
5555
6275
|
* (exp(x) - exp(-x)). For matrices, the function is evaluated element
|
5556
6276
|
* wise.
|
5557
6277
|
*/
|
5558
|
-
|
6278
|
+
|
6279
|
+
sinh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6280
|
+
sinh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6281
|
+
sinh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6282
|
+
sinh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6283
|
+
sinh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5559
6284
|
|
5560
6285
|
/**
|
5561
6286
|
* Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x).
|
5562
6287
|
* For matrices, the function is evaluated element wise.
|
5563
6288
|
*/
|
5564
|
-
|
6289
|
+
|
6290
|
+
tan(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6291
|
+
tan(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6292
|
+
tan(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6293
|
+
tan(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6294
|
+
tan(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5565
6295
|
|
5566
6296
|
/**
|
5567
6297
|
* Calculate the hyperbolic tangent of a value, defined as tanh(x) =
|
5568
6298
|
* (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is
|
5569
6299
|
* evaluated element wise.
|
5570
6300
|
*/
|
5571
|
-
|
6301
|
+
|
6302
|
+
tanh(this: MathJsChain<number | Unit>): MathJsChain<number>
|
6303
|
+
tanh(this: MathJsChain<BigNumber>): MathJsChain<BigNumber>
|
6304
|
+
tanh(this: MathJsChain<Complex>): MathJsChain<Complex>
|
6305
|
+
tanh(this: MathJsChain<MathArray>): MathJsChain<MathArray>
|
6306
|
+
tanh(this: MathJsChain<Matrix>): MathJsChain<Matrix>
|
5572
6307
|
|
5573
6308
|
/*************************************************************************
|
5574
6309
|
* Unit functions
|
@@ -5580,7 +6315,10 @@ declare namespace math {
|
|
5580
6315
|
* @param unit New unit. Can be a string like "cm" or a unit without
|
5581
6316
|
* value.
|
5582
6317
|
*/
|
5583
|
-
to(
|
6318
|
+
to(
|
6319
|
+
this: MathJsChain<Unit | MathCollection>,
|
6320
|
+
unit: Unit | string
|
6321
|
+
): MathJsChain<Unit | MathCollection>
|
5584
6322
|
|
5585
6323
|
/*************************************************************************
|
5586
6324
|
* Utils functions
|
@@ -5589,60 +6327,86 @@ declare namespace math {
|
|
5589
6327
|
/**
|
5590
6328
|
* Clone an object.
|
5591
6329
|
*/
|
5592
|
-
|
6330
|
+
|
6331
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6332
|
+
clone<TValue>(this: MathJsChain<TValue>): MathJsChain<TValue>
|
5593
6333
|
|
5594
6334
|
/**
|
5595
6335
|
* Test whether a value is an integer number. The function supports
|
5596
6336
|
* number, BigNumber, and Fraction. The function is evaluated
|
5597
6337
|
* element-wise in case of Array or Matrix input.
|
5598
6338
|
*/
|
5599
|
-
|
6339
|
+
|
6340
|
+
isInteger(
|
6341
|
+
this: MathJsChain<number | BigNumber | Fraction | MathCollection>
|
6342
|
+
): MathJsChain<boolean>
|
5600
6343
|
|
5601
6344
|
/**
|
5602
6345
|
* Test whether a value is NaN (not a number). The function supports
|
5603
6346
|
* types number, BigNumber, Fraction, Unit and Complex. The function is
|
5604
6347
|
* evaluated element-wise in case of Array or Matrix input.
|
5605
6348
|
*/
|
5606
|
-
|
6349
|
+
|
6350
|
+
isNaN(
|
6351
|
+
this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6352
|
+
): MathJsChain<boolean>
|
5607
6353
|
|
5608
6354
|
/**
|
5609
6355
|
* Test whether a value is negative: smaller than zero. The function
|
5610
6356
|
* supports types number, BigNumber, Fraction, and Unit. The function is
|
5611
6357
|
* evaluated element-wise in case of Array or Matrix input.
|
5612
6358
|
*/
|
5613
|
-
|
6359
|
+
|
6360
|
+
isNegative(
|
6361
|
+
this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6362
|
+
): MathJsChain<boolean>
|
5614
6363
|
|
5615
6364
|
/**
|
5616
6365
|
* Test whether a value is an numeric value. The function is evaluated
|
5617
6366
|
* element-wise in case of Array or Matrix input.
|
5618
6367
|
*/
|
5619
|
-
|
6368
|
+
|
6369
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6370
|
+
isNumeric(this: MathJsChain<any>): MathJsChain<boolean>
|
5620
6371
|
|
5621
6372
|
/**
|
5622
6373
|
* Test whether a value is positive: larger than zero. The function
|
5623
6374
|
* supports types number, BigNumber, Fraction, and Unit. The function is
|
5624
6375
|
* evaluated element-wise in case of Array or Matrix input.
|
5625
6376
|
*/
|
5626
|
-
|
6377
|
+
|
6378
|
+
isPositive(
|
6379
|
+
this: MathJsChain<number | BigNumber | Fraction | MathCollection | Unit>
|
6380
|
+
): MathJsChain<boolean>
|
5627
6381
|
|
5628
6382
|
/**
|
5629
6383
|
* Test whether a value is prime: has no divisors other than itself and
|
5630
6384
|
* one. The function supports type number, bignumber. The function is
|
5631
6385
|
* evaluated element-wise in case of Array or Matrix input.
|
5632
6386
|
*/
|
5633
|
-
|
6387
|
+
|
6388
|
+
isPrime(
|
6389
|
+
this: MathJsChain<number | BigNumber | MathCollection>
|
6390
|
+
): MathJsChain<boolean>
|
5634
6391
|
|
5635
6392
|
/**
|
5636
6393
|
* Test whether a value is zero. The function can check for zero for
|
5637
6394
|
* types number, BigNumber, Fraction, Complex, and Unit. The function is
|
5638
6395
|
* evaluated element-wise in case of Array or Matrix input.
|
5639
6396
|
*/
|
5640
|
-
|
6397
|
+
|
6398
|
+
isZero(
|
6399
|
+
this: MathJsChain<
|
6400
|
+
number | BigNumber | Fraction | MathCollection | Unit | Complex
|
6401
|
+
>
|
6402
|
+
): MathJsChain<boolean>
|
5641
6403
|
|
5642
6404
|
/**
|
5643
6405
|
* Determine the type of a variable.
|
5644
6406
|
*/
|
5645
|
-
|
6407
|
+
|
6408
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6409
|
+
typeOf(this: MathJsChain<any>): MathJsChain<string>
|
5646
6410
|
}
|
5647
6411
|
|
5648
6412
|
interface ImportOptions {
|