mathjs 10.5.2 → 10.6.1

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.
Files changed (329) hide show
  1. package/HISTORY.md +28 -0
  2. package/lib/browser/math.js +6 -5
  3. package/lib/browser/math.js.map +1 -1
  4. package/lib/cjs/entry/dependenciesAny/dependenciesFft.generated.js +41 -0
  5. package/lib/cjs/entry/dependenciesAny/dependenciesIfft.generated.js +29 -0
  6. package/lib/cjs/entry/dependenciesAny.generated.js +16 -0
  7. package/lib/cjs/entry/impureFunctionsAny.generated.js +66 -64
  8. package/lib/cjs/entry/pureFunctionsAny.generated.js +189 -171
  9. package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +6 -0
  10. package/lib/cjs/expression/embeddedDocs/function/matrix/fft.js +15 -0
  11. package/lib/cjs/expression/embeddedDocs/function/matrix/ifft.js +15 -0
  12. package/lib/cjs/factoriesAny.js +16 -0
  13. package/lib/cjs/function/algebra/derivative.js +1 -1
  14. package/lib/cjs/function/matrix/fft.js +128 -0
  15. package/lib/cjs/function/matrix/ifft.js +49 -0
  16. package/lib/cjs/header.js +2 -2
  17. package/lib/cjs/version.js +1 -1
  18. package/lib/esm/entry/dependenciesAny/dependenciesFft.generated.js +24 -0
  19. package/lib/esm/entry/dependenciesAny/dependenciesIfft.generated.js +16 -0
  20. package/lib/esm/entry/dependenciesAny.generated.js +2 -0
  21. package/lib/esm/entry/impureFunctionsAny.generated.js +63 -61
  22. package/lib/esm/entry/pureFunctionsAny.generated.js +161 -145
  23. package/lib/esm/expression/embeddedDocs/embeddedDocs.js +4 -0
  24. package/lib/esm/expression/embeddedDocs/function/matrix/fft.js +8 -0
  25. package/lib/esm/expression/embeddedDocs/function/matrix/ifft.js +8 -0
  26. package/lib/esm/factoriesAny.js +2 -0
  27. package/lib/esm/function/algebra/derivative.js +1 -1
  28. package/lib/esm/function/matrix/fft.js +104 -0
  29. package/lib/esm/function/matrix/ifft.js +38 -0
  30. package/lib/esm/version.js +1 -1
  31. package/package.json +22 -24
  32. package/types/index.d.ts +1052 -283
  33. package/types/index.ts +711 -7
  34. package/docs/command_line_interface.md +0 -87
  35. package/docs/core/chaining.md +0 -41
  36. package/docs/core/configuration.md +0 -144
  37. package/docs/core/extension.md +0 -263
  38. package/docs/core/index.md +0 -21
  39. package/docs/core/serialization.md +0 -50
  40. package/docs/custom_bundling.md +0 -116
  41. package/docs/datatypes/bignumbers.md +0 -102
  42. package/docs/datatypes/complex_numbers.md +0 -168
  43. package/docs/datatypes/fractions.md +0 -75
  44. package/docs/datatypes/index.md +0 -67
  45. package/docs/datatypes/matrices.md +0 -375
  46. package/docs/datatypes/numbers.md +0 -106
  47. package/docs/datatypes/units.md +0 -444
  48. package/docs/expressions/algebra.md +0 -110
  49. package/docs/expressions/customization.md +0 -379
  50. package/docs/expressions/expression_trees.md +0 -710
  51. package/docs/expressions/html_classes.md +0 -38
  52. package/docs/expressions/index.md +0 -21
  53. package/docs/expressions/parsing.md +0 -224
  54. package/docs/expressions/security.md +0 -89
  55. package/docs/expressions/syntax.md +0 -706
  56. package/docs/getting_started.md +0 -124
  57. package/docs/index.md +0 -39
  58. package/docs/reference/classes/densematrix.md +0 -247
  59. package/docs/reference/classes/fibonacciheap.md +0 -70
  60. package/docs/reference/classes/matrixindex.md +0 -133
  61. package/docs/reference/classes/matrixrange.md +0 -158
  62. package/docs/reference/classes/resultset.md +0 -47
  63. package/docs/reference/classes/sparsematrix.md +0 -245
  64. package/docs/reference/classes/unit.md +0 -242
  65. package/docs/reference/classes.md +0 -86
  66. package/docs/reference/constants.md +0 -29
  67. package/docs/reference/functions/abs.md +0 -46
  68. package/docs/reference/functions/acos.md +0 -49
  69. package/docs/reference/functions/acosh.md +0 -47
  70. package/docs/reference/functions/acot.md +0 -48
  71. package/docs/reference/functions/acoth.md +0 -46
  72. package/docs/reference/functions/acsc.md +0 -49
  73. package/docs/reference/functions/acsch.md +0 -46
  74. package/docs/reference/functions/add.md +0 -59
  75. package/docs/reference/functions/and.md +0 -53
  76. package/docs/reference/functions/apply.md +0 -56
  77. package/docs/reference/functions/arg.md +0 -53
  78. package/docs/reference/functions/asec.md +0 -49
  79. package/docs/reference/functions/asech.md +0 -46
  80. package/docs/reference/functions/asin.md +0 -49
  81. package/docs/reference/functions/asinh.md +0 -46
  82. package/docs/reference/functions/atan.md +0 -49
  83. package/docs/reference/functions/atan2.md +0 -56
  84. package/docs/reference/functions/atanh.md +0 -46
  85. package/docs/reference/functions/bellNumbers.md +0 -45
  86. package/docs/reference/functions/bignumber.md +0 -47
  87. package/docs/reference/functions/bin.md +0 -45
  88. package/docs/reference/functions/bitAnd.md +0 -51
  89. package/docs/reference/functions/bitNot.md +0 -51
  90. package/docs/reference/functions/bitOr.md +0 -52
  91. package/docs/reference/functions/bitXor.md +0 -51
  92. package/docs/reference/functions/boolean.md +0 -50
  93. package/docs/reference/functions/catalan.md +0 -45
  94. package/docs/reference/functions/cbrt.md +0 -60
  95. package/docs/reference/functions/ceil.md +0 -63
  96. package/docs/reference/functions/chain.md +0 -54
  97. package/docs/reference/functions/clone.md +0 -43
  98. package/docs/reference/functions/column.md +0 -45
  99. package/docs/reference/functions/combinations.md +0 -49
  100. package/docs/reference/functions/combinationsWithRep.md +0 -49
  101. package/docs/reference/functions/compare.md +0 -67
  102. package/docs/reference/functions/compareNatural.md +0 -92
  103. package/docs/reference/functions/compareText.md +0 -54
  104. package/docs/reference/functions/compile.md +0 -56
  105. package/docs/reference/functions/complex.md +0 -17
  106. package/docs/reference/functions/composition.md +0 -46
  107. package/docs/reference/functions/concat.md +0 -56
  108. package/docs/reference/functions/config.md +0 -44
  109. package/docs/reference/functions/conj.md +0 -50
  110. package/docs/reference/functions/cos.md +0 -51
  111. package/docs/reference/functions/cosh.md +0 -46
  112. package/docs/reference/functions/cot.md +0 -47
  113. package/docs/reference/functions/coth.md +0 -49
  114. package/docs/reference/functions/count.md +0 -45
  115. package/docs/reference/functions/createUnit.md +0 -52
  116. package/docs/reference/functions/cross.md +0 -58
  117. package/docs/reference/functions/csc.md +0 -47
  118. package/docs/reference/functions/csch.md +0 -49
  119. package/docs/reference/functions/ctranspose.md +0 -50
  120. package/docs/reference/functions/cube.md +0 -51
  121. package/docs/reference/functions/cumsum.md +0 -57
  122. package/docs/reference/functions/deepEqual.md +0 -53
  123. package/docs/reference/functions/derivative.md +0 -61
  124. package/docs/reference/functions/det.md +0 -49
  125. package/docs/reference/functions/diag.md +0 -61
  126. package/docs/reference/functions/diff.md +0 -70
  127. package/docs/reference/functions/distance.md +0 -80
  128. package/docs/reference/functions/divide.md +0 -55
  129. package/docs/reference/functions/dot.md +0 -48
  130. package/docs/reference/functions/dotDivide.md +0 -52
  131. package/docs/reference/functions/dotMultiply.md +0 -52
  132. package/docs/reference/functions/dotPow.md +0 -49
  133. package/docs/reference/functions/eigs.md +0 -54
  134. package/docs/reference/functions/equal.md +0 -75
  135. package/docs/reference/functions/equalText.md +0 -53
  136. package/docs/reference/functions/erf.md +0 -49
  137. package/docs/reference/functions/evaluate.md +0 -56
  138. package/docs/reference/functions/exp.md +0 -54
  139. package/docs/reference/functions/expm.md +0 -49
  140. package/docs/reference/functions/expm1.md +0 -54
  141. package/docs/reference/functions/factorial.md +0 -49
  142. package/docs/reference/functions/fft.md +0 -35
  143. package/docs/reference/functions/filter.md +0 -50
  144. package/docs/reference/functions/fix.md +0 -62
  145. package/docs/reference/functions/flatten.md +0 -46
  146. package/docs/reference/functions/floor.md +0 -66
  147. package/docs/reference/functions/forEach.md +0 -41
  148. package/docs/reference/functions/format.md +0 -127
  149. package/docs/reference/functions/fraction.md +0 -45
  150. package/docs/reference/functions/gamma.md +0 -49
  151. package/docs/reference/functions/gcd.md +0 -50
  152. package/docs/reference/functions/getMatrixDataType.md +0 -59
  153. package/docs/reference/functions/hasNumericValue.md +0 -55
  154. package/docs/reference/functions/help.md +0 -42
  155. package/docs/reference/functions/hex.md +0 -45
  156. package/docs/reference/functions/hypot.md +0 -51
  157. package/docs/reference/functions/identity.md +0 -57
  158. package/docs/reference/functions/ifft.md +0 -35
  159. package/docs/reference/functions/im.md +0 -53
  160. package/docs/reference/functions/import.md +0 -68
  161. package/docs/reference/functions/index.md +0 -55
  162. package/docs/reference/functions/intersect.md +0 -50
  163. package/docs/reference/functions/inv.md +0 -45
  164. package/docs/reference/functions/invmod.md +0 -47
  165. package/docs/reference/functions/isInteger.md +0 -55
  166. package/docs/reference/functions/isNaN.md +0 -56
  167. package/docs/reference/functions/isNegative.md +0 -55
  168. package/docs/reference/functions/isNumeric.md +0 -55
  169. package/docs/reference/functions/isPositive.md +0 -57
  170. package/docs/reference/functions/isPrime.md +0 -54
  171. package/docs/reference/functions/isZero.md +0 -59
  172. package/docs/reference/functions/kldivergence.md +0 -41
  173. package/docs/reference/functions/kron.md +0 -53
  174. package/docs/reference/functions/larger.md +0 -60
  175. package/docs/reference/functions/largerEq.md +0 -56
  176. package/docs/reference/functions/lcm.md +0 -54
  177. package/docs/reference/functions/leafCount.md +0 -52
  178. package/docs/reference/functions/leftShift.md +0 -52
  179. package/docs/reference/functions/lgamma.md +0 -46
  180. package/docs/reference/functions/log.md +0 -57
  181. package/docs/reference/functions/log10.md +0 -50
  182. package/docs/reference/functions/log1p.md +0 -54
  183. package/docs/reference/functions/log2.md +0 -50
  184. package/docs/reference/functions/lsolve.md +0 -51
  185. package/docs/reference/functions/lsolveAll.md +0 -51
  186. package/docs/reference/functions/lup.md +0 -52
  187. package/docs/reference/functions/lusolve.md +0 -59
  188. package/docs/reference/functions/mad.md +0 -50
  189. package/docs/reference/functions/map.md +0 -65
  190. package/docs/reference/functions/matrix.md +0 -56
  191. package/docs/reference/functions/matrixFromColumns.md +0 -49
  192. package/docs/reference/functions/matrixFromFunction.md +0 -54
  193. package/docs/reference/functions/matrixFromRows.md +0 -49
  194. package/docs/reference/functions/max.md +0 -61
  195. package/docs/reference/functions/mean.md +0 -57
  196. package/docs/reference/functions/median.md +0 -57
  197. package/docs/reference/functions/min.md +0 -61
  198. package/docs/reference/functions/mod.md +0 -59
  199. package/docs/reference/functions/mode.md +0 -50
  200. package/docs/reference/functions/multinomial.md +0 -46
  201. package/docs/reference/functions/multiply.md +0 -60
  202. package/docs/reference/functions/norm.md +0 -59
  203. package/docs/reference/functions/not.md +0 -50
  204. package/docs/reference/functions/nthRoot.md +0 -53
  205. package/docs/reference/functions/nthRoots.md +0 -58
  206. package/docs/reference/functions/number.md +0 -49
  207. package/docs/reference/functions/numeric.md +0 -52
  208. package/docs/reference/functions/oct.md +0 -45
  209. package/docs/reference/functions/ones.md +0 -59
  210. package/docs/reference/functions/or.md +0 -53
  211. package/docs/reference/functions/parse.md +0 -56
  212. package/docs/reference/functions/parser.md +0 -70
  213. package/docs/reference/functions/partitionSelect.md +0 -53
  214. package/docs/reference/functions/permutations.md +0 -51
  215. package/docs/reference/functions/pickRandom.md +0 -59
  216. package/docs/reference/functions/pinv.md +0 -44
  217. package/docs/reference/functions/pow.md +0 -65
  218. package/docs/reference/functions/print.md +0 -64
  219. package/docs/reference/functions/prod.md +0 -55
  220. package/docs/reference/functions/qr.md +0 -65
  221. package/docs/reference/functions/quantileSeq.md +0 -62
  222. package/docs/reference/functions/random.md +0 -54
  223. package/docs/reference/functions/randomInt.md +0 -53
  224. package/docs/reference/functions/range.md +0 -70
  225. package/docs/reference/functions/rationalize.md +0 -68
  226. package/docs/reference/functions/re.md +0 -53
  227. package/docs/reference/functions/reshape.md +0 -60
  228. package/docs/reference/functions/resize.md +0 -51
  229. package/docs/reference/functions/resolve.md +0 -46
  230. package/docs/reference/functions/rightArithShift.md +0 -52
  231. package/docs/reference/functions/rightLogShift.md +0 -52
  232. package/docs/reference/functions/rotate.md +0 -53
  233. package/docs/reference/functions/rotationMatrix.md +0 -57
  234. package/docs/reference/functions/round.md +0 -61
  235. package/docs/reference/functions/row.md +0 -45
  236. package/docs/reference/functions/sec.md +0 -47
  237. package/docs/reference/functions/sech.md +0 -49
  238. package/docs/reference/functions/setCartesian.md +0 -49
  239. package/docs/reference/functions/setDifference.md +0 -47
  240. package/docs/reference/functions/setDistinct.md +0 -43
  241. package/docs/reference/functions/setIntersect.md +0 -46
  242. package/docs/reference/functions/setIsSubset.md +0 -47
  243. package/docs/reference/functions/setMultiplicity.md +0 -46
  244. package/docs/reference/functions/setPowerset.md +0 -43
  245. package/docs/reference/functions/setSize.md +0 -47
  246. package/docs/reference/functions/setSymDifference.md +0 -47
  247. package/docs/reference/functions/setUnion.md +0 -46
  248. package/docs/reference/functions/sign.md +0 -52
  249. package/docs/reference/functions/simplify.md +0 -130
  250. package/docs/reference/functions/simplifyConstant.md +0 -52
  251. package/docs/reference/functions/simplifyCore.md +0 -50
  252. package/docs/reference/functions/sin.md +0 -51
  253. package/docs/reference/functions/sinh.md +0 -46
  254. package/docs/reference/functions/size.md +0 -50
  255. package/docs/reference/functions/slu.md +0 -57
  256. package/docs/reference/functions/smaller.md +0 -60
  257. package/docs/reference/functions/smallerEq.md +0 -56
  258. package/docs/reference/functions/sort.md +0 -56
  259. package/docs/reference/functions/sparse.md +0 -51
  260. package/docs/reference/functions/splitUnit.md +0 -37
  261. package/docs/reference/functions/sqrt.md +0 -50
  262. package/docs/reference/functions/sqrtm.md +0 -46
  263. package/docs/reference/functions/square.md +0 -51
  264. package/docs/reference/functions/squeeze.md +0 -53
  265. package/docs/reference/functions/std.md +0 -76
  266. package/docs/reference/functions/stirlingS2.md +0 -52
  267. package/docs/reference/functions/string.md +0 -49
  268. package/docs/reference/functions/subset.md +0 -65
  269. package/docs/reference/functions/subtract.md +0 -54
  270. package/docs/reference/functions/sum.md +0 -54
  271. package/docs/reference/functions/symbolicEqual.md +0 -62
  272. package/docs/reference/functions/tan.md +0 -49
  273. package/docs/reference/functions/tanh.md +0 -50
  274. package/docs/reference/functions/to.md +0 -47
  275. package/docs/reference/functions/trace.md +0 -50
  276. package/docs/reference/functions/transpose.md +0 -49
  277. package/docs/reference/functions/typeOf.md +0 -81
  278. package/docs/reference/functions/typed.md +0 -56
  279. package/docs/reference/functions/unaryMinus.md +0 -49
  280. package/docs/reference/functions/unaryPlus.md +0 -48
  281. package/docs/reference/functions/unequal.md +0 -74
  282. package/docs/reference/functions/unit.md +0 -48
  283. package/docs/reference/functions/usolve.md +0 -51
  284. package/docs/reference/functions/usolveAll.md +0 -51
  285. package/docs/reference/functions/variance.md +0 -78
  286. package/docs/reference/functions/xgcd.md +0 -47
  287. package/docs/reference/functions/xor.md +0 -53
  288. package/docs/reference/functions/zeros.md +0 -57
  289. package/docs/reference/functions.md +0 -297
  290. package/docs/reference/index.md +0 -5
  291. package/examples/advanced/convert_fraction_to_bignumber.js +0 -59
  292. package/examples/advanced/custom_argument_parsing.js +0 -98
  293. package/examples/advanced/custom_datatype.js +0 -56
  294. package/examples/advanced/custom_evaluate_using_factories.js +0 -19
  295. package/examples/advanced/custom_evaluate_using_import.js +0 -18
  296. package/examples/advanced/custom_loading.js +0 -33
  297. package/examples/advanced/custom_relational_functions.js +0 -62
  298. package/examples/advanced/custom_scope_objects.js +0 -115
  299. package/examples/advanced/expression_trees.js +0 -55
  300. package/examples/advanced/function_transform.js +0 -50
  301. package/examples/advanced/more_secure_eval.js +0 -36
  302. package/examples/advanced/use_bigint.js +0 -43
  303. package/examples/advanced/web_server/math_worker.js +0 -24
  304. package/examples/advanced/web_server/server.js +0 -80
  305. package/examples/algebra.js +0 -34
  306. package/examples/basic_usage.js +0 -49
  307. package/examples/bignumbers.js +0 -52
  308. package/examples/browser/angle_configuration.html +0 -134
  309. package/examples/browser/basic_usage.html +0 -39
  310. package/examples/browser/currency_conversion.html +0 -125
  311. package/examples/browser/custom_separators.html +0 -81
  312. package/examples/browser/plot.html +0 -78
  313. package/examples/browser/pretty_printing_with_mathjax.html +0 -122
  314. package/examples/browser/printing_html.html +0 -170
  315. package/examples/browser/requirejs_loading.html +0 -20
  316. package/examples/browser/rocket_trajectory_optimization.html +0 -301
  317. package/examples/browser/webworkers/webworkers.html +0 -80
  318. package/examples/browser/webworkers/worker.js +0 -28
  319. package/examples/chaining.js +0 -56
  320. package/examples/complex_numbers.js +0 -67
  321. package/examples/expressions.js +0 -188
  322. package/examples/fractions.js +0 -74
  323. package/examples/import.js +0 -95
  324. package/examples/matrices.js +0 -101
  325. package/examples/objects.js +0 -35
  326. package/examples/package.json +0 -3
  327. package/examples/serialization.js +0 -16
  328. package/examples/sparse_matrices.js +0 -19
  329. package/examples/units.js +0 -108
@@ -1,60 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function multiply
4
-
5
- Multiply two or more values, `x * y`.
6
- For matrices, the matrix product is calculated.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.multiply(x, y)
13
- math.multiply(x, y, z, ...)
14
- ```
15
-
16
- ### Parameters
17
-
18
- Parameter | Type | Description
19
- --------- | ---- | -----------
20
- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | First value to multiply
21
- `y` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Second value to multiply
22
-
23
- ### Returns
24
-
25
- Type | Description
26
- ---- | -----------
27
- number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Multiplication of `x` and `y`
28
-
29
-
30
- ### Throws
31
-
32
- Type | Description
33
- ---- | -----------
34
-
35
-
36
- ## Examples
37
-
38
- ```js
39
- math.multiply(4, 5.2) // returns number 20.8
40
- math.multiply(2, 3, 4) // returns number 24
41
-
42
- const a = math.complex(2, 3)
43
- const b = math.complex(4, 1)
44
- math.multiply(a, b) // returns Complex 5 + 14i
45
-
46
- const c = [[1, 2], [4, 3]]
47
- const d = [[1, 2, 3], [3, -4, 7]]
48
- math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]]
49
-
50
- const e = math.unit('2.1 km')
51
- math.multiply(3, e) // returns Unit 6.3 km
52
- ```
53
-
54
-
55
- ## See also
56
-
57
- [divide](divide.md),
58
- [prod](prod.md),
59
- [cross](cross.md),
60
- [dot](dot.md)
@@ -1,59 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function norm
4
-
5
- Calculate the norm of a number, vector or matrix.
6
-
7
- The second parameter p is optional. If not provided, it defaults to 2.
8
-
9
-
10
- ## Syntax
11
-
12
- ```js
13
- math.norm(x)
14
- math.norm(x, p)
15
- ```
16
-
17
- ### Parameters
18
-
19
- Parameter | Type | Description
20
- --------- | ---- | -----------
21
- `x` | number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix | Value for which to calculate the norm
22
- `p` | number &#124; BigNumber &#124; string | Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2.
23
-
24
- ### Returns
25
-
26
- Type | Description
27
- ---- | -----------
28
- number &#124; BigNumber | the p-norm
29
-
30
-
31
- ### Throws
32
-
33
- Type | Description
34
- ---- | -----------
35
-
36
-
37
- ## Examples
38
-
39
- ```js
40
- math.abs(-3.5) // returns 3.5
41
- math.norm(-3.5) // returns 3.5
42
-
43
- math.norm(math.complex(3, -4)) // returns 5
44
-
45
- math.norm([1, 2, -3], Infinity) // returns 3
46
- math.norm([1, 2, -3], -Infinity) // returns 1
47
-
48
- math.norm([3, 4], 2) // returns 5
49
-
50
- math.norm([[1, 2], [3, 4]], 1) // returns 6
51
- math.norm([[1, 2], [3, 4]], 'inf') // returns 7
52
- math.norm([[1, 2], [3, 4]], 'fro') // returns 5.477225575051661
53
- ```
54
-
55
-
56
- ## See also
57
-
58
- [abs](abs.md),
59
- [hypot](hypot.md)
@@ -1,50 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function not
4
-
5
- Logical `not`. Flips boolean value of a given parameter.
6
- For matrices, the function is evaluated element wise.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.not(x)
13
- ```
14
-
15
- ### Parameters
16
-
17
- Parameter | Type | Description
18
- --------- | ---- | -----------
19
- `x` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | First value to check
20
-
21
- ### Returns
22
-
23
- Type | Description
24
- ---- | -----------
25
- boolean &#124; Array &#124; Matrix | Returns true when input is a zero or empty value.
26
-
27
-
28
- ### Throws
29
-
30
- Type | Description
31
- ---- | -----------
32
-
33
-
34
- ## Examples
35
-
36
- ```js
37
- math.not(2) // returns false
38
- math.not(0) // returns true
39
- math.not(true) // returns false
40
-
41
- a = [2, -7, 0]
42
- math.not(a) // returns [false, false, true]
43
- ```
44
-
45
-
46
- ## See also
47
-
48
- [and](and.md),
49
- [or](or.md),
50
- [xor](xor.md)
@@ -1,53 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function nthRoot
4
-
5
- Calculate the nth root of a value.
6
- The principal nth root of a positive real number A, is the positive real
7
- solution of the equation
8
-
9
- x^root = A
10
-
11
- For matrices, the function is evaluated element wise.
12
-
13
-
14
- ## Syntax
15
-
16
- ```js
17
- math.nthRoot(a)
18
- math.nthRoot(a, root)
19
- ```
20
-
21
- ### Parameters
22
-
23
- Parameter | Type | Description
24
- --------- | ---- | -----------
25
- `a` | number &#124; BigNumber &#124; Array &#124; Matrix &#124; Complex | Value for which to calculate the nth root
26
- `root` | number &#124; BigNumber | The root. Default value: 2.
27
-
28
- ### Returns
29
-
30
- Type | Description
31
- ---- | -----------
32
- number &#124; Complex &#124; Array &#124; Matrix | Returns the nth root of `a`
33
-
34
-
35
- ### Throws
36
-
37
- Type | Description
38
- ---- | -----------
39
-
40
-
41
- ## Examples
42
-
43
- ```js
44
- math.nthRoot(9, 2) // returns 3, as 3^2 == 9
45
- math.sqrt(9) // returns 3, as 3^2 == 9
46
- math.nthRoot(64, 3) // returns 4, as 4^3 == 64
47
- ```
48
-
49
-
50
- ## See also
51
-
52
- [sqrt](sqrt.md),
53
- [pow](pow.md)
@@ -1,58 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function nthRoots
4
-
5
- Calculate the nth roots of a value.
6
- An nth root of a positive real number A,
7
- is a positive real solution of the equation "x^root = A".
8
- This function returns an array of complex values.
9
-
10
-
11
- ## Syntax
12
-
13
- ```js
14
- math.nthRoots(x)
15
- math.nthRoots(x, root)
16
- ```
17
-
18
- ### Parameters
19
-
20
- Parameter | Type | Description
21
- --------- | ---- | -----------
22
- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex | Number to be rounded
23
-
24
- ### Returns
25
-
26
- Type | Description
27
- ---- | -----------
28
- number &#124; BigNumber &#124; Fraction &#124; Complex | Rounded value
29
-
30
-
31
- ### Throws
32
-
33
- Type | Description
34
- ---- | -----------
35
-
36
-
37
- ## Examples
38
-
39
- ```js
40
- math.nthRoots(1)
41
- // returns [
42
- // {re: 1, im: 0},
43
- // {re: -1, im: 0}
44
- // ]
45
- nthRoots(1, 3)
46
- // returns [
47
- // { re: 1, im: 0 },
48
- // { re: -0.4999999999999998, im: 0.8660254037844387 },
49
- // { re: -0.5000000000000004, im: -0.8660254037844385 }
50
- ]
51
- ```
52
-
53
-
54
- ## See also
55
-
56
- [nthRoot](nthRoot.md),
57
- [pow](pow.md),
58
- [sqrt](sqrt.md)
@@ -1,49 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function number
4
-
5
- Create a number or convert a string, boolean, or unit to a number.
6
- When value is a matrix, all elements will be converted to number.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.number(value)
13
- math.number(unit, valuelessUnit)
14
- ```
15
-
16
- ### Parameters
17
-
18
- Parameter | Type | Description
19
- --------- | ---- | -----------
20
- `value` | string &#124; number &#124; BigNumber &#124; Fraction &#124; boolean &#124; Array &#124; Matrix &#124; Unit &#124; null | Value to be converted
21
- `valuelessUnit` | Unit &#124; string | A valueless unit, used to convert a unit to a number
22
-
23
- ### Returns
24
-
25
- Type | Description
26
- ---- | -----------
27
- number &#124; Array &#124; Matrix | The created number
28
-
29
-
30
- ## Examples
31
-
32
- ```js
33
- math.number(2) // returns number 2
34
- math.number('7.2') // returns number 7.2
35
- math.number(true) // returns number 1
36
- math.number([true, false, true, true]) // returns [1, 0, 1, 1]
37
- math.number(math.unit('52cm'), 'm') // returns 0.52
38
- ```
39
-
40
-
41
- ## See also
42
-
43
- [bignumber](bignumber.md),
44
- [boolean](boolean.md),
45
- [complex](complex.md),
46
- [index](index.md),
47
- [matrix](matrix.md),
48
- [string](string.md),
49
- [unit](unit.md)
@@ -1,52 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function numeric
4
-
5
- Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.
6
-
7
-
8
- ## Syntax
9
-
10
- ```js
11
- math.numeric(x)
12
- ```
13
-
14
- ### Parameters
15
-
16
- Parameter | Type | Description
17
- --------- | ---- | -----------
18
- `value` | string &#124; number &#124; BigNumber &#124; Fraction | A numeric value or a string containing a numeric value
19
- `outputType` | string | Desired numeric output type. Available values: 'number', 'BigNumber', or 'Fraction'
20
-
21
- ### Returns
22
-
23
- Type | Description
24
- ---- | -----------
25
- number &#124; BigNumber &#124; Fraction | Returns an instance of the numeric in the requested type
26
-
27
-
28
- ### Throws
29
-
30
- Type | Description
31
- ---- | -----------
32
-
33
-
34
- ## Examples
35
-
36
- ```js
37
- math.numeric('4') // returns number 4
38
- math.numeric('4', 'number') // returns number 4
39
- math.numeric('4', 'BigNumber') // returns BigNumber 4
40
- math.numeric('4', 'Fraction') // returns Fraction 4
41
- math.numeric(4, 'Fraction') // returns Fraction 4
42
- math.numeric(math.fraction(2, 5), 'number') // returns number 0.4
43
- ```
44
-
45
-
46
- ## See also
47
-
48
- [number](number.md),
49
- [fraction](fraction.md),
50
- [bignumber](bignumber.md),
51
- [string](string.md),
52
- [format](format.md)
@@ -1,45 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function oct
4
-
5
- Format a number as octal.
6
-
7
-
8
- ## Syntax
9
-
10
- ```js
11
- math.oct(value)
12
- ```
13
-
14
- ### Parameters
15
-
16
- Parameter | Type | Description
17
- --------- | ---- | -----------
18
- `value` | number | Value to be stringified
19
- `wordSize` | number | Optional word size (see `format`)
20
-
21
- ### Returns
22
-
23
- Type | Description
24
- ---- | -----------
25
- string | The formatted value
26
-
27
-
28
- ### Throws
29
-
30
- Type | Description
31
- ---- | -----------
32
-
33
-
34
- ## Examples
35
-
36
- ```js
37
- //the following outputs "0o70"
38
- math.oct(56)
39
- ```
40
-
41
-
42
- ## See also
43
-
44
- [bin](bin.md),
45
- [hex](hex.md)
@@ -1,59 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function ones
4
-
5
- Create a matrix filled with ones. The created matrix can have one or
6
- multiple dimensions.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.ones(m)
13
- math.ones(m, format)
14
- math.ones(m, n)
15
- math.ones(m, n, format)
16
- math.ones([m, n])
17
- math.ones([m, n], format)
18
- math.ones([m, n, p, ...])
19
- math.ones([m, n, p, ...], format)
20
- ```
21
-
22
- ### Parameters
23
-
24
- Parameter | Type | Description
25
- --------- | ---- | -----------
26
- `size` | ...number &#124; Array | The size of each dimension of the matrix
27
- `format` | string | The Matrix storage format
28
-
29
- ### Returns
30
-
31
- Type | Description
32
- ---- | -----------
33
- Array &#124; Matrix &#124; number | A matrix filled with ones
34
-
35
-
36
- ### Throws
37
-
38
- Type | Description
39
- ---- | -----------
40
-
41
-
42
- ## Examples
43
-
44
- ```js
45
- math.ones(3) // returns [1, 1, 1]
46
- math.ones(3, 2) // returns [[1, 1], [1, 1], [1, 1]]
47
- math.ones(3, 2, 'dense') // returns Dense Matrix [[1, 1], [1, 1], [1, 1]]
48
-
49
- const A = [[1, 2, 3], [4, 5, 6]]
50
- math.ones(math.size(A)) // returns [[1, 1, 1], [1, 1, 1]]
51
- ```
52
-
53
-
54
- ## See also
55
-
56
- [zeros](zeros.md),
57
- [identity](identity.md),
58
- [size](size.md),
59
- [range](range.md)
@@ -1,53 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function or
4
-
5
- Logical `or`. Test if at least one value is defined with a nonzero/nonempty value.
6
- For matrices, the function is evaluated element wise.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.or(x, y)
13
- ```
14
-
15
- ### Parameters
16
-
17
- Parameter | Type | Description
18
- --------- | ---- | -----------
19
- `x` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | First value to check
20
- `y` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Second value to check
21
-
22
- ### Returns
23
-
24
- Type | Description
25
- ---- | -----------
26
- boolean &#124; Array &#124; Matrix | Returns true when one of the inputs is defined with a nonzero/nonempty value.
27
-
28
-
29
- ### Throws
30
-
31
- Type | Description
32
- ---- | -----------
33
-
34
-
35
- ## Examples
36
-
37
- ```js
38
- math.or(2, 4) // returns true
39
-
40
- a = [2, 5, 0]
41
- b = [0, 22, 0]
42
- c = 0
43
-
44
- math.or(a, b) // returns [true, true, false]
45
- math.or(b, c) // returns [false, true, false]
46
- ```
47
-
48
-
49
- ## See also
50
-
51
- [and](and.md),
52
- [not](not.md),
53
- [xor](xor.md)
@@ -1,56 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function parse
4
-
5
- Parse an expression. Returns a node tree, which can be evaluated by
6
- invoking node.evaluate().
7
-
8
- Note the evaluating arbitrary expressions may involve security risks,
9
- see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information.
10
-
11
-
12
- ## Syntax
13
-
14
- ```js
15
- math.parse(expr)
16
- math.parse(expr, options)
17
- math.parse([expr1, expr2, expr3, ...])
18
- math.parse([expr1, expr2, expr3, ...], options)
19
- ```
20
-
21
- ### Parameters
22
-
23
- Parameter | Type | Description
24
- --------- | ---- | -----------
25
- `expr` | string &#124; string[] &#124; Matrix | Expression to be parsed
26
- `options` | {nodes: Object&lt;string, Node&gt;} | Available options:</br>- `nodes` a set of custom nodes
27
-
28
- ### Returns
29
-
30
- Type | Description
31
- ---- | -----------
32
- Node &#124; Node[] | node
33
-
34
-
35
- ## Examples
36
-
37
- ```js
38
- const node1 = math.parse('sqrt(3^2 + 4^2)')
39
- node1.compile().evaluate() // 5
40
-
41
- let scope = {a:3, b:4}
42
- const node2 = math.parse('a * b') // 12
43
- const code2 = node2.compile()
44
- code2.evaluate(scope) // 12
45
- scope.a = 5
46
- code2.evaluate(scope) // 20
47
-
48
- const nodes = math.parse(['a = 3', 'b = 4', 'a * b'])
49
- nodes[2].compile().evaluate() // 12
50
- ```
51
-
52
-
53
- ## See also
54
-
55
- [evaluate](evaluate.md),
56
- [compile](compile.md)
@@ -1,70 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function parser
4
-
5
- Create a parser. The function creates a new `math.Parser` object.
6
-
7
-
8
- ## Syntax
9
-
10
- ```js
11
- math.parser()
12
- ```
13
-
14
- ### Parameters
15
-
16
- Parameter | Type | Description
17
- --------- | ---- | -----------
18
-
19
-
20
- ### Returns
21
-
22
- Type | Description
23
- ---- | -----------
24
- Parser | Parser
25
-
26
-
27
- ### Throws
28
-
29
- Type | Description
30
- ---- | -----------
31
-
32
-
33
- ## Examples
34
-
35
- ```js
36
- const parser = new math.parser()
37
-
38
- // evaluate expressions
39
- const a = parser.evaluate('sqrt(3^2 + 4^2)') // 5
40
- const b = parser.evaluate('sqrt(-4)') // 2i
41
- const c = parser.evaluate('2 inch in cm') // 5.08 cm
42
- const d = parser.evaluate('cos(45 deg)') // 0.7071067811865476
43
-
44
- // define variables and functions
45
- parser.evaluate('x = 7 / 2') // 3.5
46
- parser.evaluate('x + 3') // 6.5
47
- parser.evaluate('f(x, y) = x^y') // f(x, y)
48
- parser.evaluate('f(2, 3)') // 8
49
-
50
- // get and set variables and functions
51
- const x = parser.get('x') // 7
52
- const f = parser.get('f') // function
53
- const g = f(3, 2) // 9
54
- parser.set('h', 500)
55
- const i = parser.evaluate('h / 2') // 250
56
- parser.set('hello', function (name) {
57
- return 'hello, ' + name + '!'
58
- })
59
- parser.evaluate('hello("user")') // "hello, user!"
60
-
61
- // clear defined functions and variables
62
- parser.clear()
63
- ```
64
-
65
-
66
- ## See also
67
-
68
- [evaluate](evaluate.md),
69
- [compile](compile.md),
70
- [parse](parse.md)