mathjs 11.0.0 → 11.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +6 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/function/algebra/derivative.js +3 -3
- package/lib/cjs/function/algebra/simplify.js +3 -1
- package/lib/cjs/function/algebra/symbolicEqual.js +5 -6
- package/lib/cjs/function/arithmetic/fix.js +1 -1
- package/lib/cjs/function/arithmetic/floor.js +1 -1
- package/lib/cjs/function/arithmetic/invmod.js +1 -1
- package/lib/cjs/function/arithmetic/nthRoot.js +3 -3
- package/lib/cjs/function/arithmetic/nthRoots.js +2 -2
- package/lib/cjs/function/bitwise/bitNot.js +1 -1
- package/lib/cjs/function/bitwise/leftShift.js +1 -1
- package/lib/cjs/function/bitwise/rightArithShift.js +1 -1
- package/lib/cjs/function/bitwise/rightLogShift.js +1 -1
- package/lib/cjs/function/geometry/distance.js +2 -2
- package/lib/cjs/function/matrix/diff.js +1 -1
- package/lib/cjs/function/matrix/rotate.js +5 -5
- package/lib/cjs/function/string/format.js +2 -2
- package/lib/cjs/function/string/hex.js +1 -2
- package/lib/cjs/function/trigonometry/acot.js +2 -3
- package/lib/cjs/function/trigonometry/acsc.js +2 -3
- package/lib/cjs/function/trigonometry/asec.js +2 -2
- package/lib/cjs/function/trigonometry/asin.js +1 -1
- package/lib/cjs/function/trigonometry/atan.js +1 -2
- package/lib/cjs/function/trigonometry/atan2.js +1 -1
- package/lib/cjs/function/utils/clone.js +1 -1
- package/lib/cjs/function/utils/hasNumericValue.js +1 -1
- package/lib/cjs/function/utils/isInteger.js +1 -1
- package/lib/cjs/function/utils/isNaN.js +1 -1
- package/lib/cjs/function/utils/isNegative.js +1 -1
- package/lib/cjs/function/utils/isNumeric.js +1 -1
- package/lib/cjs/function/utils/isPositive.js +1 -1
- package/lib/cjs/function/utils/isZero.js +11 -11
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/function/algebra/derivative.js +3 -3
- package/lib/esm/function/algebra/simplify.js +3 -1
- package/lib/esm/function/algebra/symbolicEqual.js +5 -6
- package/lib/esm/function/arithmetic/fix.js +1 -1
- package/lib/esm/function/arithmetic/floor.js +1 -1
- package/lib/esm/function/arithmetic/invmod.js +1 -1
- package/lib/esm/function/arithmetic/nthRoot.js +3 -3
- package/lib/esm/function/arithmetic/nthRoots.js +2 -2
- package/lib/esm/function/bitwise/bitNot.js +1 -1
- package/lib/esm/function/bitwise/leftShift.js +1 -1
- package/lib/esm/function/bitwise/rightArithShift.js +1 -1
- package/lib/esm/function/bitwise/rightLogShift.js +1 -1
- package/lib/esm/function/geometry/distance.js +2 -2
- package/lib/esm/function/matrix/diff.js +1 -1
- package/lib/esm/function/matrix/rotate.js +5 -5
- package/lib/esm/function/string/format.js +2 -2
- package/lib/esm/function/string/hex.js +1 -2
- package/lib/esm/function/trigonometry/acot.js +2 -3
- package/lib/esm/function/trigonometry/acsc.js +2 -3
- package/lib/esm/function/trigonometry/asec.js +2 -2
- package/lib/esm/function/trigonometry/asin.js +1 -1
- package/lib/esm/function/trigonometry/atan.js +1 -2
- package/lib/esm/function/trigonometry/atan2.js +1 -1
- package/lib/esm/function/utils/clone.js +1 -1
- package/lib/esm/function/utils/hasNumericValue.js +1 -1
- package/lib/esm/function/utils/isInteger.js +1 -1
- package/lib/esm/function/utils/isNaN.js +1 -1
- package/lib/esm/function/utils/isNegative.js +1 -1
- package/lib/esm/function/utils/isNumeric.js +1 -1
- package/lib/esm/function/utils/isPositive.js +1 -1
- package/lib/esm/function/utils/isZero.js +11 -11
- package/lib/esm/version.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +7 -3
- package/types/index.ts +102 -95
package/types/index.ts
CHANGED
@@ -1,35 +1,48 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
factory,
|
4
|
-
all,
|
5
|
-
MathJsFunctionName,
|
6
|
-
fractionDependencies,
|
2
|
+
AccessorNode,
|
7
3
|
addDependencies,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
MathJsChain,
|
4
|
+
all,
|
5
|
+
ArrayNode,
|
6
|
+
AssignmentNode,
|
12
7
|
BigNumber,
|
13
|
-
|
8
|
+
BlockNode,
|
14
9
|
Complex,
|
15
|
-
|
10
|
+
ConditionalNode,
|
11
|
+
ConstantNode,
|
12
|
+
create,
|
13
|
+
divideDependencies,
|
14
|
+
EvalFunction,
|
15
|
+
factory,
|
16
|
+
formatDependencies,
|
16
17
|
Fraction,
|
17
|
-
|
18
|
+
fractionDependencies,
|
19
|
+
FunctionAssignmentNode,
|
20
|
+
FunctionNode,
|
21
|
+
Help,
|
18
22
|
Index,
|
19
|
-
|
20
|
-
EvalFunction,
|
23
|
+
IndexNode,
|
21
24
|
LUDecomposition,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
MathArray,
|
26
|
+
MathCollection,
|
27
|
+
MathJsChain,
|
28
|
+
MathJsFunctionName,
|
29
|
+
MathNode,
|
30
|
+
MathNodeCommon,
|
25
31
|
MathNumericType,
|
26
|
-
|
32
|
+
MathType,
|
33
|
+
Matrix,
|
34
|
+
ObjectNode,
|
27
35
|
OperatorNode,
|
28
36
|
OperatorNodeFn,
|
29
37
|
OperatorNodeOp,
|
30
|
-
SymbolNode,
|
31
38
|
ParenthesisNode,
|
39
|
+
PolarCoordinates,
|
40
|
+
QRDecomposition,
|
41
|
+
RangeNode,
|
32
42
|
SimplifyRule,
|
43
|
+
SLUDecomposition,
|
44
|
+
SymbolNode,
|
45
|
+
Unit,
|
33
46
|
} from 'mathjs'
|
34
47
|
import * as assert from 'assert'
|
35
48
|
import { expectTypeOf } from 'expect-type'
|
@@ -125,8 +138,8 @@ Basic usage examples
|
|
125
138
|
) // Matrix + Array
|
126
139
|
|
127
140
|
// narrowed type inference
|
128
|
-
const _b:
|
129
|
-
const _c:
|
141
|
+
const _b: Matrix = math.add(math.matrix([2]), math.matrix([3]))
|
142
|
+
const _c: Matrix = math.subtract(math.matrix([4]), math.matrix([5]))
|
130
143
|
}
|
131
144
|
|
132
145
|
/*
|
@@ -944,18 +957,18 @@ Complex numbers examples
|
|
944
957
|
|
945
958
|
// create a complex number from polar coordinates
|
946
959
|
{
|
947
|
-
const p:
|
960
|
+
const p: PolarCoordinates = {
|
948
961
|
r: math.sqrt(2) as number, // must be real but a sqrt could be Complex
|
949
962
|
phi: math.pi / 4,
|
950
963
|
}
|
951
|
-
const c:
|
964
|
+
const c: Complex = math.complex(p)
|
952
965
|
assert.strictEqual(c.im, 1)
|
953
966
|
assert.ok(Math.abs(c.re - 1) < 1e-12)
|
954
967
|
}
|
955
968
|
|
956
969
|
// get polar coordinates of a complex number
|
957
970
|
{
|
958
|
-
const _p:
|
971
|
+
const _p: PolarCoordinates = math.complex(3, 4).toPolar()
|
959
972
|
}
|
960
973
|
}
|
961
974
|
|
@@ -1014,7 +1027,7 @@ Expressions examples
|
|
1014
1027
|
|
1015
1028
|
{
|
1016
1029
|
const node2 = math.parse('x^a')
|
1017
|
-
const _code2:
|
1030
|
+
const _code2: EvalFunction = node2.compile()
|
1018
1031
|
node2.toString()
|
1019
1032
|
}
|
1020
1033
|
|
@@ -1117,8 +1130,8 @@ Matrices examples
|
|
1117
1130
|
|
1118
1131
|
// create matrices and arrays. a matrix is just a wrapper around an Array,
|
1119
1132
|
// providing some handy utilities.
|
1120
|
-
const a:
|
1121
|
-
const b:
|
1133
|
+
const a: Matrix = math.matrix([1, 4, 9, 16, 25])
|
1134
|
+
const b: Matrix = math.matrix(math.ones([2, 3]))
|
1122
1135
|
b.size()
|
1123
1136
|
|
1124
1137
|
// @ts-expect-error ... ones() in a chain cannot take more dimensions
|
@@ -1130,7 +1143,7 @@ Matrices examples
|
|
1130
1143
|
const _array = a.valueOf()
|
1131
1144
|
|
1132
1145
|
// Matrices can be cloned
|
1133
|
-
const _clone:
|
1146
|
+
const _clone: Matrix = a.clone()
|
1134
1147
|
|
1135
1148
|
// perform operations with matrices
|
1136
1149
|
math.map(a, math.sqrt)
|
@@ -1142,22 +1155,22 @@ Matrices examples
|
|
1142
1155
|
[1, 2],
|
1143
1156
|
[3, 4],
|
1144
1157
|
]
|
1145
|
-
const b:
|
1158
|
+
const b: Matrix = math.matrix([
|
1146
1159
|
[5, 6],
|
1147
1160
|
[1, 1],
|
1148
1161
|
])
|
1149
1162
|
|
1150
1163
|
b.subset(math.index(1, [0, 1]), [[7, 8]])
|
1151
1164
|
const _c = math.multiply(a, b)
|
1152
|
-
const f:
|
1153
|
-
const _d:
|
1165
|
+
const f: Matrix = math.matrix([1, 0])
|
1166
|
+
const _d: Matrix = f.subset(math.index(1))
|
1154
1167
|
}
|
1155
1168
|
|
1156
1169
|
// get a sub matrix
|
1157
1170
|
{
|
1158
|
-
const a:
|
1171
|
+
const a: Matrix = math.diag(math.range(1, 4))
|
1159
1172
|
a.subset(math.index([1, 2], [1, 2]))
|
1160
|
-
const b:
|
1173
|
+
const b: Matrix = math.range(1, 6)
|
1161
1174
|
b.subset(math.index(math.range(1, 4)))
|
1162
1175
|
}
|
1163
1176
|
|
@@ -1203,7 +1216,7 @@ Matrices examples
|
|
1203
1216
|
[6, 4, 3]
|
1204
1217
|
)
|
1205
1218
|
assert.deepStrictEqual(
|
1206
|
-
math.filter(['23', 'foo', '100', '55', 'bar'],
|
1219
|
+
math.filter(['23', 'foo', '100', '55', 'bar'], /\d+/),
|
1207
1220
|
['23', '100', '55']
|
1208
1221
|
)
|
1209
1222
|
}
|
@@ -1308,7 +1321,7 @@ Math types examples: Type results after multiplying 'MathTypes' with matrices
|
|
1308
1321
|
|
1309
1322
|
// 1D JS Array
|
1310
1323
|
const r3 = math.multiply(abc, bcd)
|
1311
|
-
r3[1] // By default least promised valid syntax
|
1324
|
+
const _r31 = r3[1] // By default least promised valid syntax
|
1312
1325
|
|
1313
1326
|
// 2D JS Array
|
1314
1327
|
const r12 = math.multiply(bcd, bcd)
|
@@ -1316,9 +1329,9 @@ Math types examples: Type results after multiplying 'MathTypes' with matrices
|
|
1316
1329
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1317
1330
|
const multiDimensional = (x: any): x is any[][] => x.length && x[0].length
|
1318
1331
|
if (multiDimensional(r12)) {
|
1319
|
-
r12[1][1]
|
1332
|
+
const _r1211 = r12[1][1]
|
1320
1333
|
}
|
1321
|
-
r12[1] // Valid syntax
|
1334
|
+
const _r121 = r12[1] // Valid syntax
|
1322
1335
|
|
1323
1336
|
// Matrix: matrix * vector
|
1324
1337
|
const r7 = math.multiply(Mabc, bcd)
|
@@ -1450,29 +1463,27 @@ Expression tree examples
|
|
1450
1463
|
const math = create(all, {})
|
1451
1464
|
|
1452
1465
|
// Filter an expression tree
|
1453
|
-
const node:
|
1454
|
-
const filtered:
|
1455
|
-
(node:
|
1466
|
+
const node: MathNode = math.parse('x^2 + x/4 + 3*y')
|
1467
|
+
const filtered: MathNode[] = node.filter(
|
1468
|
+
(node: MathNode) => node.type === 'SymbolNode' && node.name === 'x'
|
1456
1469
|
)
|
1457
1470
|
|
1458
|
-
const _arr: string[] = filtered.map((node:
|
1471
|
+
const _arr: string[] = filtered.map((node: MathNode) => node.toString())
|
1459
1472
|
|
1460
1473
|
// Traverse an expression tree
|
1461
|
-
const node1:
|
1462
|
-
node1.traverse(
|
1463
|
-
(node
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
return
|
1473
|
-
}
|
1474
|
+
const node1: MathNode = math.parse('3 * x + 2')
|
1475
|
+
node1.traverse((node: MathNode, _path: string, _parent: MathNode) => {
|
1476
|
+
switch (node.type) {
|
1477
|
+
case 'OperatorNode':
|
1478
|
+
return node.type === 'OperatorNode'
|
1479
|
+
case 'ConstantNode':
|
1480
|
+
return node.type === 'ConstantNode'
|
1481
|
+
case 'SymbolNode':
|
1482
|
+
return node.type === 'SymbolNode'
|
1483
|
+
default:
|
1484
|
+
return
|
1474
1485
|
}
|
1475
|
-
)
|
1486
|
+
})
|
1476
1487
|
}
|
1477
1488
|
|
1478
1489
|
/*
|
@@ -1535,9 +1546,9 @@ Function ceil examples
|
|
1535
1546
|
)
|
1536
1547
|
|
1537
1548
|
// numeric input, array or matrix of decimals
|
1538
|
-
const numCeiled:
|
1549
|
+
const numCeiled: MathArray = math.ceil(math.tau, [2, 3])
|
1539
1550
|
assert.deepStrictEqual(numCeiled, [6.29, 6.284])
|
1540
|
-
const bigCeiled:
|
1551
|
+
const bigCeiled: Matrix = math.ceil(
|
1541
1552
|
math.bignumber(6.28318),
|
1542
1553
|
math.matrix([2, 3])
|
1543
1554
|
)
|
@@ -1611,9 +1622,9 @@ Function fix examples
|
|
1611
1622
|
)
|
1612
1623
|
|
1613
1624
|
// numeric input, array or matrix of decimals
|
1614
|
-
const numFixed:
|
1625
|
+
const numFixed: MathArray = math.fix(math.tau, [2, 3])
|
1615
1626
|
assert.deepStrictEqual(numFixed, [6.28, 6.283])
|
1616
|
-
const bigFixed:
|
1627
|
+
const bigFixed: Matrix = math.fix(
|
1617
1628
|
math.bignumber(6.28318),
|
1618
1629
|
math.matrix([2, 3])
|
1619
1630
|
)
|
@@ -1687,9 +1698,9 @@ Function floor examples
|
|
1687
1698
|
)
|
1688
1699
|
|
1689
1700
|
// numeric input, array or matrix of decimals
|
1690
|
-
const numFloored:
|
1701
|
+
const numFloored: MathArray = math.floor(math.tau, [2, 3])
|
1691
1702
|
assert.deepStrictEqual(numFloored, [6.28, 6.283])
|
1692
|
-
const bigFloored:
|
1703
|
+
const bigFloored: Matrix = math.floor(
|
1693
1704
|
math.bignumber(6.28318),
|
1694
1705
|
math.matrix([2, 3])
|
1695
1706
|
)
|
@@ -1763,9 +1774,9 @@ Function round examples
|
|
1763
1774
|
)
|
1764
1775
|
|
1765
1776
|
// numeric input, array or matrix of decimals
|
1766
|
-
const numRounded:
|
1777
|
+
const numRounded: MathArray = math.round(math.tau, [2, 3])
|
1767
1778
|
assert.deepStrictEqual(numRounded, [6.28, 6.283])
|
1768
|
-
const bigRounded:
|
1779
|
+
const bigRounded: Matrix = math.round(
|
1769
1780
|
math.bignumber(6.28318),
|
1770
1781
|
math.matrix([2, 3])
|
1771
1782
|
)
|
@@ -2077,22 +2088,22 @@ Factory Test
|
|
2077
2088
|
|
2078
2089
|
// Check guards do type refinement
|
2079
2090
|
|
2080
|
-
|
2091
|
+
const x: unknown = undefined
|
2081
2092
|
|
2082
2093
|
if (math.isNumber(x)) {
|
2083
2094
|
expectTypeOf(x).toMatchTypeOf<number>()
|
2084
2095
|
}
|
2085
2096
|
if (math.isBigNumber(x)) {
|
2086
|
-
expectTypeOf(x).toMatchTypeOf<
|
2097
|
+
expectTypeOf(x).toMatchTypeOf<BigNumber>()
|
2087
2098
|
}
|
2088
2099
|
if (math.isComplex(x)) {
|
2089
|
-
expectTypeOf(x).toMatchTypeOf<
|
2100
|
+
expectTypeOf(x).toMatchTypeOf<Complex>()
|
2090
2101
|
}
|
2091
2102
|
if (math.isFraction(x)) {
|
2092
|
-
expectTypeOf(x).toMatchTypeOf<
|
2103
|
+
expectTypeOf(x).toMatchTypeOf<Fraction>()
|
2093
2104
|
}
|
2094
2105
|
if (math.isUnit(x)) {
|
2095
|
-
expectTypeOf(x).toMatchTypeOf<
|
2106
|
+
expectTypeOf(x).toMatchTypeOf<Unit>()
|
2096
2107
|
}
|
2097
2108
|
if (math.isString(x)) {
|
2098
2109
|
expectTypeOf(x).toMatchTypeOf<string>()
|
@@ -2101,22 +2112,22 @@ Factory Test
|
|
2101
2112
|
expectTypeOf(x).toMatchTypeOf<unknown[]>()
|
2102
2113
|
}
|
2103
2114
|
if (math.isMatrix(x)) {
|
2104
|
-
expectTypeOf(x).toMatchTypeOf<
|
2115
|
+
expectTypeOf(x).toMatchTypeOf<Matrix>()
|
2105
2116
|
}
|
2106
2117
|
if (math.isDenseMatrix(x)) {
|
2107
|
-
expectTypeOf(x).toMatchTypeOf<
|
2118
|
+
expectTypeOf(x).toMatchTypeOf<Matrix>()
|
2108
2119
|
}
|
2109
2120
|
if (math.isSparseMatrix(x)) {
|
2110
|
-
expectTypeOf(x).toMatchTypeOf<
|
2121
|
+
expectTypeOf(x).toMatchTypeOf<Matrix>()
|
2111
2122
|
}
|
2112
2123
|
if (math.isIndex(x)) {
|
2113
|
-
expectTypeOf(x).toMatchTypeOf<
|
2124
|
+
expectTypeOf(x).toMatchTypeOf<Index>()
|
2114
2125
|
}
|
2115
2126
|
if (math.isBoolean(x)) {
|
2116
2127
|
expectTypeOf(x).toMatchTypeOf<boolean>()
|
2117
2128
|
}
|
2118
2129
|
if (math.isHelp(x)) {
|
2119
|
-
expectTypeOf(x).toMatchTypeOf<
|
2130
|
+
expectTypeOf(x).toMatchTypeOf<Help>()
|
2120
2131
|
}
|
2121
2132
|
if (math.isDate(x)) {
|
2122
2133
|
expectTypeOf(x).toMatchTypeOf<Date>()
|
@@ -2132,40 +2143,40 @@ Factory Test
|
|
2132
2143
|
}
|
2133
2144
|
|
2134
2145
|
if (math.isAccessorNode(x)) {
|
2135
|
-
expectTypeOf(x).toMatchTypeOf<
|
2146
|
+
expectTypeOf(x).toMatchTypeOf<AccessorNode>()
|
2136
2147
|
}
|
2137
2148
|
if (math.isArrayNode(x)) {
|
2138
|
-
expectTypeOf(x).toMatchTypeOf<
|
2149
|
+
expectTypeOf(x).toMatchTypeOf<ArrayNode>()
|
2139
2150
|
}
|
2140
2151
|
if (math.isAssignmentNode(x)) {
|
2141
|
-
expectTypeOf(x).toMatchTypeOf<
|
2152
|
+
expectTypeOf(x).toMatchTypeOf<AssignmentNode>()
|
2142
2153
|
}
|
2143
2154
|
if (math.isBlockNode(x)) {
|
2144
|
-
expectTypeOf(x).toMatchTypeOf<
|
2155
|
+
expectTypeOf(x).toMatchTypeOf<BlockNode>()
|
2145
2156
|
}
|
2146
2157
|
if (math.isConditionalNode(x)) {
|
2147
|
-
expectTypeOf(x).toMatchTypeOf<
|
2158
|
+
expectTypeOf(x).toMatchTypeOf<ConditionalNode>()
|
2148
2159
|
}
|
2149
2160
|
if (math.isConstantNode(x)) {
|
2150
|
-
expectTypeOf(x).toMatchTypeOf<
|
2161
|
+
expectTypeOf(x).toMatchTypeOf<ConstantNode>()
|
2151
2162
|
}
|
2152
2163
|
if (math.isFunctionAssignmentNode(x)) {
|
2153
|
-
expectTypeOf(x).toMatchTypeOf<
|
2164
|
+
expectTypeOf(x).toMatchTypeOf<FunctionAssignmentNode>()
|
2154
2165
|
}
|
2155
2166
|
if (math.isFunctionNode(x)) {
|
2156
|
-
expectTypeOf(x).toMatchTypeOf<
|
2167
|
+
expectTypeOf(x).toMatchTypeOf<FunctionNode>()
|
2157
2168
|
}
|
2158
2169
|
if (math.isIndexNode(x)) {
|
2159
|
-
expectTypeOf(x).toMatchTypeOf<
|
2170
|
+
expectTypeOf(x).toMatchTypeOf<IndexNode>()
|
2160
2171
|
}
|
2161
2172
|
if (math.isNode(x)) {
|
2162
|
-
expectTypeOf(x).toMatchTypeOf<
|
2173
|
+
expectTypeOf(x).toMatchTypeOf<MathNodeCommon>()
|
2163
2174
|
}
|
2164
2175
|
if (math.isNode(x)) {
|
2165
|
-
expectTypeOf(x).toMatchTypeOf<
|
2176
|
+
expectTypeOf(x).toMatchTypeOf<MathNodeCommon>()
|
2166
2177
|
}
|
2167
2178
|
if (math.isObjectNode(x)) {
|
2168
|
-
expectTypeOf(x).toMatchTypeOf<
|
2179
|
+
expectTypeOf(x).toMatchTypeOf<ObjectNode>()
|
2169
2180
|
}
|
2170
2181
|
if (math.isOperatorNode(x)) {
|
2171
2182
|
expectTypeOf(x).toMatchTypeOf<
|
@@ -2173,17 +2184,17 @@ Factory Test
|
|
2173
2184
|
>()
|
2174
2185
|
}
|
2175
2186
|
if (math.isParenthesisNode(x)) {
|
2176
|
-
expectTypeOf(x).toMatchTypeOf<
|
2187
|
+
expectTypeOf(x).toMatchTypeOf<ParenthesisNode>()
|
2177
2188
|
}
|
2178
2189
|
if (math.isRangeNode(x)) {
|
2179
|
-
expectTypeOf(x).toMatchTypeOf<
|
2190
|
+
expectTypeOf(x).toMatchTypeOf<RangeNode>()
|
2180
2191
|
}
|
2181
2192
|
if (math.isSymbolNode(x)) {
|
2182
|
-
expectTypeOf(x).toMatchTypeOf<
|
2193
|
+
expectTypeOf(x).toMatchTypeOf<SymbolNode>()
|
2183
2194
|
}
|
2184
2195
|
if (math.isChain(x)) {
|
2185
2196
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2186
|
-
expectTypeOf(x).toMatchTypeOf<
|
2197
|
+
expectTypeOf(x).toMatchTypeOf<MathJsChain<any>>()
|
2187
2198
|
}
|
2188
2199
|
}
|
2189
2200
|
|
@@ -2194,9 +2205,7 @@ Probability function examples
|
|
2194
2205
|
const math = create(all, {})
|
2195
2206
|
|
2196
2207
|
expectTypeOf(math.lgamma(1.5)).toMatchTypeOf<number>()
|
2197
|
-
expectTypeOf(
|
2198
|
-
math.lgamma(math.complex(1.5, -1.5))
|
2199
|
-
).toMatchTypeOf<math.Complex>()
|
2208
|
+
expectTypeOf(math.lgamma(math.complex(1.5, -1.5))).toMatchTypeOf<Complex>()
|
2200
2209
|
}
|
2201
2210
|
|
2202
2211
|
/*
|
@@ -2231,7 +2240,5 @@ Resolve examples
|
|
2231
2240
|
expectTypeOf(
|
2232
2241
|
math.resolve([math.parse('x + y'), 'x*x'], { x: 0 })
|
2233
2242
|
).toMatchTypeOf<MathNode[]>()
|
2234
|
-
expectTypeOf(
|
2235
|
-
math.resolve(math.matrix(['x', 'y']))
|
2236
|
-
).toMatchTypeOf<math.Matrix>()
|
2243
|
+
expectTypeOf(math.resolve(math.matrix(['x', 'y']))).toMatchTypeOf<Matrix>()
|
2237
2244
|
}
|