mathjs 9.5.2 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +15 -1
- package/lib/browser/math.js +4 -4
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/constants.js +1 -1
- package/lib/cjs/core/function/config.js +1 -1
- package/lib/cjs/core/function/import.js +2 -1
- package/lib/cjs/entry/dependenciesAny.generated.js +999 -999
- package/lib/cjs/entry/dependenciesNumber.generated.js +581 -581
- package/lib/cjs/entry/impureFunctionsAny.generated.js +314 -313
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +223 -222
- package/lib/cjs/entry/mainAny.js +8 -8
- package/lib/cjs/entry/mainNumber.js +8 -8
- package/lib/cjs/entry/pureFunctionsAny.generated.js +1100 -1100
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +375 -375
- package/lib/cjs/entry/typeChecks.js +12 -12
- package/lib/cjs/expression/operators.js +1 -1
- package/lib/cjs/factoriesAny.js +660 -660
- package/lib/cjs/factoriesNumber.js +268 -237
- package/lib/cjs/header.js +1 -1
- package/lib/cjs/plain/bignumber/arithmetic.js +2 -2
- package/lib/cjs/plain/number/arithmetic.js +10 -10
- package/lib/cjs/plain/number/constants.js +1 -1
- package/lib/cjs/plain/number/logical.js +1 -1
- package/lib/cjs/plain/number/probability.js +2 -1
- package/lib/cjs/plain/number/trigonometry.js +1 -1
- package/lib/cjs/plain/number/utils.js +1 -1
- package/lib/cjs/type/unit/physicalConstants.js +1 -1
- package/lib/cjs/utils/array.js +14 -14
- package/lib/cjs/utils/bignumber/bitwise.js +1 -1
- package/lib/cjs/utils/customs.js +5 -5
- package/lib/cjs/utils/factory.js +3 -3
- package/lib/cjs/utils/function.js +1 -1
- package/lib/cjs/utils/is.js +23 -23
- package/lib/cjs/utils/latex.js +2 -1
- package/lib/cjs/utils/map.js +3 -3
- package/lib/cjs/utils/noop.js +1 -1
- package/lib/cjs/utils/number.js +10 -6
- package/lib/cjs/utils/object.js +8 -8
- package/lib/cjs/utils/snapshot.js +1 -1
- package/lib/cjs/utils/string.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/function/import.js +2 -1
- package/lib/esm/entry/dependenciesAny.generated.js +270 -270
- package/lib/esm/entry/dependenciesNumber.generated.js +163 -163
- package/lib/esm/entry/impureFunctionsAny.generated.js +301 -301
- package/lib/esm/entry/impureFunctionsNumber.generated.js +211 -211
- package/lib/esm/entry/pureFunctionsAny.generated.js +816 -816
- package/lib/esm/entry/pureFunctionsNumber.generated.js +234 -234
- package/lib/esm/version.js +1 -1
- package/package.json +16 -16
- package/types/index.d.ts +250 -71
package/lib/esm/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export var version = '
|
1
|
+
export var version = '10.0.0'; // Note: This file is automatically generated when building math.js.
|
2
2
|
// Changes made in this file will be overwritten.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "
|
3
|
+
"version": "10.0.0",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"unit"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@babel/runtime": "^7.
|
28
|
+
"@babel/runtime": "^7.16.0",
|
29
29
|
"complex.js": "^2.0.15",
|
30
30
|
"decimal.js": "^10.3.1",
|
31
31
|
"escape-latex": "^1.2.0",
|
@@ -36,28 +36,28 @@
|
|
36
36
|
"typed-function": "^2.0.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.
|
40
|
-
"@babel/plugin-transform-object-assign": "7.
|
41
|
-
"@babel/plugin-transform-runtime": "7.
|
42
|
-
"@babel/preset-env": "7.
|
43
|
-
"@babel/register": "7.
|
44
|
-
"babel-loader": "8.2.
|
39
|
+
"@babel/core": "7.16.0",
|
40
|
+
"@babel/plugin-transform-object-assign": "7.16.0",
|
41
|
+
"@babel/plugin-transform-runtime": "7.16.0",
|
42
|
+
"@babel/preset-env": "7.16.0",
|
43
|
+
"@babel/register": "7.16.0",
|
44
|
+
"babel-loader": "8.2.3",
|
45
45
|
"benchmark": "2.1.4",
|
46
46
|
"codecov": "3.8.3",
|
47
|
-
"core-js": "3.
|
47
|
+
"core-js": "3.19.1",
|
48
48
|
"del": "6.0.0",
|
49
|
-
"dtslint": "4.
|
49
|
+
"dtslint": "4.2.0",
|
50
50
|
"expr-eval": "2.0.2",
|
51
51
|
"fancy-log": "1.3.3",
|
52
|
-
"glob": "7.
|
52
|
+
"glob": "7.2.0",
|
53
53
|
"gulp": "4.0.2",
|
54
54
|
"gulp-babel": "8.0.0",
|
55
55
|
"handlebars": "4.7.7",
|
56
56
|
"istanbul": "0.4.5",
|
57
|
-
"jsep": "1.0
|
58
|
-
"karma": "6.3.
|
57
|
+
"jsep": "1.2.0",
|
58
|
+
"karma": "6.3.7",
|
59
59
|
"karma-browserstack-launcher": "1.6.0",
|
60
|
-
"karma-firefox-launcher": "2.1.
|
60
|
+
"karma-firefox-launcher": "2.1.2",
|
61
61
|
"karma-mocha": "2.0.1",
|
62
62
|
"karma-mocha-reporter": "2.2.5",
|
63
63
|
"karma-webpack": "4.0.2",
|
@@ -72,9 +72,9 @@
|
|
72
72
|
"numericjs": "1.2.6",
|
73
73
|
"nyc": "15.1.0",
|
74
74
|
"pad-right": "0.2.2",
|
75
|
-
"standard": "16.0.
|
75
|
+
"standard": "16.0.4",
|
76
76
|
"sylvester": "0.0.21",
|
77
|
-
"typescript": "4.4.
|
77
|
+
"typescript": "4.4.4",
|
78
78
|
"webpack": "4.46.0",
|
79
79
|
"zeros": "1.0.0"
|
80
80
|
},
|
package/types/index.d.ts
CHANGED
@@ -5,10 +5,10 @@ export as namespace math;
|
|
5
5
|
export = math;
|
6
6
|
|
7
7
|
type NoLiteralType<T> =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
T extends number ? number :
|
9
|
+
T extends string ? string :
|
10
|
+
T extends boolean ? boolean :
|
11
|
+
T;
|
12
12
|
|
13
13
|
declare namespace math {
|
14
14
|
type MathArray = number[] | number[][];
|
@@ -156,6 +156,168 @@ declare namespace math {
|
|
156
156
|
isHexDigit(c: string): boolean;
|
157
157
|
}
|
158
158
|
|
159
|
+
interface AccessorNode extends MathNodeCommon {
|
160
|
+
type: 'AccessorNode';
|
161
|
+
isAccessorNode: true;
|
162
|
+
object: MathNode;
|
163
|
+
index: IndexNode;
|
164
|
+
name: string;
|
165
|
+
}
|
166
|
+
interface AccessorNodeCtor {
|
167
|
+
new(object: MathNode, index: IndexNode): AccessorNode;
|
168
|
+
}
|
169
|
+
|
170
|
+
interface ArrayNode extends MathNodeCommon {
|
171
|
+
type: 'ArrayNode';
|
172
|
+
isArrayNode: true;
|
173
|
+
items: MathNode[];
|
174
|
+
}
|
175
|
+
interface ArrayNodeCtor {
|
176
|
+
new(items: MathNode[]): ArrayNode;
|
177
|
+
}
|
178
|
+
|
179
|
+
interface AssignmentNode extends MathNodeCommon {
|
180
|
+
type: 'AssignmentNode';
|
181
|
+
isAssignmentNode: true;
|
182
|
+
object: SymbolNode | AccessorNode;
|
183
|
+
index: IndexNode | null;
|
184
|
+
value: MathNode;
|
185
|
+
name: string;
|
186
|
+
}
|
187
|
+
interface AssignmentNodeCtor {
|
188
|
+
new(object: SymbolNode, value: MathNode): AssignmentNode;
|
189
|
+
new(object: SymbolNode | AccessorNode, index: IndexNode, value: MathNode): AssignmentNode;
|
190
|
+
}
|
191
|
+
|
192
|
+
interface BlockNode extends MathNodeCommon {
|
193
|
+
type: 'BlockNode';
|
194
|
+
isBlockNode: true;
|
195
|
+
blocks: Array<{node: MathNode, visible: boolean}>;
|
196
|
+
}
|
197
|
+
interface BlockNodeCtor {
|
198
|
+
new(arr: Array<{node: MathNode} | {node: MathNode, visible: boolean}>): BlockNode;
|
199
|
+
}
|
200
|
+
|
201
|
+
interface ConditionalNode extends MathNodeCommon {
|
202
|
+
type: 'ConditionalNode';
|
203
|
+
isConditionalNode: boolean;
|
204
|
+
condition: MathNode;
|
205
|
+
trueExpr: MathNode;
|
206
|
+
falseExpr: MathNode;
|
207
|
+
}
|
208
|
+
interface ConditionalNodeCtor {
|
209
|
+
new(condition: MathNode, trueExpr: MathNode, falseExpr: MathNode): ConditionalNode;
|
210
|
+
}
|
211
|
+
|
212
|
+
interface ConstantNode extends MathNodeCommon {
|
213
|
+
type: 'ConstantNode';
|
214
|
+
isConstantNode: true;
|
215
|
+
value: any;
|
216
|
+
}
|
217
|
+
|
218
|
+
interface ConstantNodeCtor {
|
219
|
+
new(constant: number): ConstantNode;
|
220
|
+
}
|
221
|
+
|
222
|
+
interface FunctionAssignmentNode extends MathNodeCommon {
|
223
|
+
type: 'FunctionAssignmentNode';
|
224
|
+
isFunctionAssignmentNode: true;
|
225
|
+
name: string;
|
226
|
+
params: string[];
|
227
|
+
expr: MathNode;
|
228
|
+
}
|
229
|
+
interface FunctionAssignmentNodeCtor {
|
230
|
+
new(name: string, params: string[], expr: MathNode): FunctionAssignmentNode;
|
231
|
+
}
|
232
|
+
|
233
|
+
interface FunctionNode extends MathNodeCommon {
|
234
|
+
type: 'FunctionNode';
|
235
|
+
isFunctionNode: true;
|
236
|
+
fn: SymbolNode;
|
237
|
+
args: MathNode[];
|
238
|
+
}
|
239
|
+
interface FunctionNodeCtor {
|
240
|
+
new(fn: MathNode | string, args: MathNode[]): FunctionNode;
|
241
|
+
}
|
242
|
+
|
243
|
+
interface IndexNode extends MathNodeCommon {
|
244
|
+
type: 'IndexNode';
|
245
|
+
isIndexNode: true;
|
246
|
+
dimensions: MathNode[];
|
247
|
+
dotNotation: boolean;
|
248
|
+
}
|
249
|
+
interface IndexNodeCtor {
|
250
|
+
new(dimensions: MathNode[]): IndexNode;
|
251
|
+
new(dimensions: MathNode[], dotNotation: boolean): IndexNode;
|
252
|
+
}
|
253
|
+
|
254
|
+
interface ObjectNode extends MathNodeCommon {
|
255
|
+
type: 'ObjectNode';
|
256
|
+
isObjectNode: true;
|
257
|
+
properties: Record<string, MathNode>;
|
258
|
+
}
|
259
|
+
interface ObjectNodeCtor {
|
260
|
+
new(properties: Record<string, MathNode>): ObjectNode;
|
261
|
+
}
|
262
|
+
|
263
|
+
interface OperatorNode extends MathNodeCommon {
|
264
|
+
type: 'OperatorNode';
|
265
|
+
isOperatorNode: true;
|
266
|
+
op: string;
|
267
|
+
fn: string;
|
268
|
+
args: MathNode[];
|
269
|
+
implicit: boolean;
|
270
|
+
isUnary(): boolean;
|
271
|
+
isBinary(): boolean;
|
272
|
+
}
|
273
|
+
interface OperatorNodeCtor {
|
274
|
+
new(op: string, fn: string, args: MathNode[], implicit?: boolean): OperatorNode;
|
275
|
+
}
|
276
|
+
|
277
|
+
interface ParenthesisNode extends MathNodeCommon {
|
278
|
+
type: 'ParenthesisNode';
|
279
|
+
isParenthesisNode: true;
|
280
|
+
content: MathNode;
|
281
|
+
}
|
282
|
+
interface ParenthesisNodeCtor {
|
283
|
+
new(content: MathNode): ParenthesisNode;
|
284
|
+
}
|
285
|
+
|
286
|
+
interface RangeNode extends MathNodeCommon {
|
287
|
+
type: 'RangeNode';
|
288
|
+
isRangeNode: true;
|
289
|
+
start: MathNode;
|
290
|
+
end: MathNode;
|
291
|
+
step: MathNode | null;
|
292
|
+
}
|
293
|
+
interface RangeNodeCtor {
|
294
|
+
new(start: MathNode, end: MathNode, step?: MathNode): RangeNode;
|
295
|
+
}
|
296
|
+
|
297
|
+
interface RelationalNode extends MathNodeCommon {
|
298
|
+
type: 'RelationalNode';
|
299
|
+
isRelationalNode: true;
|
300
|
+
conditionals: string[];
|
301
|
+
params: MathNode[];
|
302
|
+
}
|
303
|
+
interface RelationalNodeCtor {
|
304
|
+
new(conditionals: string[], params: MathNode[]): RelationalNode;
|
305
|
+
}
|
306
|
+
|
307
|
+
interface SymbolNode extends MathNodeCommon {
|
308
|
+
type: 'SymbolNode';
|
309
|
+
isSymbolNode: true;
|
310
|
+
name: string;
|
311
|
+
}
|
312
|
+
interface SymbolNodeCtor {
|
313
|
+
new(name: string): SymbolNode;
|
314
|
+
}
|
315
|
+
|
316
|
+
type MathNode = AccessorNode | ArrayNode | AssignmentNode | BlockNode | ConditionalNode | ConstantNode |
|
317
|
+
FunctionAssignmentNode | FunctionNode | IndexNode | ObjectNode | OperatorNode | ParenthesisNode | RangeNode |
|
318
|
+
RelationalNode | SymbolNode;
|
319
|
+
|
320
|
+
|
159
321
|
type MathJsFunctionName = keyof MathJsStatic;
|
160
322
|
|
161
323
|
interface MathJsStatic extends FactoryDependencies {
|
@@ -173,6 +335,23 @@ declare namespace math {
|
|
173
335
|
SQRT2: number;
|
174
336
|
tau: number;
|
175
337
|
|
338
|
+
// Class-like constructors
|
339
|
+
AccessorNode: AccessorNodeCtor;
|
340
|
+
ArrayNode: ArrayNodeCtor;
|
341
|
+
AssignmentNode: AssignmentNodeCtor;
|
342
|
+
BlockNode: BlockNodeCtor;
|
343
|
+
ConditionalNode: ConditionalNodeCtor;
|
344
|
+
ConstantNode: ConstantNodeCtor;
|
345
|
+
FunctionAssignmentNode: FunctionAssignmentNodeCtor;
|
346
|
+
FunctionNode: FunctionNodeCtor;
|
347
|
+
IndexNode: IndexNodeCtor;
|
348
|
+
ObjectNode: ObjectNodeCtor;
|
349
|
+
OperatorNode: OperatorNodeCtor;
|
350
|
+
ParenthesisNode: ParenthesisNodeCtor;
|
351
|
+
RangeNode: RangeNodeCtor;
|
352
|
+
RelationalNode: RelationalNodeCtor;
|
353
|
+
SymbolNode: SymbolNodeCtor;
|
354
|
+
|
176
355
|
/**
|
177
356
|
* If null were to be included in this interface, it would be
|
178
357
|
* auto-suggested as an import in VSCode. This causes issues because
|
@@ -310,8 +489,8 @@ declare namespace math {
|
|
310
489
|
* @returns Returns a fraction
|
311
490
|
*/
|
312
491
|
fraction(
|
313
|
-
|
314
|
-
|
492
|
+
numerator: number | string | MathArray | Matrix,
|
493
|
+
denominator?: number | string | MathArray | Matrix
|
315
494
|
): Fraction | MathArray | Matrix;
|
316
495
|
|
317
496
|
/**
|
@@ -500,6 +679,7 @@ declare namespace math {
|
|
500
679
|
*/
|
501
680
|
qr(A: Matrix | MathArray): { Q: MathArray | Matrix; R: MathArray | Matrix };
|
502
681
|
|
682
|
+
rationalize(expr: MathNode | string, optional?: object | boolean, detailed?: false): MathNode;
|
503
683
|
/**
|
504
684
|
* Transform a rationalizable expression in a rational fraction. If
|
505
685
|
* rational fraction is one variable polynomial then converts the
|
@@ -513,11 +693,11 @@ declare namespace math {
|
|
513
693
|
* @returns The rational polynomial of expr
|
514
694
|
*/
|
515
695
|
rationalize(
|
516
|
-
|
517
|
-
|
518
|
-
|
696
|
+
expr: MathNode | string,
|
697
|
+
optional?: object | boolean,
|
698
|
+
detailed?: true
|
519
699
|
): { expression: MathNode | string; variables: string[]; coefficients: MathType[] };
|
520
|
-
|
700
|
+
|
521
701
|
|
522
702
|
/**
|
523
703
|
* Simplify an expression tree.
|
@@ -530,13 +710,7 @@ declare namespace math {
|
|
530
710
|
* @param [options] (optional) An object with simplify options
|
531
711
|
* @returns Returns the simplified form of expr
|
532
712
|
*/
|
533
|
-
simplify
|
534
|
-
expr: MathNode | string,
|
535
|
-
rules?: Array<{ l: string; r: string } | string | ((node: MathNode) => MathNode)>,
|
536
|
-
scope?: object,
|
537
|
-
options?: SimplifyOptions,
|
538
|
-
): MathNode;
|
539
|
-
simplify(expr: MathNode | string, scope?: object, options?: SimplifyOptions): MathNode;
|
713
|
+
simplify: Simplify;
|
540
714
|
|
541
715
|
/**
|
542
716
|
* Calculate the Sparse Matrix LU decomposition with full pivoting.
|
@@ -649,6 +823,7 @@ declare namespace math {
|
|
649
823
|
* @returns Quotient, x / y
|
650
824
|
*/
|
651
825
|
divide(x: Unit, y: Unit): Unit | number;
|
826
|
+
divide(x: Unit, y: number): Unit;
|
652
827
|
divide(x: number, y: number): number;
|
653
828
|
divide(x: MathType, y: MathType): MathType;
|
654
829
|
|
@@ -728,17 +903,17 @@ declare namespace math {
|
|
728
903
|
floor(x: MathArray): MathArray;
|
729
904
|
floor(x: Matrix): Matrix;
|
730
905
|
|
731
|
-
|
906
|
+
/**
|
732
907
|
* Round a value towards minus infinity. For matrices, the function is
|
733
908
|
* evaluated element wise.
|
734
909
|
* @param x Number to be rounded
|
735
910
|
* @param n Number of decimals Default value: 0.
|
736
911
|
* @returns Rounded value
|
737
912
|
*/
|
738
|
-
|
913
|
+
floor(
|
739
914
|
x: number | BigNumber | Fraction | Complex | MathArray | Matrix,
|
740
915
|
n: number | BigNumber | MathArray
|
741
|
-
|
916
|
+
): number | BigNumber | Fraction | Complex | MathArray | Matrix;
|
742
917
|
|
743
918
|
/**
|
744
919
|
* Calculate the greatest common divisor for two or more values or
|
@@ -834,8 +1009,8 @@ declare namespace math {
|
|
834
1009
|
* @returns Returns the remainder of x divided by y
|
835
1010
|
*/
|
836
1011
|
mod<T extends number | BigNumber | Fraction | MathArray | Matrix>(
|
837
|
-
|
838
|
-
|
1012
|
+
x: T,
|
1013
|
+
y: number | BigNumber | Fraction | MathArray | Matrix
|
839
1014
|
): NoLiteralType<T>;
|
840
1015
|
|
841
1016
|
/**
|
@@ -888,8 +1063,8 @@ declare namespace math {
|
|
888
1063
|
* @returns Rounded value of x
|
889
1064
|
*/
|
890
1065
|
round<T extends number | BigNumber | Fraction | Complex | MathArray | Matrix>(
|
891
|
-
|
892
|
-
|
1066
|
+
x: T,
|
1067
|
+
n?: number | BigNumber | MathArray
|
893
1068
|
): NoLiteralType<T>;
|
894
1069
|
|
895
1070
|
/**
|
@@ -941,6 +1116,8 @@ declare namespace math {
|
|
941
1116
|
* @param y Value to subtract from x
|
942
1117
|
* @returns Subtraction of x and y
|
943
1118
|
*/
|
1119
|
+
subtract(x: number, y: number): number;
|
1120
|
+
subtract(x: Unit, y: Unit): Unit;
|
944
1121
|
subtract(x: MathType, y: MathType): MathType;
|
945
1122
|
|
946
1123
|
/**
|
@@ -1201,8 +1378,8 @@ declare namespace math {
|
|
1201
1378
|
* nonzero/nonempty value.
|
1202
1379
|
*/
|
1203
1380
|
and(
|
1204
|
-
|
1205
|
-
|
1381
|
+
x: number | BigNumber | Complex | Unit | MathArray | Matrix,
|
1382
|
+
y: number | BigNumber | Complex | Unit | MathArray | Matrix
|
1206
1383
|
): boolean | MathArray | Matrix;
|
1207
1384
|
|
1208
1385
|
/**
|
@@ -1223,8 +1400,8 @@ declare namespace math {
|
|
1223
1400
|
* nonzero/nonempty value.
|
1224
1401
|
*/
|
1225
1402
|
or(
|
1226
|
-
|
1227
|
-
|
1403
|
+
x: number | BigNumber | Complex | Unit | MathArray | Matrix,
|
1404
|
+
y: number | BigNumber | Complex | Unit | MathArray | Matrix
|
1228
1405
|
): boolean | MathArray | Matrix;
|
1229
1406
|
|
1230
1407
|
/**
|
@@ -1237,8 +1414,8 @@ declare namespace math {
|
|
1237
1414
|
* nonzero/nonempty value.
|
1238
1415
|
*/
|
1239
1416
|
xor(
|
1240
|
-
|
1241
|
-
|
1417
|
+
x: number | BigNumber | Complex | Unit | MathArray | Matrix,
|
1418
|
+
y: number | BigNumber | Complex | Unit | MathArray | Matrix
|
1242
1419
|
): boolean | MathArray | Matrix;
|
1243
1420
|
|
1244
1421
|
/*************************************************************************
|
@@ -1255,7 +1432,7 @@ declare namespace math {
|
|
1255
1432
|
* array or 1-d matrix as an input and return a number.
|
1256
1433
|
* @returns The residual matrix with the function applied over some dimension.
|
1257
1434
|
*/
|
1258
|
-
|
1435
|
+
apply<T extends MathArray | Matrix>(array: T, dim: number, callback: (array: MathArray | Matrix) => number): T
|
1259
1436
|
|
1260
1437
|
|
1261
1438
|
/**
|
@@ -1325,7 +1502,7 @@ declare namespace math {
|
|
1325
1502
|
* @param prec Precision, default value: 1e-15
|
1326
1503
|
* @returns Object containing an array of eigenvalues and a matrix with eigenvectors as columns.
|
1327
1504
|
*/
|
1328
|
-
|
1505
|
+
eigs(x: MathArray | Matrix, prec?:number|BigNumber): {values: MathArray | Matrix, vectors: MathArray | Matrix}
|
1329
1506
|
|
1330
1507
|
/**
|
1331
1508
|
* Compute the matrix exponential, expm(A) = e^A. The matrix must be
|
@@ -1364,8 +1541,8 @@ declare namespace math {
|
|
1364
1541
|
* traversed. The function must return a boolean.
|
1365
1542
|
*/
|
1366
1543
|
filter(
|
1367
|
-
|
1368
|
-
|
1544
|
+
x: Matrix | MathArray | string[],
|
1545
|
+
test: ((value: any, index: any, matrix: Matrix | MathArray | string[]) => boolean) | RegExp
|
1369
1546
|
): Matrix | MathArray;
|
1370
1547
|
|
1371
1548
|
/**
|
@@ -2442,7 +2619,7 @@ declare namespace math {
|
|
2442
2619
|
*/
|
2443
2620
|
clone(x: any): any;
|
2444
2621
|
|
2445
|
-
|
2622
|
+
/**
|
2446
2623
|
* Test whether a value is an numeric value. In case of a string,
|
2447
2624
|
* true is returned if the string contains a numeric value.
|
2448
2625
|
* @param x Value to be tested
|
@@ -2450,7 +2627,7 @@ declare namespace math {
|
|
2450
2627
|
* Returns false for other types.
|
2451
2628
|
* Throws an error in case of unknown types.
|
2452
2629
|
*/
|
2453
|
-
|
2630
|
+
hasNumericValue(x: any ): boolean| boolean[];
|
2454
2631
|
|
2455
2632
|
/**
|
2456
2633
|
* Test whether a value is an integer number. The function supports
|
@@ -2553,12 +2730,12 @@ declare namespace math {
|
|
2553
2730
|
* Factory and Dependencies
|
2554
2731
|
************************************************************************/
|
2555
2732
|
interface FactoryDependencies {
|
2556
|
-
create: (factories: FactoryFunctionMap, config?: ConfigOptions) =>
|
2733
|
+
create: (factories: FactoryFunctionMap, config?: ConfigOptions) => MathJsStatic;
|
2557
2734
|
factory: <T>(
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2735
|
+
name: string,
|
2736
|
+
dependencies: MathJsFunctionName[],
|
2737
|
+
create: (injected: Partial<MathJsStatic>) => T,
|
2738
|
+
meta?: any
|
2562
2739
|
) => FactoryFunction<T>;
|
2563
2740
|
all: FactoryFunctionMap;
|
2564
2741
|
|
@@ -2955,8 +3132,8 @@ declare namespace math {
|
|
2955
3132
|
pow(unit: Unit): Unit;
|
2956
3133
|
abs(unit: Unit): Unit;
|
2957
3134
|
to(unit: string): Unit;
|
2958
|
-
toNumber(unit
|
2959
|
-
toNumeric(unit
|
3135
|
+
toNumber(unit?: string): number;
|
3136
|
+
toNumeric(unit?: string): number | Fraction | BigNumber;
|
2960
3137
|
toSI(): Unit;
|
2961
3138
|
toString(): string;
|
2962
3139
|
toJSON(): MathJSON;
|
@@ -2983,6 +3160,26 @@ declare namespace math {
|
|
2983
3160
|
fractionsLimit?: number;
|
2984
3161
|
}
|
2985
3162
|
|
3163
|
+
type SimplifyRule = { l: string; r: string } | string | ((node: MathNode) => MathNode);
|
3164
|
+
|
3165
|
+
interface Simplify {
|
3166
|
+
(
|
3167
|
+
expr: MathNode | string,
|
3168
|
+
rules?: SimplifyRule[],
|
3169
|
+
scope?: object,
|
3170
|
+
options?: SimplifyOptions,
|
3171
|
+
): MathNode;
|
3172
|
+
(
|
3173
|
+
expr: MathNode | string,
|
3174
|
+
scope?: object,
|
3175
|
+
options?: SimplifyOptions,
|
3176
|
+
): MathNode;
|
3177
|
+
|
3178
|
+
rules: SimplifyRule[];
|
3179
|
+
|
3180
|
+
simplifyCore(expr: MathNode): MathNode;
|
3181
|
+
}
|
3182
|
+
|
2986
3183
|
interface UnitDefinition {
|
2987
3184
|
definition?: string | Unit;
|
2988
3185
|
prefixes?: string;
|
@@ -2996,32 +3193,14 @@ declare namespace math {
|
|
2996
3193
|
evaluate(scope?: any): any;
|
2997
3194
|
}
|
2998
3195
|
|
2999
|
-
interface
|
3000
|
-
isNode:
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
isConstantNode?: boolean;
|
3007
|
-
isFunctionAssignmentNode?: boolean;
|
3008
|
-
isFunctionNode?: boolean;
|
3009
|
-
isIndexNode?: boolean;
|
3010
|
-
isObjectNode?: boolean;
|
3011
|
-
isOperatorNode?: boolean;
|
3012
|
-
isParenthesisNode?: boolean;
|
3013
|
-
isRangeNode?: boolean;
|
3014
|
-
isRelationalNode?: boolean;
|
3015
|
-
isSymbolNode?: boolean;
|
3196
|
+
interface MathNodeCommon {
|
3197
|
+
isNode: true;
|
3198
|
+
comment: string;
|
3199
|
+
type: 'AccessorNode' | 'ArrayNode' | 'AssignmentNode' | 'BlockNode' | 'ConditionalNode' | 'ConstantNode' |
|
3200
|
+
'FunctionAssignmentNode' | 'FunctionNode' | 'IndexNode' | 'ObjectNode' | 'OperatorNode' | 'ParenthesisNode' |
|
3201
|
+
'RangeNode' | 'RelationalNode' | 'SymbolNode';
|
3202
|
+
|
3016
3203
|
isUpdateNode?: boolean;
|
3017
|
-
comment?: string;
|
3018
|
-
content?: MathNode;
|
3019
|
-
op?: string;
|
3020
|
-
fn?: string;
|
3021
|
-
args?: MathNode[];
|
3022
|
-
type: string;
|
3023
|
-
name?: string;
|
3024
|
-
value?: any;
|
3025
3204
|
|
3026
3205
|
/**
|
3027
3206
|
* Create a shallow clone of the node. The node itself is cloned, its
|
@@ -3096,7 +3275,7 @@ declare namespace math {
|
|
3096
3275
|
/**
|
3097
3276
|
* Get a HTML representation of the parsed expression.
|
3098
3277
|
*/
|
3099
|
-
|
3278
|
+
toHTML(options?: object): string;
|
3100
3279
|
|
3101
3280
|
/**
|
3102
3281
|
* Get a string representation of the parsed expression. This is not
|
@@ -3459,7 +3638,7 @@ declare namespace math {
|
|
3459
3638
|
* can be specified as an object, string, or function.
|
3460
3639
|
* @param scope Scope to variables
|
3461
3640
|
*/
|
3462
|
-
simplify(rules?:
|
3641
|
+
simplify(rules?: SimplifyRule[], scope?: object): MathJsChain;
|
3463
3642
|
|
3464
3643
|
/**
|
3465
3644
|
* Calculate the Sparse Matrix LU decomposition with full pivoting.
|
@@ -3511,7 +3690,7 @@ declare namespace math {
|
|
3511
3690
|
* array or 1-d matrix as an input and return a number.
|
3512
3691
|
* @returns The residual matrix with the function applied over some dimension.
|
3513
3692
|
*/
|
3514
|
-
|
3693
|
+
apply(dim: number, callback: (array: Array<MathType> | Matrix) => number): MathJsChain;
|
3515
3694
|
|
3516
3695
|
/**
|
3517
3696
|
* Calculate the cubic root of a value. For matrices, the function is
|