mathjs 11.0.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/HISTORY.md +6 -0
  2. package/lib/browser/math.js +1 -1
  3. package/lib/browser/math.js.LICENSE.txt +2 -2
  4. package/lib/browser/math.js.map +1 -1
  5. package/lib/cjs/function/algebra/derivative.js +3 -3
  6. package/lib/cjs/function/algebra/simplify.js +3 -1
  7. package/lib/cjs/function/algebra/symbolicEqual.js +5 -6
  8. package/lib/cjs/function/arithmetic/fix.js +1 -1
  9. package/lib/cjs/function/arithmetic/floor.js +1 -1
  10. package/lib/cjs/function/arithmetic/invmod.js +1 -1
  11. package/lib/cjs/function/arithmetic/nthRoot.js +3 -3
  12. package/lib/cjs/function/arithmetic/nthRoots.js +2 -2
  13. package/lib/cjs/function/bitwise/bitNot.js +1 -1
  14. package/lib/cjs/function/bitwise/leftShift.js +1 -1
  15. package/lib/cjs/function/bitwise/rightArithShift.js +1 -1
  16. package/lib/cjs/function/bitwise/rightLogShift.js +1 -1
  17. package/lib/cjs/function/geometry/distance.js +2 -2
  18. package/lib/cjs/function/matrix/diff.js +1 -1
  19. package/lib/cjs/function/matrix/rotate.js +5 -5
  20. package/lib/cjs/function/string/format.js +2 -2
  21. package/lib/cjs/function/string/hex.js +1 -2
  22. package/lib/cjs/function/trigonometry/acot.js +2 -3
  23. package/lib/cjs/function/trigonometry/acsc.js +2 -3
  24. package/lib/cjs/function/trigonometry/asec.js +2 -2
  25. package/lib/cjs/function/trigonometry/asin.js +1 -1
  26. package/lib/cjs/function/trigonometry/atan.js +1 -2
  27. package/lib/cjs/function/trigonometry/atan2.js +1 -1
  28. package/lib/cjs/function/utils/clone.js +1 -1
  29. package/lib/cjs/function/utils/hasNumericValue.js +1 -1
  30. package/lib/cjs/function/utils/isInteger.js +1 -1
  31. package/lib/cjs/function/utils/isNaN.js +1 -1
  32. package/lib/cjs/function/utils/isNegative.js +1 -1
  33. package/lib/cjs/function/utils/isNumeric.js +1 -1
  34. package/lib/cjs/function/utils/isPositive.js +1 -1
  35. package/lib/cjs/function/utils/isZero.js +11 -11
  36. package/lib/cjs/header.js +2 -2
  37. package/lib/cjs/version.js +1 -1
  38. package/lib/esm/function/algebra/derivative.js +3 -3
  39. package/lib/esm/function/algebra/simplify.js +3 -1
  40. package/lib/esm/function/algebra/symbolicEqual.js +5 -6
  41. package/lib/esm/function/arithmetic/fix.js +1 -1
  42. package/lib/esm/function/arithmetic/floor.js +1 -1
  43. package/lib/esm/function/arithmetic/invmod.js +1 -1
  44. package/lib/esm/function/arithmetic/nthRoot.js +3 -3
  45. package/lib/esm/function/arithmetic/nthRoots.js +2 -2
  46. package/lib/esm/function/bitwise/bitNot.js +1 -1
  47. package/lib/esm/function/bitwise/leftShift.js +1 -1
  48. package/lib/esm/function/bitwise/rightArithShift.js +1 -1
  49. package/lib/esm/function/bitwise/rightLogShift.js +1 -1
  50. package/lib/esm/function/geometry/distance.js +2 -2
  51. package/lib/esm/function/matrix/diff.js +1 -1
  52. package/lib/esm/function/matrix/rotate.js +5 -5
  53. package/lib/esm/function/string/format.js +2 -2
  54. package/lib/esm/function/string/hex.js +1 -2
  55. package/lib/esm/function/trigonometry/acot.js +2 -3
  56. package/lib/esm/function/trigonometry/acsc.js +2 -3
  57. package/lib/esm/function/trigonometry/asec.js +2 -2
  58. package/lib/esm/function/trigonometry/asin.js +1 -1
  59. package/lib/esm/function/trigonometry/atan.js +1 -2
  60. package/lib/esm/function/trigonometry/atan2.js +1 -1
  61. package/lib/esm/function/utils/clone.js +1 -1
  62. package/lib/esm/function/utils/hasNumericValue.js +1 -1
  63. package/lib/esm/function/utils/isInteger.js +1 -1
  64. package/lib/esm/function/utils/isNaN.js +1 -1
  65. package/lib/esm/function/utils/isNegative.js +1 -1
  66. package/lib/esm/function/utils/isNumeric.js +1 -1
  67. package/lib/esm/function/utils/isPositive.js +1 -1
  68. package/lib/esm/function/utils/isZero.js +11 -11
  69. package/lib/esm/version.js +1 -1
  70. package/package.json +1 -1
  71. package/types/index.d.ts +7 -3
  72. package/types/index.ts +102 -95
@@ -42,9 +42,9 @@ var createDerivative = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
42
42
  *
43
43
  * Examples:
44
44
  *
45
- * math.derivative('x^2', 'x') // Node {2 * x}
46
- * math.derivative('x^2', 'x', {simplify: false}) // Node {2 * 1 * x ^ (2 - 1)
47
- * math.derivative('sin(2x)', 'x')) // Node {2 * cos(2 * x)}
45
+ * math.derivative('x^2', 'x') // Node '2 * x'
46
+ * math.derivative('x^2', 'x', {simplify: false}) // Node '2 * 1 * x ^ (2 - 1)'
47
+ * math.derivative('sin(2x)', 'x')) // Node '2 * cos(2 * x)'
48
48
  * math.derivative('2*x', 'x').evaluate() // number 2
49
49
  * math.derivative('x^2', 'x').evaluate({x: 4}) // number 8
50
50
  * const f = math.parse('x^2')
@@ -167,8 +167,10 @@ var createSimplify = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fu
167
167
  *
168
168
  * @param {Node | string} expr
169
169
  * The expression to be simplified
170
- * @param {Array<{l:string, r: string} | string | function>} [rules]
170
+ * @param {SimplifyRule[]} [rules]
171
171
  * Optional list with custom rules
172
+ * @param {Object} [scope] Optional scope with variables
173
+ * @param {SimplifyOptions} [options] Optional configuration settings
172
174
  * @return {Node} Returns the simplified form of `expr`
173
175
  */
174
176
 
@@ -38,12 +38,11 @@ var createSymbolicEqual = /* #__PURE__ */(0, _factory.factory)(name, dependencie
38
38
  *
39
39
  * Examples:
40
40
  *
41
- * symbolicEqual('x*y', 'y*x') // true
42
- * symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}})
43
- * //false
44
- * symbolicEqual('x/y', '(y*x^(-1))^(-1)') // true
45
- * symbolicEqual('abs(x)','x') // false
46
- * symbolicEqual('abs(x)','x', simplify.positiveContext) // true
41
+ * symbolicEqual('x*y', 'y*x') // Returns true
42
+ * symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}}) // Returns false
43
+ * symbolicEqual('x/y', '(y*x^(-1))^(-1)') // Returns true
44
+ * symbolicEqual('abs(x)','x') // Returns false
45
+ * symbolicEqual('abs(x)','x', simplify.positiveContext) // Returns true
47
46
  *
48
47
  * See also:
49
48
  *
@@ -73,7 +73,7 @@ var createFix = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functio
73
73
  *
74
74
  * const c = math.complex(3.22, -2.78)
75
75
  * math.fix(c) // returns Complex 3 - 2i
76
- * math.fix(c, 1) // returns Complex 3.2 - 2.7i
76
+ * math.fix(c, 1) // returns Complex 3.2 -2.7i
77
77
  *
78
78
  * math.fix([3.2, 3.8, -4.7]) // returns Array [3, 3, -4]
79
79
  * math.fix([3.2, 3.8, -4.7], 1) // returns Array [3.2, 3.8, -4.7]
@@ -109,7 +109,7 @@ var createFloor = /* #__PURE__ */(0, _factory.factory)(name, dependencies, funct
109
109
  *
110
110
  * const c = math.complex(3.24, -2.71)
111
111
  * math.floor(c) // returns Complex 3 - 3i
112
- * math.floor(c, 1) // returns Complex 3.2 - 2.8i
112
+ * math.floor(c, 1) // returns Complex 3.2 -2.8i
113
113
  *
114
114
  * math.floor([3.2, 3.8, -4.7]) // returns Array [3, 3, -5]
115
115
  * math.floor([3.21, 3.82, -4.71], 1) // returns Array [3.2, 3.8, -4.8]
@@ -35,7 +35,7 @@ var createInvmod = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
35
35
  * Examples:
36
36
  *
37
37
  * math.invmod(8, 12) // returns NaN
38
- * math.invmod(7, 13) // return 2
38
+ * math.invmod(7, 13) // returns 2
39
39
  * math.invmod(15151, 15122) // returns 10429
40
40
  *
41
41
  * See also:
@@ -61,9 +61,9 @@ var createNthRoot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fun
61
61
  *
62
62
  * Examples:
63
63
  *
64
- * math.nthRoot(9, 2) // returns 3, as 3^2 == 9
65
- * math.sqrt(9) // returns 3, as 3^2 == 9
66
- * math.nthRoot(64, 3) // returns 4, as 4^3 == 64
64
+ * math.nthRoot(9, 2) // returns 3 (since 3^2 == 9)
65
+ * math.sqrt(9) // returns 3 (since 3^2 == 9)
66
+ * math.nthRoot(64, 3) // returns 4 (since 4^3 == 64)
67
67
  *
68
68
  * See also:
69
69
  *
@@ -98,12 +98,12 @@ var createNthRoots = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fu
98
98
  * // {re: 1, im: 0},
99
99
  * // {re: -1, im: 0}
100
100
  * // ]
101
- * nthRoots(1, 3)
101
+ * math.nthRoots(1, 3)
102
102
  * // returns [
103
103
  * // { re: 1, im: 0 },
104
104
  * // { re: -0.4999999999999998, im: 0.8660254037844387 },
105
105
  * // { re: -0.5000000000000004, im: -0.8660254037844385 }
106
- * ]
106
+ * // ]
107
107
  *
108
108
  * See also:
109
109
  *
@@ -31,7 +31,7 @@ var createBitNot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
31
31
  *
32
32
  * math.bitNot(1) // returns number -2
33
33
  *
34
- * math.bitNot([2, -3, 4]) // returns Array [-3, 2, 5]
34
+ * math.bitNot([2, -3, 4]) // returns Array [-3, 2, -5]
35
35
  *
36
36
  * See also:
37
37
  *
@@ -78,7 +78,7 @@ var createLeftShift = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
78
78
  *
79
79
  * math.leftShift(1, 2) // returns number 4
80
80
  *
81
- * math.leftShift([1, 2, 3], 4) // returns Array [16, 32, 64]
81
+ * math.leftShift([1, 2, 4], 4) // returns Array [16, 32, 64]
82
82
  *
83
83
  * See also:
84
84
  *
@@ -78,7 +78,7 @@ var createRightArithShift = /* #__PURE__ */(0, _factory.factory)(name, dependenc
78
78
  *
79
79
  * math.rightArithShift(4, 2) // returns number 1
80
80
  *
81
- * math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 3]
81
+ * math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 4]
82
82
  *
83
83
  * See also:
84
84
  *
@@ -76,7 +76,7 @@ var createRightLogShift = /* #__PURE__ */(0, _factory.factory)(name, dependencie
76
76
  *
77
77
  * math.rightLogShift(4, 2) // returns number 1
78
78
  *
79
- * math.rightLogShift([16, -32, 64], 4) // returns Array [1, 2, 3]
79
+ * math.rightLogShift([16, 32, 64], 4) // returns Array [1, 2, 4]
80
80
  *
81
81
  * See also:
82
82
  *
@@ -48,11 +48,11 @@ var createDistance = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fu
48
48
  * math.distance({pointX: 2, pointY: 5, pointZ: 9}, {x0: 4, y0: 6, z0: 3, a: 4, b: 2, c: 0})
49
49
  *
50
50
  * Examples:
51
- * math.distance([0,0], [4,4]) // Returns 5.6569
51
+ * math.distance([0,0], [4,4]) // Returns 5.656854249492381
52
52
  * math.distance(
53
53
  * {pointOneX: 0, pointOneY: 0},
54
54
  * {pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951
55
- * math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.74166
55
+ * math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.7416573867739413
56
56
  * math.distance(
57
57
  * {pointOneX: 4, pointOneY: 5, pointOneZ: 8},
58
58
  * {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3
@@ -37,7 +37,7 @@ var createDiff = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
37
37
  *
38
38
  * const arr = [1, 2, 4, 7, 0]
39
39
  * math.diff(arr) // returns [1, 2, 3, -7] (no dimension passed so 0 is assumed)
40
- * math.diff(math.matrix(arr)) // returns math.matrix([1, 2, 3, -7])
40
+ * math.diff(math.matrix(arr)) // returns Matrix [1, 2, 3, -7]
41
41
  *
42
42
  * const arr = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [9, 8, 7, 6, 4]]
43
43
  * math.diff(arr) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]
@@ -27,13 +27,13 @@ var createRotate = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
27
27
  *
28
28
  * Examples:
29
29
  *
30
- * math.rotate([11, 12], math.pi / 2) // returns matrix([-12, 11])
31
- * math.rotate(matrix([11, 12]), math.pi / 2) // returns matrix([-12, 11])
30
+ * math.rotate([11, 12], math.pi / 2) // returns [-12, 11]
31
+ * math.rotate(matrix([11, 12]), math.pi / 2) // returns [-12, 11]
32
32
  *
33
- * math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
34
- * math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
33
+ * math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns [0, 1, 0]
34
+ * math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns Matrix [0, 1, 0]
35
35
  *
36
- * math.rotate([1, 0], math.complex(1 + i)) // returns matrix([cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)])
36
+ * math.rotate([1, 0], math.complex(1 + i)) // returns [cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)]
37
37
  *
38
38
  * See also:
39
39
  *
@@ -105,14 +105,14 @@ var createFormat = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
105
105
  * Examples:
106
106
  *
107
107
  * math.format(6.4) // returns '6.4'
108
- * math.format(1240000) // returns '1.24e6'
108
+ * math.format(1240000) // returns '1.24e+6'
109
109
  * math.format(1/3) // returns '0.3333333333333333'
110
110
  * math.format(1/3, 3) // returns '0.333'
111
111
  * math.format(21385, 2) // returns '21000'
112
112
  * math.format(12e8, {notation: 'fixed'}) // returns '1200000000'
113
113
  * math.format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'
114
114
  * math.format(52.8, {notation: 'exponential'}) // returns '5.28e+1'
115
- * math.format(12400,{notation: 'engineering'}) // returns '12.400e+3'
115
+ * math.format(12400, {notation: 'engineering'}) // returns '12.4e+3'
116
116
  * math.format(2000, {lowerExp: -2, upperExp: 2}) // returns '2e+3'
117
117
  *
118
118
  * function formatCurrency(value) {
@@ -18,8 +18,7 @@ var dependencies = ['typed', 'format'];
18
18
  *
19
19
  * Examples:
20
20
  *
21
- * //the following outputs "0xF0"
22
- * math.hex(240)
21
+ * math.hex(240) // returns "0xF0"
23
22
  *
24
23
  * See also:
25
24
  *
@@ -27,11 +27,10 @@ var createAcot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
27
27
  *
28
28
  * Examples:
29
29
  *
30
- * math.acot(0.5) // returns number 0.4636476090008061
30
+ * math.acot(0.5) // returns number 1.1071487177940904
31
+ * math.acot(2) // returns number 0.4636476090008061
31
32
  * math.acot(math.cot(1.5)) // returns number 1.5
32
33
  *
33
- * math.acot(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
34
- *
35
34
  * See also:
36
35
  *
37
36
  * cot, atan
@@ -29,11 +29,10 @@ var createAcsc = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
29
29
  *
30
30
  * Examples:
31
31
  *
32
- * math.acsc(0.5) // returns number 0.5235987755982989
32
+ * math.acsc(2) // returns 0.5235987755982989
33
+ * math.acsc(0.5) // returns Complex 1.5707963267948966 -1.3169578969248166i
33
34
  * math.acsc(math.csc(1.5)) // returns number ~1.5
34
35
  *
35
- * math.acsc(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
36
- *
37
36
  * See also:
38
37
  *
39
38
  * csc, asin, asec
@@ -29,10 +29,10 @@ var createAsec = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
29
29
  *
30
30
  * Examples:
31
31
  *
32
- * math.asec(0.5) // returns 1.0471975511965979
32
+ * math.asec(2) // returns 1.0471975511965979
33
33
  * math.asec(math.sec(1.5)) // returns 1.5
34
34
  *
35
- * math.asec(2) // returns 0 + 1.3169578969248166 i
35
+ * math.asec(0.5) // returns Complex 0 + 1.3169578969248166i
36
36
  *
37
37
  * See also:
38
38
  *
@@ -29,7 +29,7 @@ var createAsin = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
29
29
  * math.asin(0.5) // returns number 0.5235987755982989
30
30
  * math.asin(math.sin(1.5)) // returns number ~1.5
31
31
  *
32
- * math.asin(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
32
+ * math.asin(2) // returns Complex 1.5707963267948966 -1.3169578969248166i
33
33
  *
34
34
  * See also:
35
35
  *
@@ -25,10 +25,9 @@ var createAtan = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functi
25
25
  * Examples:
26
26
  *
27
27
  * math.atan(0.5) // returns number 0.4636476090008061
28
+ * math.atan(2) // returns number 1.1071487177940904
28
29
  * math.atan(math.tan(1.5)) // returns number 1.5
29
30
  *
30
- * math.atan(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
31
- *
32
31
  * See also:
33
32
  *
34
33
  * tan, asin, acos
@@ -69,7 +69,7 @@ var createAtan2 = /* #__PURE__ */(0, _factory.factory)(name, dependencies, funct
69
69
  * const x = math.cos(angle)
70
70
  * const y = math.sin(angle)
71
71
  *
72
- * math.atan(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
72
+ * math.atan(2) // returns number 1.1071487177940904
73
73
  *
74
74
  * See also:
75
75
  *
@@ -24,7 +24,7 @@ var createClone = /* #__PURE__ */(0, _factory.factory)(name, dependencies, funct
24
24
  * Examples:
25
25
  *
26
26
  * math.clone(3.5) // returns number 3.5
27
- * math.clone(math.complex('2-4i') // returns Complex 2 - 4i
27
+ * math.clone(math.complex('2-4i')) // returns Complex 2 - 4i
28
28
  * math.clone(math.unit(45, 'deg')) // returns Unit 45 deg
29
29
  * math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]
30
30
  * math.clone("hello world") // returns string "hello world"
@@ -30,7 +30,7 @@ var createHasNumericValue = /* #__PURE__ */(0, _factory.factory)(name, dependenc
30
30
  * math.hasNumericValue(0) // returns true
31
31
  * math.hasNumericValue(math.bignumber(500)) // returns true
32
32
  * math.hasNumericValue(math.fraction(4)) // returns true
33
- * math.hasNumericValue(math.complex('2-4i') // returns false
33
+ * math.hasNumericValue(math.complex('2-4i')) // returns false
34
34
  * math.hasNumericValue(false) // returns true
35
35
  * math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true]
36
36
  *
@@ -35,7 +35,7 @@ var createIsInteger = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
35
35
  * math.isInteger(math.fraction(4)) // returns true
36
36
  * math.isInteger('3') // returns true
37
37
  * math.isInteger([3, 0.5, -2]) // returns [true, false, true]
38
- * math.isInteger(math.complex('2-4i') // throws an error
38
+ * math.isInteger(math.complex('2-4i')) // throws an error
39
39
  *
40
40
  * See also:
41
41
  *
@@ -35,7 +35,7 @@ var createIsNaN = /* #__PURE__ */(0, _factory.factory)(name, dependencies, funct
35
35
  * math.isNaN(math.bignumber(0)) // returns false
36
36
  * math.isNaN(math.fraction(-2, 5)) // returns false
37
37
  * math.isNaN('-2') // returns false
38
- * math.isNaN([2, 0, -3, NaN]') // returns [false, false, false, true]
38
+ * math.isNaN([2, 0, -3, NaN]) // returns [false, false, false, true]
39
39
  *
40
40
  * See also:
41
41
  *
@@ -35,7 +35,7 @@ var createIsNegative = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
35
35
  * math.isNegative(math.bignumber(2)) // returns false
36
36
  * math.isNegative(math.fraction(-2, 5)) // returns true
37
37
  * math.isNegative('-2') // returns true
38
- * math.isNegative([2, 0, -3]') // returns [false, false, true]
38
+ * math.isNegative([2, 0, -3]) // returns [false, false, true]
39
39
  *
40
40
  * See also:
41
41
  *
@@ -31,7 +31,7 @@ var createIsNumeric = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
31
31
  * math.isNumeric(0) // returns true
32
32
  * math.isNumeric(math.bignumber(500)) // returns true
33
33
  * math.isNumeric(math.fraction(4)) // returns true
34
- * math.isNumeric(math.complex('2-4i') // returns false
34
+ * math.isNumeric(math.complex('2-4i')) // returns false
35
35
  * math.isNumeric([2.3, 'foo', false]) // returns [true, false, true]
36
36
  *
37
37
  * See also:
@@ -35,7 +35,7 @@ var createIsPositive = /* #__PURE__ */(0, _factory.factory)(name, dependencies,
35
35
  * math.isPositive(0.5) // returns true
36
36
  * math.isPositive(math.bignumber(2)) // returns true
37
37
  * math.isPositive(math.fraction(-2, 5)) // returns false
38
- * math.isPositive(math.fraction(1,3)) // returns false
38
+ * math.isPositive(math.fraction(1, 3)) // returns true
39
39
  * math.isPositive('2') // returns true
40
40
  * math.isPositive([2, 0, -3]) // returns [true, false, false]
41
41
  *
@@ -29,17 +29,17 @@ var createIsZero = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
29
29
  *
30
30
  * Examples:
31
31
  *
32
- * math.isZero(0) // returns true
33
- * math.isZero(2) // returns false
34
- * math.isZero(0.5) // returns false
35
- * math.isZero(math.bignumber(0)) // returns true
36
- * math.isZero(math.fraction(0)) // returns true
37
- * math.isZero(math.fraction(1,3)) // returns false
38
- * math.isZero(math.complex('2 - 4i') // returns false
39
- * math.isZero(math.complex('0i') // returns true
40
- * math.isZero('0') // returns true
41
- * math.isZero('2') // returns false
42
- * math.isZero([2, 0, -3]') // returns [false, true, false]
32
+ * math.isZero(0) // returns true
33
+ * math.isZero(2) // returns false
34
+ * math.isZero(0.5) // returns false
35
+ * math.isZero(math.bignumber(0)) // returns true
36
+ * math.isZero(math.fraction(0)) // returns true
37
+ * math.isZero(math.fraction(1,3)) // returns false
38
+ * math.isZero(math.complex('2 - 4i')) // returns false
39
+ * math.isZero(math.complex('0i')) // returns true
40
+ * math.isZero('0') // returns true
41
+ * math.isZero('2') // returns false
42
+ * math.isZero([2, 0, -3]) // returns [false, true, false]
43
43
  *
44
44
  * See also:
45
45
  *
package/lib/cjs/header.js CHANGED
@@ -6,8 +6,8 @@
6
6
  * It features real and complex numbers, units, matrices, a large set of
7
7
  * mathematical functions, and a flexible expression parser.
8
8
  *
9
- * @version 11.0.0
10
- * @date 2022-07-23
9
+ * @version 11.0.1
10
+ * @date 2022-07-25
11
11
  *
12
12
  * @license
13
13
  * Copyright (C) 2013-2022 Jos de Jong <wjosdejong@gmail.com>
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '11.0.0'; // Note: This file is automatically generated when building math.js.
7
+ var version = '11.0.1'; // Note: This file is automatically generated when building math.js.
8
8
  // Changes made in this file will be overwritten.
9
9
 
10
10
  exports.version = version;
@@ -35,9 +35,9 @@ export var createDerivative = /* #__PURE__ */factory(name, dependencies, _ref =>
35
35
  *
36
36
  * Examples:
37
37
  *
38
- * math.derivative('x^2', 'x') // Node {2 * x}
39
- * math.derivative('x^2', 'x', {simplify: false}) // Node {2 * 1 * x ^ (2 - 1)
40
- * math.derivative('sin(2x)', 'x')) // Node {2 * cos(2 * x)}
38
+ * math.derivative('x^2', 'x') // Node '2 * x'
39
+ * math.derivative('x^2', 'x', {simplify: false}) // Node '2 * 1 * x ^ (2 - 1)'
40
+ * math.derivative('sin(2x)', 'x')) // Node '2 * cos(2 * x)'
41
41
  * math.derivative('2*x', 'x').evaluate() // number 2
42
42
  * math.derivative('x^2', 'x').evaluate({x: 4}) // number 8
43
43
  * const f = math.parse('x^2')
@@ -153,8 +153,10 @@ export var createSimplify = /* #__PURE__ */factory(name, dependencies, _ref => {
153
153
  *
154
154
  * @param {Node | string} expr
155
155
  * The expression to be simplified
156
- * @param {Array<{l:string, r: string} | string | function>} [rules]
156
+ * @param {SimplifyRule[]} [rules]
157
157
  * Optional list with custom rules
158
+ * @param {Object} [scope] Optional scope with variables
159
+ * @param {SimplifyOptions} [options] Optional configuration settings
158
160
  * @return {Node} Returns the simplified form of `expr`
159
161
  */
160
162
 
@@ -31,12 +31,11 @@ export var createSymbolicEqual = /* #__PURE__ */factory(name, dependencies, _ref
31
31
  *
32
32
  * Examples:
33
33
  *
34
- * symbolicEqual('x*y', 'y*x') // true
35
- * symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}})
36
- * //false
37
- * symbolicEqual('x/y', '(y*x^(-1))^(-1)') // true
38
- * symbolicEqual('abs(x)','x') // false
39
- * symbolicEqual('abs(x)','x', simplify.positiveContext) // true
34
+ * symbolicEqual('x*y', 'y*x') // Returns true
35
+ * symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}}) // Returns false
36
+ * symbolicEqual('x/y', '(y*x^(-1))^(-1)') // Returns true
37
+ * symbolicEqual('abs(x)','x') // Returns false
38
+ * symbolicEqual('abs(x)','x', simplify.positiveContext) // Returns true
40
39
  *
41
40
  * See also:
42
41
  *
@@ -65,7 +65,7 @@ export var createFix = /* #__PURE__ */factory(name, dependencies, _ref2 => {
65
65
  *
66
66
  * const c = math.complex(3.22, -2.78)
67
67
  * math.fix(c) // returns Complex 3 - 2i
68
- * math.fix(c, 1) // returns Complex 3.2 - 2.7i
68
+ * math.fix(c, 1) // returns Complex 3.2 -2.7i
69
69
  *
70
70
  * math.fix([3.2, 3.8, -4.7]) // returns Array [3, 3, -4]
71
71
  * math.fix([3.2, 3.8, -4.7], 1) // returns Array [3.2, 3.8, -4.7]
@@ -83,7 +83,7 @@ export var createFloor = /* #__PURE__ */factory(name, dependencies, _ref2 => {
83
83
  *
84
84
  * const c = math.complex(3.24, -2.71)
85
85
  * math.floor(c) // returns Complex 3 - 3i
86
- * math.floor(c, 1) // returns Complex 3.2 - 2.8i
86
+ * math.floor(c, 1) // returns Complex 3.2 -2.8i
87
87
  *
88
88
  * math.floor([3.2, 3.8, -4.7]) // returns Array [3, 3, -5]
89
89
  * math.floor([3.21, 3.82, -4.71], 1) // returns Array [3.2, 3.8, -4.8]
@@ -25,7 +25,7 @@ export var createInvmod = /* #__PURE__ */factory(name, dependencies, _ref => {
25
25
  * Examples:
26
26
  *
27
27
  * math.invmod(8, 12) // returns NaN
28
- * math.invmod(7, 13) // return 2
28
+ * math.invmod(7, 13) // returns 2
29
29
  * math.invmod(15151, 15122) // returns 10429
30
30
  *
31
31
  * See also:
@@ -49,9 +49,9 @@ export var createNthRoot = /* #__PURE__ */factory(name, dependencies, _ref => {
49
49
  *
50
50
  * Examples:
51
51
  *
52
- * math.nthRoot(9, 2) // returns 3, as 3^2 == 9
53
- * math.sqrt(9) // returns 3, as 3^2 == 9
54
- * math.nthRoot(64, 3) // returns 4, as 4^3 == 64
52
+ * math.nthRoot(9, 2) // returns 3 (since 3^2 == 9)
53
+ * math.sqrt(9) // returns 3 (since 3^2 == 9)
54
+ * math.nthRoot(64, 3) // returns 4 (since 4^3 == 64)
55
55
  *
56
56
  * See also:
57
57
  *
@@ -92,12 +92,12 @@ export var createNthRoots = /* #__PURE__ */factory(name, dependencies, _ref => {
92
92
  * // {re: 1, im: 0},
93
93
  * // {re: -1, im: 0}
94
94
  * // ]
95
- * nthRoots(1, 3)
95
+ * math.nthRoots(1, 3)
96
96
  * // returns [
97
97
  * // { re: 1, im: 0 },
98
98
  * // { re: -0.4999999999999998, im: 0.8660254037844387 },
99
99
  * // { re: -0.5000000000000004, im: -0.8660254037844385 }
100
- * ]
100
+ * // ]
101
101
  *
102
102
  * See also:
103
103
  *
@@ -22,7 +22,7 @@ export var createBitNot = /* #__PURE__ */factory(name, dependencies, _ref => {
22
22
  *
23
23
  * math.bitNot(1) // returns number -2
24
24
  *
25
- * math.bitNot([2, -3, 4]) // returns Array [-3, 2, 5]
25
+ * math.bitNot([2, -3, 4]) // returns Array [-3, 2, -5]
26
26
  *
27
27
  * See also:
28
28
  *
@@ -62,7 +62,7 @@ export var createLeftShift = /* #__PURE__ */factory(name, dependencies, _ref =>
62
62
  *
63
63
  * math.leftShift(1, 2) // returns number 4
64
64
  *
65
- * math.leftShift([1, 2, 3], 4) // returns Array [16, 32, 64]
65
+ * math.leftShift([1, 2, 4], 4) // returns Array [16, 32, 64]
66
66
  *
67
67
  * See also:
68
68
  *
@@ -62,7 +62,7 @@ export var createRightArithShift = /* #__PURE__ */factory(name, dependencies, _r
62
62
  *
63
63
  * math.rightArithShift(4, 2) // returns number 1
64
64
  *
65
- * math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 3]
65
+ * math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 4]
66
66
  *
67
67
  * See also:
68
68
  *
@@ -61,7 +61,7 @@ export var createRightLogShift = /* #__PURE__ */factory(name, dependencies, _ref
61
61
  *
62
62
  * math.rightLogShift(4, 2) // returns number 1
63
63
  *
64
- * math.rightLogShift([16, -32, 64], 4) // returns Array [1, 2, 3]
64
+ * math.rightLogShift([16, 32, 64], 4) // returns Array [1, 2, 4]
65
65
  *
66
66
  * See also:
67
67
  *
@@ -41,11 +41,11 @@ export var createDistance = /* #__PURE__ */factory(name, dependencies, _ref => {
41
41
  * math.distance({pointX: 2, pointY: 5, pointZ: 9}, {x0: 4, y0: 6, z0: 3, a: 4, b: 2, c: 0})
42
42
  *
43
43
  * Examples:
44
- * math.distance([0,0], [4,4]) // Returns 5.6569
44
+ * math.distance([0,0], [4,4]) // Returns 5.656854249492381
45
45
  * math.distance(
46
46
  * {pointOneX: 0, pointOneY: 0},
47
47
  * {pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951
48
- * math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.74166
48
+ * math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.7416573867739413
49
49
  * math.distance(
50
50
  * {pointOneX: 4, pointOneY: 5, pointOneZ: 8},
51
51
  * {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3
@@ -29,7 +29,7 @@ export var createDiff = /* #__PURE__ */factory(name, dependencies, _ref => {
29
29
  *
30
30
  * const arr = [1, 2, 4, 7, 0]
31
31
  * math.diff(arr) // returns [1, 2, 3, -7] (no dimension passed so 0 is assumed)
32
- * math.diff(math.matrix(arr)) // returns math.matrix([1, 2, 3, -7])
32
+ * math.diff(math.matrix(arr)) // returns Matrix [1, 2, 3, -7]
33
33
  *
34
34
  * const arr = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [9, 8, 7, 6, 4]]
35
35
  * math.diff(arr) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]