mathjs 10.5.2 → 10.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. package/HISTORY.md +8 -0
  2. package/lib/browser/math.js +3 -3
  3. package/lib/browser/math.js.map +1 -1
  4. package/lib/cjs/header.js +2 -2
  5. package/lib/cjs/version.js +1 -1
  6. package/lib/esm/version.js +1 -1
  7. package/package.json +6 -11
  8. package/docs/command_line_interface.md +0 -87
  9. package/docs/core/chaining.md +0 -41
  10. package/docs/core/configuration.md +0 -144
  11. package/docs/core/extension.md +0 -263
  12. package/docs/core/index.md +0 -21
  13. package/docs/core/serialization.md +0 -50
  14. package/docs/custom_bundling.md +0 -116
  15. package/docs/datatypes/bignumbers.md +0 -102
  16. package/docs/datatypes/complex_numbers.md +0 -168
  17. package/docs/datatypes/fractions.md +0 -75
  18. package/docs/datatypes/index.md +0 -67
  19. package/docs/datatypes/matrices.md +0 -375
  20. package/docs/datatypes/numbers.md +0 -106
  21. package/docs/datatypes/units.md +0 -444
  22. package/docs/expressions/algebra.md +0 -110
  23. package/docs/expressions/customization.md +0 -379
  24. package/docs/expressions/expression_trees.md +0 -710
  25. package/docs/expressions/html_classes.md +0 -38
  26. package/docs/expressions/index.md +0 -21
  27. package/docs/expressions/parsing.md +0 -224
  28. package/docs/expressions/security.md +0 -89
  29. package/docs/expressions/syntax.md +0 -706
  30. package/docs/getting_started.md +0 -124
  31. package/docs/index.md +0 -39
  32. package/docs/reference/classes/densematrix.md +0 -247
  33. package/docs/reference/classes/fibonacciheap.md +0 -70
  34. package/docs/reference/classes/matrixindex.md +0 -133
  35. package/docs/reference/classes/matrixrange.md +0 -158
  36. package/docs/reference/classes/resultset.md +0 -47
  37. package/docs/reference/classes/sparsematrix.md +0 -245
  38. package/docs/reference/classes/unit.md +0 -242
  39. package/docs/reference/classes.md +0 -86
  40. package/docs/reference/constants.md +0 -29
  41. package/docs/reference/functions/abs.md +0 -46
  42. package/docs/reference/functions/acos.md +0 -49
  43. package/docs/reference/functions/acosh.md +0 -47
  44. package/docs/reference/functions/acot.md +0 -48
  45. package/docs/reference/functions/acoth.md +0 -46
  46. package/docs/reference/functions/acsc.md +0 -49
  47. package/docs/reference/functions/acsch.md +0 -46
  48. package/docs/reference/functions/add.md +0 -59
  49. package/docs/reference/functions/and.md +0 -53
  50. package/docs/reference/functions/apply.md +0 -56
  51. package/docs/reference/functions/arg.md +0 -53
  52. package/docs/reference/functions/asec.md +0 -49
  53. package/docs/reference/functions/asech.md +0 -46
  54. package/docs/reference/functions/asin.md +0 -49
  55. package/docs/reference/functions/asinh.md +0 -46
  56. package/docs/reference/functions/atan.md +0 -49
  57. package/docs/reference/functions/atan2.md +0 -56
  58. package/docs/reference/functions/atanh.md +0 -46
  59. package/docs/reference/functions/bellNumbers.md +0 -45
  60. package/docs/reference/functions/bignumber.md +0 -47
  61. package/docs/reference/functions/bin.md +0 -45
  62. package/docs/reference/functions/bitAnd.md +0 -51
  63. package/docs/reference/functions/bitNot.md +0 -51
  64. package/docs/reference/functions/bitOr.md +0 -52
  65. package/docs/reference/functions/bitXor.md +0 -51
  66. package/docs/reference/functions/boolean.md +0 -50
  67. package/docs/reference/functions/catalan.md +0 -45
  68. package/docs/reference/functions/cbrt.md +0 -60
  69. package/docs/reference/functions/ceil.md +0 -63
  70. package/docs/reference/functions/chain.md +0 -54
  71. package/docs/reference/functions/clone.md +0 -43
  72. package/docs/reference/functions/column.md +0 -45
  73. package/docs/reference/functions/combinations.md +0 -49
  74. package/docs/reference/functions/combinationsWithRep.md +0 -49
  75. package/docs/reference/functions/compare.md +0 -67
  76. package/docs/reference/functions/compareNatural.md +0 -92
  77. package/docs/reference/functions/compareText.md +0 -54
  78. package/docs/reference/functions/compile.md +0 -56
  79. package/docs/reference/functions/complex.md +0 -17
  80. package/docs/reference/functions/composition.md +0 -46
  81. package/docs/reference/functions/concat.md +0 -56
  82. package/docs/reference/functions/config.md +0 -44
  83. package/docs/reference/functions/conj.md +0 -50
  84. package/docs/reference/functions/cos.md +0 -51
  85. package/docs/reference/functions/cosh.md +0 -46
  86. package/docs/reference/functions/cot.md +0 -47
  87. package/docs/reference/functions/coth.md +0 -49
  88. package/docs/reference/functions/count.md +0 -45
  89. package/docs/reference/functions/createUnit.md +0 -52
  90. package/docs/reference/functions/cross.md +0 -58
  91. package/docs/reference/functions/csc.md +0 -47
  92. package/docs/reference/functions/csch.md +0 -49
  93. package/docs/reference/functions/ctranspose.md +0 -50
  94. package/docs/reference/functions/cube.md +0 -51
  95. package/docs/reference/functions/cumsum.md +0 -57
  96. package/docs/reference/functions/deepEqual.md +0 -53
  97. package/docs/reference/functions/derivative.md +0 -61
  98. package/docs/reference/functions/det.md +0 -49
  99. package/docs/reference/functions/diag.md +0 -61
  100. package/docs/reference/functions/diff.md +0 -70
  101. package/docs/reference/functions/distance.md +0 -80
  102. package/docs/reference/functions/divide.md +0 -55
  103. package/docs/reference/functions/dot.md +0 -48
  104. package/docs/reference/functions/dotDivide.md +0 -52
  105. package/docs/reference/functions/dotMultiply.md +0 -52
  106. package/docs/reference/functions/dotPow.md +0 -49
  107. package/docs/reference/functions/eigs.md +0 -54
  108. package/docs/reference/functions/equal.md +0 -75
  109. package/docs/reference/functions/equalText.md +0 -53
  110. package/docs/reference/functions/erf.md +0 -49
  111. package/docs/reference/functions/evaluate.md +0 -56
  112. package/docs/reference/functions/exp.md +0 -54
  113. package/docs/reference/functions/expm.md +0 -49
  114. package/docs/reference/functions/expm1.md +0 -54
  115. package/docs/reference/functions/factorial.md +0 -49
  116. package/docs/reference/functions/fft.md +0 -35
  117. package/docs/reference/functions/filter.md +0 -50
  118. package/docs/reference/functions/fix.md +0 -62
  119. package/docs/reference/functions/flatten.md +0 -46
  120. package/docs/reference/functions/floor.md +0 -66
  121. package/docs/reference/functions/forEach.md +0 -41
  122. package/docs/reference/functions/format.md +0 -127
  123. package/docs/reference/functions/fraction.md +0 -45
  124. package/docs/reference/functions/gamma.md +0 -49
  125. package/docs/reference/functions/gcd.md +0 -50
  126. package/docs/reference/functions/getMatrixDataType.md +0 -59
  127. package/docs/reference/functions/hasNumericValue.md +0 -55
  128. package/docs/reference/functions/help.md +0 -42
  129. package/docs/reference/functions/hex.md +0 -45
  130. package/docs/reference/functions/hypot.md +0 -51
  131. package/docs/reference/functions/identity.md +0 -57
  132. package/docs/reference/functions/ifft.md +0 -35
  133. package/docs/reference/functions/im.md +0 -53
  134. package/docs/reference/functions/import.md +0 -68
  135. package/docs/reference/functions/index.md +0 -55
  136. package/docs/reference/functions/intersect.md +0 -50
  137. package/docs/reference/functions/inv.md +0 -45
  138. package/docs/reference/functions/invmod.md +0 -47
  139. package/docs/reference/functions/isInteger.md +0 -55
  140. package/docs/reference/functions/isNaN.md +0 -56
  141. package/docs/reference/functions/isNegative.md +0 -55
  142. package/docs/reference/functions/isNumeric.md +0 -55
  143. package/docs/reference/functions/isPositive.md +0 -57
  144. package/docs/reference/functions/isPrime.md +0 -54
  145. package/docs/reference/functions/isZero.md +0 -59
  146. package/docs/reference/functions/kldivergence.md +0 -41
  147. package/docs/reference/functions/kron.md +0 -53
  148. package/docs/reference/functions/larger.md +0 -60
  149. package/docs/reference/functions/largerEq.md +0 -56
  150. package/docs/reference/functions/lcm.md +0 -54
  151. package/docs/reference/functions/leafCount.md +0 -52
  152. package/docs/reference/functions/leftShift.md +0 -52
  153. package/docs/reference/functions/lgamma.md +0 -46
  154. package/docs/reference/functions/log.md +0 -57
  155. package/docs/reference/functions/log10.md +0 -50
  156. package/docs/reference/functions/log1p.md +0 -54
  157. package/docs/reference/functions/log2.md +0 -50
  158. package/docs/reference/functions/lsolve.md +0 -51
  159. package/docs/reference/functions/lsolveAll.md +0 -51
  160. package/docs/reference/functions/lup.md +0 -52
  161. package/docs/reference/functions/lusolve.md +0 -59
  162. package/docs/reference/functions/mad.md +0 -50
  163. package/docs/reference/functions/map.md +0 -65
  164. package/docs/reference/functions/matrix.md +0 -56
  165. package/docs/reference/functions/matrixFromColumns.md +0 -49
  166. package/docs/reference/functions/matrixFromFunction.md +0 -54
  167. package/docs/reference/functions/matrixFromRows.md +0 -49
  168. package/docs/reference/functions/max.md +0 -61
  169. package/docs/reference/functions/mean.md +0 -57
  170. package/docs/reference/functions/median.md +0 -57
  171. package/docs/reference/functions/min.md +0 -61
  172. package/docs/reference/functions/mod.md +0 -59
  173. package/docs/reference/functions/mode.md +0 -50
  174. package/docs/reference/functions/multinomial.md +0 -46
  175. package/docs/reference/functions/multiply.md +0 -60
  176. package/docs/reference/functions/norm.md +0 -59
  177. package/docs/reference/functions/not.md +0 -50
  178. package/docs/reference/functions/nthRoot.md +0 -53
  179. package/docs/reference/functions/nthRoots.md +0 -58
  180. package/docs/reference/functions/number.md +0 -49
  181. package/docs/reference/functions/numeric.md +0 -52
  182. package/docs/reference/functions/oct.md +0 -45
  183. package/docs/reference/functions/ones.md +0 -59
  184. package/docs/reference/functions/or.md +0 -53
  185. package/docs/reference/functions/parse.md +0 -56
  186. package/docs/reference/functions/parser.md +0 -70
  187. package/docs/reference/functions/partitionSelect.md +0 -53
  188. package/docs/reference/functions/permutations.md +0 -51
  189. package/docs/reference/functions/pickRandom.md +0 -59
  190. package/docs/reference/functions/pinv.md +0 -44
  191. package/docs/reference/functions/pow.md +0 -65
  192. package/docs/reference/functions/print.md +0 -64
  193. package/docs/reference/functions/prod.md +0 -55
  194. package/docs/reference/functions/qr.md +0 -65
  195. package/docs/reference/functions/quantileSeq.md +0 -62
  196. package/docs/reference/functions/random.md +0 -54
  197. package/docs/reference/functions/randomInt.md +0 -53
  198. package/docs/reference/functions/range.md +0 -70
  199. package/docs/reference/functions/rationalize.md +0 -68
  200. package/docs/reference/functions/re.md +0 -53
  201. package/docs/reference/functions/reshape.md +0 -60
  202. package/docs/reference/functions/resize.md +0 -51
  203. package/docs/reference/functions/resolve.md +0 -46
  204. package/docs/reference/functions/rightArithShift.md +0 -52
  205. package/docs/reference/functions/rightLogShift.md +0 -52
  206. package/docs/reference/functions/rotate.md +0 -53
  207. package/docs/reference/functions/rotationMatrix.md +0 -57
  208. package/docs/reference/functions/round.md +0 -61
  209. package/docs/reference/functions/row.md +0 -45
  210. package/docs/reference/functions/sec.md +0 -47
  211. package/docs/reference/functions/sech.md +0 -49
  212. package/docs/reference/functions/setCartesian.md +0 -49
  213. package/docs/reference/functions/setDifference.md +0 -47
  214. package/docs/reference/functions/setDistinct.md +0 -43
  215. package/docs/reference/functions/setIntersect.md +0 -46
  216. package/docs/reference/functions/setIsSubset.md +0 -47
  217. package/docs/reference/functions/setMultiplicity.md +0 -46
  218. package/docs/reference/functions/setPowerset.md +0 -43
  219. package/docs/reference/functions/setSize.md +0 -47
  220. package/docs/reference/functions/setSymDifference.md +0 -47
  221. package/docs/reference/functions/setUnion.md +0 -46
  222. package/docs/reference/functions/sign.md +0 -52
  223. package/docs/reference/functions/simplify.md +0 -130
  224. package/docs/reference/functions/simplifyConstant.md +0 -52
  225. package/docs/reference/functions/simplifyCore.md +0 -50
  226. package/docs/reference/functions/sin.md +0 -51
  227. package/docs/reference/functions/sinh.md +0 -46
  228. package/docs/reference/functions/size.md +0 -50
  229. package/docs/reference/functions/slu.md +0 -57
  230. package/docs/reference/functions/smaller.md +0 -60
  231. package/docs/reference/functions/smallerEq.md +0 -56
  232. package/docs/reference/functions/sort.md +0 -56
  233. package/docs/reference/functions/sparse.md +0 -51
  234. package/docs/reference/functions/splitUnit.md +0 -37
  235. package/docs/reference/functions/sqrt.md +0 -50
  236. package/docs/reference/functions/sqrtm.md +0 -46
  237. package/docs/reference/functions/square.md +0 -51
  238. package/docs/reference/functions/squeeze.md +0 -53
  239. package/docs/reference/functions/std.md +0 -76
  240. package/docs/reference/functions/stirlingS2.md +0 -52
  241. package/docs/reference/functions/string.md +0 -49
  242. package/docs/reference/functions/subset.md +0 -65
  243. package/docs/reference/functions/subtract.md +0 -54
  244. package/docs/reference/functions/sum.md +0 -54
  245. package/docs/reference/functions/symbolicEqual.md +0 -62
  246. package/docs/reference/functions/tan.md +0 -49
  247. package/docs/reference/functions/tanh.md +0 -50
  248. package/docs/reference/functions/to.md +0 -47
  249. package/docs/reference/functions/trace.md +0 -50
  250. package/docs/reference/functions/transpose.md +0 -49
  251. package/docs/reference/functions/typeOf.md +0 -81
  252. package/docs/reference/functions/typed.md +0 -56
  253. package/docs/reference/functions/unaryMinus.md +0 -49
  254. package/docs/reference/functions/unaryPlus.md +0 -48
  255. package/docs/reference/functions/unequal.md +0 -74
  256. package/docs/reference/functions/unit.md +0 -48
  257. package/docs/reference/functions/usolve.md +0 -51
  258. package/docs/reference/functions/usolveAll.md +0 -51
  259. package/docs/reference/functions/variance.md +0 -78
  260. package/docs/reference/functions/xgcd.md +0 -47
  261. package/docs/reference/functions/xor.md +0 -53
  262. package/docs/reference/functions/zeros.md +0 -57
  263. package/docs/reference/functions.md +0 -297
  264. package/docs/reference/index.md +0 -5
  265. package/examples/advanced/convert_fraction_to_bignumber.js +0 -59
  266. package/examples/advanced/custom_argument_parsing.js +0 -98
  267. package/examples/advanced/custom_datatype.js +0 -56
  268. package/examples/advanced/custom_evaluate_using_factories.js +0 -19
  269. package/examples/advanced/custom_evaluate_using_import.js +0 -18
  270. package/examples/advanced/custom_loading.js +0 -33
  271. package/examples/advanced/custom_relational_functions.js +0 -62
  272. package/examples/advanced/custom_scope_objects.js +0 -115
  273. package/examples/advanced/expression_trees.js +0 -55
  274. package/examples/advanced/function_transform.js +0 -50
  275. package/examples/advanced/more_secure_eval.js +0 -36
  276. package/examples/advanced/use_bigint.js +0 -43
  277. package/examples/advanced/web_server/math_worker.js +0 -24
  278. package/examples/advanced/web_server/server.js +0 -80
  279. package/examples/algebra.js +0 -34
  280. package/examples/basic_usage.js +0 -49
  281. package/examples/bignumbers.js +0 -52
  282. package/examples/browser/angle_configuration.html +0 -134
  283. package/examples/browser/basic_usage.html +0 -39
  284. package/examples/browser/currency_conversion.html +0 -125
  285. package/examples/browser/custom_separators.html +0 -81
  286. package/examples/browser/plot.html +0 -78
  287. package/examples/browser/pretty_printing_with_mathjax.html +0 -122
  288. package/examples/browser/printing_html.html +0 -170
  289. package/examples/browser/requirejs_loading.html +0 -20
  290. package/examples/browser/rocket_trajectory_optimization.html +0 -301
  291. package/examples/browser/webworkers/webworkers.html +0 -80
  292. package/examples/browser/webworkers/worker.js +0 -28
  293. package/examples/chaining.js +0 -56
  294. package/examples/complex_numbers.js +0 -67
  295. package/examples/expressions.js +0 -188
  296. package/examples/fractions.js +0 -74
  297. package/examples/import.js +0 -95
  298. package/examples/matrices.js +0 -101
  299. package/examples/objects.js +0 -35
  300. package/examples/package.json +0 -3
  301. package/examples/serialization.js +0 -16
  302. package/examples/sparse_matrices.js +0 -19
  303. package/examples/units.js +0 -108
@@ -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 diff
4
-
5
- Create a new matrix or array of the difference between elements of the given array
6
- The optional dim parameter lets you specify the dimension to evaluate the difference of
7
- If no dimension parameter is passed it is assumed as dimension 0
8
-
9
- Dimension is zero-based in javascript and one-based in the parser and can be a number or bignumber
10
- Arrays must be 'rectangular' meaning arrays like [1, 2]
11
- If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays
12
-
13
-
14
- ## Syntax
15
-
16
- ```js
17
- math.diff(arr)
18
- math.diff(arr, dim)
19
- ```
20
-
21
- ### Parameters
22
-
23
- Parameter | Type | Description
24
- --------- | ---- | -----------
25
- `arr` | Array &#124; Matrix | An array or matrix
26
- `dim` | number | Dimension
27
-
28
- ### Returns
29
-
30
- Type | Description
31
- ---- | -----------
32
- Array &#124; Matrix | Difference between array elements in given dimension
33
-
34
-
35
- ### Throws
36
-
37
- Type | Description
38
- ---- | -----------
39
-
40
-
41
- ## Examples
42
-
43
- ```js
44
- const arr = [1, 2, 4, 7, 0]
45
- math.diff(arr) // returns [1, 2, 3, -7] (no dimension passed so 0 is assumed)
46
- math.diff(math.matrix(arr)) // returns math.matrix([1, 2, 3, -7])
47
-
48
- const arr = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [9, 8, 7, 6, 4]]
49
- math.diff(arr) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]
50
- math.diff(arr, 0) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]
51
- math.diff(arr, 1) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]]
52
- math.diff(arr, math.bignumber(1)) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]]
53
-
54
- math.diff(arr, 2) // throws RangeError as arr is 2 dimensional not 3
55
- math.diff(arr, -1) // throws RangeError as negative dimensions are not allowed
56
-
57
- // These will all produce the same result
58
- math.diff([[1, 2], [3, 4]])
59
- math.diff([math.matrix([1, 2]), math.matrix([3, 4])])
60
- math.diff([[1, 2], math.matrix([3, 4])])
61
- math.diff([math.matrix([1, 2]), [3, 4]])
62
- // They do not produce the same result as math.diff(math.matrix([[1, 2], [3, 4]])) as this returns a matrix
63
- ```
64
-
65
-
66
- ## See also
67
-
68
- [sum](sum.md),
69
- [subtract](subtract.md),
70
- [partitionSelect](partitionSelect.md)
@@ -1,80 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function distance
4
-
5
- Calculates:
6
- The eucledian distance between two points in N-dimensional spaces.
7
- Distance between point and a line in 2 and 3 dimensional spaces.
8
- Pairwise distance between a set of 2D or 3D points
9
- NOTE:
10
- When substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c
11
- For parametric equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)
12
-
13
-
14
- ## Syntax
15
-
16
- ```js
17
- math.distance([x1, y1], [x2, y2])
18
- math.distance({pointOneX: 4, pointOneY: 5}, {pointTwoX: 2, pointTwoY: 7})
19
- math.distance([x1, y1, z1], [x2, y2, z2])
20
- math.distance({pointOneX: 4, pointOneY: 5, pointOneZ: 8}, {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9})
21
- math.distance([x1, y1, ... , N1], [x2, y2, ... , N2])
22
- math.distance([[A], [B], [C]...])
23
- math.distance([x1, y1], [LinePtX1, LinePtY1], [LinePtX2, LinePtY2])
24
- math.distance({pointX: 1, pointY: 4}, {lineOnePtX: 6, lineOnePtY: 3}, {lineTwoPtX: 2, lineTwoPtY: 8})
25
- math.distance([x1, y1, z1], [LinePtX1, LinePtY1, LinePtZ1], [LinePtX2, LinePtY2, LinePtZ2])
26
- math.distance({pointX: 1, pointY: 4, pointZ: 7}, {lineOnePtX: 6, lineOnePtY: 3, lineOnePtZ: 4}, {lineTwoPtX: 2, lineTwoPtY: 8, lineTwoPtZ: 5})
27
- math.distance([x1, y1], [xCoeffLine, yCoeffLine, constant])
28
- math.distance({pointX: 10, pointY: 10}, {xCoeffLine: 8, yCoeffLine: 1, constant: 3})
29
- math.distance([x1, y1, z1], [x0, y0, z0, a-tCoeff, b-tCoeff, c-tCoeff]) point and parametric equation of 3D line
30
- math.distance([x, y, z], [x0, y0, z0, a, b, c])
31
- math.distance({pointX: 2, pointY: 5, pointZ: 9}, {x0: 4, y0: 6, z0: 3, a: 4, b: 2, c: 0})
32
- ```
33
-
34
- ### Parameters
35
-
36
- Parameter | Type | Description
37
- --------- | ---- | -----------
38
- `x` | Array &#124; Matrix &#124; Object | Co-ordinates of first point
39
- `y` | Array &#124; Matrix &#124; Object | Co-ordinates of second point
40
-
41
- ### Returns
42
-
43
- Type | Description
44
- ---- | -----------
45
- Number &#124; BigNumber | Returns the distance from two/three points
46
-
47
-
48
- ### Throws
49
-
50
- Type | Description
51
- ---- | -----------
52
-
53
-
54
- ## Examples
55
-
56
- ```js
57
- math.distance([0,0], [4,4]) // Returns 5.6569
58
- math.distance(
59
- {pointOneX: 0, pointOneY: 0},
60
- {pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951
61
- math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.74166
62
- math.distance(
63
- {pointOneX: 4, pointOneY: 5, pointOneZ: 8},
64
- {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3
65
- math.distance([1, 0, 1, 0], [0, -1, 0, -1]) // Returns 2
66
- math.distance([[1, 2], [1, 2], [1, 3]]) // Returns [0, 1, 1]
67
- math.distance([[1,2,4], [1,2,6], [8,1,3]]) // Returns [2, 7.14142842854285, 7.681145747868608]
68
- math.distance([10, 10], [8, 1, 3]) // Returns 11.535230316796387
69
- math.distance([10, 10], [2, 3], [-8, 0]) // Returns 8.759953130362847
70
- math.distance(
71
- {pointX: 1, pointY: 4},
72
- {lineOnePtX: 6, lineOnePtY: 3},
73
- {lineTwoPtX: 2, lineTwoPtY: 8}) // Returns 2.720549372624744
74
- math.distance([2, 3, 1], [1, 1, 2, 5, 0, 1]) // Returns 2.3204774044612857
75
- math.distance(
76
- {pointX: 2, pointY: 3, pointZ: 1},
77
- {x0: 1, y0: 1, z0: 2, a: 5, b: 0, c: 1} // Returns 2.3204774044612857
78
- ```
79
-
80
-
@@ -1,55 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function divide
4
-
5
- Divide two values, `x / y`.
6
- To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.divide(x, y)
13
- ```
14
-
15
- ### Parameters
16
-
17
- Parameter | Type | Description
18
- --------- | ---- | -----------
19
- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Numerator
20
- `y` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix | Denominator
21
-
22
- ### Returns
23
-
24
- Type | Description
25
- ---- | -----------
26
- number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Quotient, `x / y`
27
-
28
-
29
- ### Throws
30
-
31
- Type | Description
32
- ---- | -----------
33
-
34
-
35
- ## Examples
36
-
37
- ```js
38
- math.divide(2, 3) // returns number 0.6666666666666666
39
-
40
- const a = math.complex(5, 14)
41
- const b = math.complex(4, 1)
42
- math.divide(a, b) // returns Complex 2 + 3i
43
-
44
- const c = [[7, -6], [13, -4]]
45
- const d = [[1, 2], [4, 3]]
46
- math.divide(c, d) // returns Array [[-9, 4], [-11, 6]]
47
-
48
- const e = math.unit('18 km')
49
- math.divide(e, 4.5) // returns Unit 4 km
50
- ```
51
-
52
-
53
- ## See also
54
-
55
- [multiply](multiply.md)
@@ -1,48 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function dot
4
-
5
- Calculate the dot product of two vectors. The dot product of
6
- `A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:
7
-
8
- dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn
9
-
10
-
11
- ## Syntax
12
-
13
- ```js
14
- math.dot(x, y)
15
- ```
16
-
17
- ### Parameters
18
-
19
- Parameter | Type | Description
20
- --------- | ---- | -----------
21
- `x` | Array &#124; Matrix | First vector
22
- `y` | Array &#124; Matrix | Second vector
23
-
24
- ### Returns
25
-
26
- Type | Description
27
- ---- | -----------
28
- number | Returns the dot product of `x` and `y`
29
-
30
-
31
- ### Throws
32
-
33
- Type | Description
34
- ---- | -----------
35
-
36
-
37
- ## Examples
38
-
39
- ```js
40
- math.dot([2, 4, 1], [2, 2, 3]) // returns number 15
41
- math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15
42
- ```
43
-
44
-
45
- ## See also
46
-
47
- [multiply](multiply.md),
48
- [cross](cross.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 dotDivide
4
-
5
- Divide two matrices element wise. The function accepts both matrices and
6
- scalar values.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.dotDivide(x, y)
13
- ```
14
-
15
- ### Parameters
16
-
17
- Parameter | Type | Description
18
- --------- | ---- | -----------
19
- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Numerator
20
- `y` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Denominator
21
-
22
- ### Returns
23
-
24
- Type | Description
25
- ---- | -----------
26
- number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Quotient, `x ./ y`
27
-
28
-
29
- ### Throws
30
-
31
- Type | Description
32
- ---- | -----------
33
-
34
-
35
- ## Examples
36
-
37
- ```js
38
- math.dotDivide(2, 4) // returns 0.5
39
-
40
- a = [[9, 5], [6, 1]]
41
- b = [[3, 2], [5, 2]]
42
-
43
- math.dotDivide(a, b) // returns [[3, 2.5], [1.2, 0.5]]
44
- math.divide(a, b) // returns [[1.75, 0.75], [-1.75, 2.25]]
45
- ```
46
-
47
-
48
- ## See also
49
-
50
- [divide](divide.md),
51
- [multiply](multiply.md),
52
- [dotMultiply](dotMultiply.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 dotMultiply
4
-
5
- Multiply two matrices element wise. The function accepts both matrices and
6
- scalar values.
7
-
8
-
9
- ## Syntax
10
-
11
- ```js
12
- math.dotMultiply(x, y)
13
- ```
14
-
15
- ### Parameters
16
-
17
- Parameter | Type | Description
18
- --------- | ---- | -----------
19
- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Left hand value
20
- `y` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Right hand value
21
-
22
- ### Returns
23
-
24
- Type | Description
25
- ---- | -----------
26
- number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Multiplication of `x` and `y`
27
-
28
-
29
- ### Throws
30
-
31
- Type | Description
32
- ---- | -----------
33
-
34
-
35
- ## Examples
36
-
37
- ```js
38
- math.dotMultiply(2, 4) // returns 8
39
-
40
- a = [[9, 5], [6, 1]]
41
- b = [[3, 2], [5, 2]]
42
-
43
- math.dotMultiply(a, b) // returns [[27, 10], [30, 2]]
44
- math.multiply(a, b) // returns [[52, 28], [23, 14]]
45
- ```
46
-
47
-
48
- ## See also
49
-
50
- [multiply](multiply.md),
51
- [divide](divide.md),
52
- [dotDivide](dotDivide.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 dotPow
4
-
5
- Calculates the power of x to y element wise.
6
-
7
-
8
- ## Syntax
9
-
10
- ```js
11
- math.dotPow(x, y)
12
- ```
13
-
14
- ### Parameters
15
-
16
- Parameter | Type | Description
17
- --------- | ---- | -----------
18
- `x` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | The base
19
- `y` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | The exponent
20
-
21
- ### Returns
22
-
23
- Type | Description
24
- ---- | -----------
25
- number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | The value of `x` to the power `y`
26
-
27
-
28
- ### Throws
29
-
30
- Type | Description
31
- ---- | -----------
32
-
33
-
34
- ## Examples
35
-
36
- ```js
37
- math.dotPow(2, 3) // returns number 8
38
-
39
- const a = [[1, 2], [4, 3]]
40
- math.dotPow(a, 2) // returns Array [[1, 4], [16, 9]]
41
- math.pow(a, 2) // returns Array [[9, 8], [16, 17]]
42
- ```
43
-
44
-
45
- ## See also
46
-
47
- [pow](pow.md),
48
- [sqrt](sqrt.md),
49
- [multiply](multiply.md)
@@ -1,54 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function eigs
4
-
5
- Compute eigenvalues and eigenvectors of a matrix. The eigenvalues are sorted by their absolute value, ascending.
6
- An eigenvalue with multiplicity k will be listed k times. The eigenvectors are returned as columns of a matrix –
7
- the eigenvector that belongs to the j-th eigenvalue in the list (eg. `values[j]`) is the j-th column (eg. `column(vectors, j)`).
8
- If the algorithm fails to converge, it will throw an error – in that case, however, you may still find useful information
9
- in `err.values` and `err.vectors`.
10
-
11
-
12
- ## Syntax
13
-
14
- ```js
15
- math.eigs(x, [prec])
16
- ```
17
-
18
- ### Parameters
19
-
20
- Parameter | Type | Description
21
- --------- | ---- | -----------
22
- `x` | Array &#124; Matrix | Matrix to be diagonalized
23
- `prec` | number &#124; BigNumber | Precision, default value: 1e-15
24
-
25
- ### Returns
26
-
27
- Type | Description
28
- ---- | -----------
29
- {values: Array &#124; Matrix, vectors: Array &#124; Matrix} | Object containing an array of eigenvalues and a matrix with eigenvectors as columns.
30
-
31
-
32
- ### Throws
33
-
34
- Type | Description
35
- ---- | -----------
36
-
37
-
38
- ## Examples
39
-
40
- ```js
41
- const { eigs, multiply, column, transpose } = math
42
- const H = [[5, 2.3], [2.3, 1]]
43
- const ans = eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
44
- const E = ans.values
45
- const U = ans.vectors
46
- multiply(H, column(U, 0)) // returns multiply(E[0], column(U, 0))
47
- const UTxHxU = multiply(transpose(U), H, U) // diagonalizes H
48
- E[0] == UTxHxU[0][0] // returns true
49
- ```
50
-
51
-
52
- ## See also
53
-
54
- [inv](inv.md)
@@ -1,75 +0,0 @@
1
- <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
-
3
- # Function equal
4
-
5
- Test whether two values are equal.
6
-
7
- The function tests whether the relative difference between x and y is
8
- smaller than the configured epsilon. The function cannot be used to
9
- compare values smaller than approximately 2.22e-16.
10
-
11
- For matrices, the function is evaluated element wise.
12
- In case of complex numbers, x.re must equal y.re, and x.im must equal y.im.
13
-
14
- Values `null` and `undefined` are compared strictly, thus `null` is only
15
- equal to `null` and nothing else, and `undefined` is only equal to
16
- `undefined` and nothing else. Strings are compared by their numerical value.
17
-
18
-
19
- ## Syntax
20
-
21
- ```js
22
- math.equal(x, y)
23
- ```
24
-
25
- ### Parameters
26
-
27
- Parameter | Type | Description
28
- --------- | ---- | -----------
29
- `x` | number &#124; BigNumber &#124; boolean &#124; Complex &#124; Unit &#124; string &#124; Array &#124; Matrix | First value to compare
30
- `y` | number &#124; BigNumber &#124; boolean &#124; Complex &#124; Unit &#124; string &#124; Array &#124; Matrix | Second value to compare
31
-
32
- ### Returns
33
-
34
- Type | Description
35
- ---- | -----------
36
- boolean &#124; Array &#124; Matrix | Returns true when the compared values are equal, else returns false
37
-
38
-
39
- ### Throws
40
-
41
- Type | Description
42
- ---- | -----------
43
-
44
-
45
- ## Examples
46
-
47
- ```js
48
- math.equal(2 + 2, 3) // returns false
49
- math.equal(2 + 2, 4) // returns true
50
-
51
- const a = math.unit('50 cm')
52
- const b = math.unit('5 m')
53
- math.equal(a, b) // returns true
54
-
55
- const c = [2, 5, 1]
56
- const d = [2, 7, 1]
57
-
58
- math.equal(c, d) // returns [true, false, true]
59
- math.deepEqual(c, d) // returns false
60
-
61
- math.equal("1000", "1e3") // returns true
62
- math.equal(0, null) // returns false
63
- ```
64
-
65
-
66
- ## See also
67
-
68
- [unequal](unequal.md),
69
- [smaller](smaller.md),
70
- [smallerEq](smallerEq.md),
71
- [larger](larger.md),
72
- [largerEq](largerEq.md),
73
- [compare](compare.md),
74
- [deepEqual](deepEqual.md),
75
- [equalText](equalText.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 equalText
4
-
5
- Check equality of two strings. Comparison is case sensitive.
6
-
7
- For matrices, the function is evaluated element wise.
8
-
9
-
10
- ## Syntax
11
-
12
- ```js
13
- math.equalText(x, y)
14
- ```
15
-
16
- ### Parameters
17
-
18
- Parameter | Type | Description
19
- --------- | ---- | -----------
20
- `x` | string &#124; Array &#124; DenseMatrix | First string to compare
21
- `y` | string &#124; Array &#124; DenseMatrix | Second string to compare
22
-
23
- ### Returns
24
-
25
- Type | Description
26
- ---- | -----------
27
- number &#124; Array &#124; DenseMatrix | Returns true if the values are equal, and false if not.
28
-
29
-
30
- ### Throws
31
-
32
- Type | Description
33
- ---- | -----------
34
-
35
-
36
- ## Examples
37
-
38
- ```js
39
- math.equalText('Hello', 'Hello') // returns true
40
- math.equalText('a', 'A') // returns false
41
- math.equal('2e3', '2000') // returns true
42
- math.equalText('2e3', '2000') // returns false
43
-
44
- math.equalText('B', ['A', 'B', 'C']) // returns [false, true, false]
45
- ```
46
-
47
-
48
- ## See also
49
-
50
- [equal](equal.md),
51
- [compareText](compareText.md),
52
- [compare](compare.md),
53
- [compareNatural](compareNatural.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 erf
4
-
5
- Compute the erf function of a value using a rational Chebyshev
6
- approximations for different intervals of x.
7
-
8
- This is a translation of W. J. Cody's Fortran implementation from 1987
9
- ( https://www.netlib.org/specfun/erf ). See the AMS publication
10
- "Rational Chebyshev Approximations for the Error Function" by W. J. Cody
11
- for an explanation of this process.
12
-
13
- For matrices, the function is evaluated element wise.
14
-
15
-
16
- ## Syntax
17
-
18
- ```js
19
- math.erf(x)
20
- ```
21
-
22
- ### Parameters
23
-
24
- Parameter | Type | Description
25
- --------- | ---- | -----------
26
- `x` | number &#124; Array &#124; Matrix | A real number
27
-
28
- ### Returns
29
-
30
- Type | Description
31
- ---- | -----------
32
- number &#124; Array &#124; Matrix | The erf of `x`
33
-
34
-
35
- ### Throws
36
-
37
- Type | Description
38
- ---- | -----------
39
-
40
-
41
- ## Examples
42
-
43
- ```js
44
- math.erf(0.2) // returns 0.22270258921047847
45
- math.erf(-0.5) // returns -0.5204998778130465
46
- math.erf(4) // returns 0.9999999845827421
47
- ```
48
-
49
-
@@ -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 evaluate
4
-
5
- Evaluate an expression.
6
-
7
- Note the evaluating arbitrary expressions may involve security risks,
8
- see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information.
9
-
10
-
11
- ## Syntax
12
-
13
- ```js
14
- math.evaluate(expr)
15
- math.evaluate(expr, scope)
16
- math.evaluate([expr1, expr2, expr3, ...])
17
- math.evaluate([expr1, expr2, expr3, ...], scope)
18
- ```
19
-
20
- ### Parameters
21
-
22
- Parameter | Type | Description
23
- --------- | ---- | -----------
24
- `expr` | string &#124; string[] &#124; Matrix | The expression to be evaluated
25
- `scope` | Object | Scope to read/write variables
26
-
27
- ### Returns
28
-
29
- Type | Description
30
- ---- | -----------
31
- * | The result of the expression
32
-
33
-
34
- ### Throws
35
-
36
- Type | Description
37
- ---- | -----------
38
- Error |
39
-
40
- ## Examples
41
-
42
- ```js
43
- math.evaluate('(2+3)/4') // 1.25
44
- math.evaluate('sqrt(3^2 + 4^2)') // 5
45
- math.evaluate('sqrt(-4)') // 2i
46
- math.evaluate(['a=3', 'b=4', 'a*b']) // [3, 4, 12]
47
-
48
- let scope = {a:3, b:4}
49
- math.evaluate('a * b', scope) // 12
50
- ```
51
-
52
-
53
- ## See also
54
-
55
- [parse](parse.md),
56
- [compile](compile.md)