mathjs 10.1.1 → 10.2.0

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 (325) hide show
  1. package/HISTORY.md +17 -0
  2. package/docs/expressions/algebra.md +27 -0
  3. package/docs/reference/functions/abs.md +6 -0
  4. package/docs/reference/functions/acos.md +6 -0
  5. package/docs/reference/functions/acosh.md +6 -0
  6. package/docs/reference/functions/acot.md +6 -0
  7. package/docs/reference/functions/acoth.md +6 -0
  8. package/docs/reference/functions/acsc.md +6 -0
  9. package/docs/reference/functions/acsch.md +6 -0
  10. package/docs/reference/functions/add.md +6 -0
  11. package/docs/reference/functions/and.md +6 -0
  12. package/docs/reference/functions/apply.md +6 -0
  13. package/docs/reference/functions/arg.md +6 -0
  14. package/docs/reference/functions/asec.md +6 -0
  15. package/docs/reference/functions/asech.md +6 -0
  16. package/docs/reference/functions/asin.md +6 -0
  17. package/docs/reference/functions/asinh.md +6 -0
  18. package/docs/reference/functions/atan.md +6 -0
  19. package/docs/reference/functions/atan2.md +6 -0
  20. package/docs/reference/functions/atanh.md +6 -0
  21. package/docs/reference/functions/bellNumbers.md +6 -0
  22. package/docs/reference/functions/bin.md +6 -0
  23. package/docs/reference/functions/bitAnd.md +6 -0
  24. package/docs/reference/functions/bitNot.md +6 -0
  25. package/docs/reference/functions/bitOr.md +6 -0
  26. package/docs/reference/functions/bitXor.md +6 -0
  27. package/docs/reference/functions/catalan.md +6 -0
  28. package/docs/reference/functions/cbrt.md +6 -0
  29. package/docs/reference/functions/ceil.md +6 -0
  30. package/docs/reference/functions/clone.md +6 -0
  31. package/docs/reference/functions/column.md +6 -0
  32. package/docs/reference/functions/combinations.md +6 -0
  33. package/docs/reference/functions/combinationsWithRep.md +6 -0
  34. package/docs/reference/functions/compare.md +6 -0
  35. package/docs/reference/functions/compareNatural.md +6 -0
  36. package/docs/reference/functions/compareText.md +6 -0
  37. package/docs/reference/functions/compile.md +6 -0
  38. package/docs/reference/functions/composition.md +6 -0
  39. package/docs/reference/functions/concat.md +6 -0
  40. package/docs/reference/functions/conj.md +6 -0
  41. package/docs/reference/functions/cos.md +6 -0
  42. package/docs/reference/functions/cosh.md +6 -0
  43. package/docs/reference/functions/cot.md +6 -0
  44. package/docs/reference/functions/coth.md +6 -0
  45. package/docs/reference/functions/count.md +6 -0
  46. package/docs/reference/functions/cross.md +6 -0
  47. package/docs/reference/functions/csc.md +6 -0
  48. package/docs/reference/functions/csch.md +6 -0
  49. package/docs/reference/functions/ctranspose.md +6 -0
  50. package/docs/reference/functions/cube.md +6 -0
  51. package/docs/reference/functions/deepEqual.md +6 -0
  52. package/docs/reference/functions/derivative.md +6 -0
  53. package/docs/reference/functions/det.md +6 -0
  54. package/docs/reference/functions/diag.md +6 -0
  55. package/docs/reference/functions/diff.md +6 -0
  56. package/docs/reference/functions/distance.md +6 -0
  57. package/docs/reference/functions/divide.md +6 -0
  58. package/docs/reference/functions/dot.md +6 -0
  59. package/docs/reference/functions/dotDivide.md +6 -0
  60. package/docs/reference/functions/dotMultiply.md +6 -0
  61. package/docs/reference/functions/dotPow.md +6 -0
  62. package/docs/reference/functions/eigs.md +6 -0
  63. package/docs/reference/functions/equal.md +6 -0
  64. package/docs/reference/functions/equalText.md +6 -0
  65. package/docs/reference/functions/erf.md +6 -0
  66. package/docs/reference/functions/evaluate.md +6 -0
  67. package/docs/reference/functions/exp.md +6 -0
  68. package/docs/reference/functions/expm.md +6 -0
  69. package/docs/reference/functions/expm1.md +6 -0
  70. package/docs/reference/functions/factorial.md +6 -0
  71. package/docs/reference/functions/filter.md +6 -0
  72. package/docs/reference/functions/fix.md +6 -0
  73. package/docs/reference/functions/flatten.md +6 -0
  74. package/docs/reference/functions/floor.md +6 -0
  75. package/docs/reference/functions/forEach.md +6 -0
  76. package/docs/reference/functions/format.md +6 -0
  77. package/docs/reference/functions/gamma.md +6 -0
  78. package/docs/reference/functions/gcd.md +6 -0
  79. package/docs/reference/functions/getMatrixDataType.md +6 -0
  80. package/docs/reference/functions/hasNumericValue.md +6 -0
  81. package/docs/reference/functions/help.md +6 -0
  82. package/docs/reference/functions/hex.md +6 -0
  83. package/docs/reference/functions/hypot.md +6 -0
  84. package/docs/reference/functions/identity.md +6 -0
  85. package/docs/reference/functions/im.md +6 -0
  86. package/docs/reference/functions/intersect.md +6 -0
  87. package/docs/reference/functions/inv.md +6 -0
  88. package/docs/reference/functions/invmod.md +6 -0
  89. package/docs/reference/functions/isInteger.md +6 -0
  90. package/docs/reference/functions/isNaN.md +6 -0
  91. package/docs/reference/functions/isNegative.md +6 -0
  92. package/docs/reference/functions/isNumeric.md +6 -0
  93. package/docs/reference/functions/isPositive.md +6 -0
  94. package/docs/reference/functions/isPrime.md +6 -0
  95. package/docs/reference/functions/isZero.md +6 -0
  96. package/docs/reference/functions/kldivergence.md +6 -0
  97. package/docs/reference/functions/kron.md +6 -0
  98. package/docs/reference/functions/larger.md +6 -0
  99. package/docs/reference/functions/largerEq.md +6 -0
  100. package/docs/reference/functions/lcm.md +6 -0
  101. package/docs/reference/functions/leafCount.md +52 -0
  102. package/docs/reference/functions/leftShift.md +6 -0
  103. package/docs/reference/functions/log.md +6 -0
  104. package/docs/reference/functions/log10.md +6 -0
  105. package/docs/reference/functions/log1p.md +6 -0
  106. package/docs/reference/functions/log2.md +6 -0
  107. package/docs/reference/functions/lsolve.md +6 -0
  108. package/docs/reference/functions/lsolveAll.md +6 -0
  109. package/docs/reference/functions/lup.md +6 -0
  110. package/docs/reference/functions/lusolve.md +6 -0
  111. package/docs/reference/functions/mad.md +6 -0
  112. package/docs/reference/functions/map.md +6 -0
  113. package/docs/reference/functions/matrixFromColumns.md +6 -0
  114. package/docs/reference/functions/matrixFromFunction.md +6 -0
  115. package/docs/reference/functions/matrixFromRows.md +6 -0
  116. package/docs/reference/functions/max.md +6 -0
  117. package/docs/reference/functions/mean.md +6 -0
  118. package/docs/reference/functions/median.md +6 -0
  119. package/docs/reference/functions/min.md +6 -0
  120. package/docs/reference/functions/mod.md +6 -0
  121. package/docs/reference/functions/mode.md +6 -0
  122. package/docs/reference/functions/multinomial.md +6 -0
  123. package/docs/reference/functions/multiply.md +6 -0
  124. package/docs/reference/functions/norm.md +6 -0
  125. package/docs/reference/functions/not.md +6 -0
  126. package/docs/reference/functions/nthRoot.md +6 -0
  127. package/docs/reference/functions/nthRoots.md +6 -0
  128. package/docs/reference/functions/numeric.md +6 -0
  129. package/docs/reference/functions/oct.md +6 -0
  130. package/docs/reference/functions/ones.md +6 -0
  131. package/docs/reference/functions/or.md +6 -0
  132. package/docs/reference/functions/parser.md +6 -0
  133. package/docs/reference/functions/partitionSelect.md +6 -0
  134. package/docs/reference/functions/permutations.md +6 -0
  135. package/docs/reference/functions/pickRandom.md +6 -0
  136. package/docs/reference/functions/pow.md +6 -0
  137. package/docs/reference/functions/print.md +6 -0
  138. package/docs/reference/functions/prod.md +6 -0
  139. package/docs/reference/functions/qr.md +6 -0
  140. package/docs/reference/functions/quantileSeq.md +6 -0
  141. package/docs/reference/functions/random.md +6 -0
  142. package/docs/reference/functions/randomInt.md +6 -0
  143. package/docs/reference/functions/range.md +6 -0
  144. package/docs/reference/functions/rationalize.md +7 -1
  145. package/docs/reference/functions/re.md +6 -0
  146. package/docs/reference/functions/reshape.md +7 -0
  147. package/docs/reference/functions/resize.md +6 -0
  148. package/docs/reference/functions/resolve.md +46 -0
  149. package/docs/reference/functions/rightArithShift.md +6 -0
  150. package/docs/reference/functions/rightLogShift.md +6 -0
  151. package/docs/reference/functions/rotate.md +6 -0
  152. package/docs/reference/functions/rotationMatrix.md +6 -0
  153. package/docs/reference/functions/round.md +6 -0
  154. package/docs/reference/functions/row.md +6 -0
  155. package/docs/reference/functions/sec.md +6 -0
  156. package/docs/reference/functions/sech.md +6 -0
  157. package/docs/reference/functions/setCartesian.md +6 -0
  158. package/docs/reference/functions/setDifference.md +6 -0
  159. package/docs/reference/functions/setDistinct.md +6 -0
  160. package/docs/reference/functions/setIntersect.md +6 -0
  161. package/docs/reference/functions/setIsSubset.md +6 -0
  162. package/docs/reference/functions/setMultiplicity.md +6 -0
  163. package/docs/reference/functions/setPowerset.md +6 -0
  164. package/docs/reference/functions/setSize.md +6 -0
  165. package/docs/reference/functions/setSymDifference.md +6 -0
  166. package/docs/reference/functions/setUnion.md +6 -0
  167. package/docs/reference/functions/sign.md +6 -0
  168. package/docs/reference/functions/simplify.md +43 -6
  169. package/docs/reference/functions/simplifyCore.md +50 -0
  170. package/docs/reference/functions/sin.md +6 -0
  171. package/docs/reference/functions/sinh.md +6 -0
  172. package/docs/reference/functions/size.md +6 -0
  173. package/docs/reference/functions/slu.md +6 -0
  174. package/docs/reference/functions/smaller.md +6 -0
  175. package/docs/reference/functions/smallerEq.md +6 -0
  176. package/docs/reference/functions/sort.md +6 -0
  177. package/docs/reference/functions/sqrt.md +6 -0
  178. package/docs/reference/functions/sqrtm.md +6 -0
  179. package/docs/reference/functions/square.md +6 -0
  180. package/docs/reference/functions/squeeze.md +6 -0
  181. package/docs/reference/functions/std.md +6 -0
  182. package/docs/reference/functions/stirlingS2.md +6 -0
  183. package/docs/reference/functions/subset.md +6 -0
  184. package/docs/reference/functions/subtract.md +6 -0
  185. package/docs/reference/functions/sum.md +6 -0
  186. package/docs/reference/functions/tan.md +6 -0
  187. package/docs/reference/functions/tanh.md +6 -0
  188. package/docs/reference/functions/to.md +6 -0
  189. package/docs/reference/functions/trace.md +6 -0
  190. package/docs/reference/functions/transpose.md +6 -0
  191. package/docs/reference/functions/typeOf.md +6 -0
  192. package/docs/reference/functions/unaryMinus.md +6 -0
  193. package/docs/reference/functions/unaryPlus.md +6 -0
  194. package/docs/reference/functions/unequal.md +6 -0
  195. package/docs/reference/functions/usolve.md +6 -0
  196. package/docs/reference/functions/usolveAll.md +6 -0
  197. package/docs/reference/functions/variance.md +6 -0
  198. package/docs/reference/functions/xgcd.md +6 -0
  199. package/docs/reference/functions/xor.md +6 -0
  200. package/docs/reference/functions/zeros.md +6 -0
  201. package/docs/reference/functions.md +3 -0
  202. package/lib/browser/math.js +6 -6
  203. package/lib/browser/math.js.map +1 -1
  204. package/lib/cjs/core/create.js +4 -4
  205. package/lib/cjs/core/function/import.js +3 -3
  206. package/lib/cjs/core/function/typed.js +2 -2
  207. package/lib/cjs/defaultInstance.js +3 -3
  208. package/lib/cjs/entry/allFactoriesAny.js +1 -1
  209. package/lib/cjs/entry/allFactoriesNumber.js +1 -1
  210. package/lib/cjs/entry/configReadonly.js +1 -1
  211. package/lib/cjs/entry/dependenciesAny/dependenciesLeafCount.generated.js +23 -0
  212. package/lib/cjs/entry/dependenciesAny/dependenciesRationalize.generated.js +3 -0
  213. package/lib/cjs/entry/dependenciesAny/dependenciesResolve.generated.js +32 -0
  214. package/lib/cjs/entry/dependenciesAny/dependenciesSimplify.generated.js +6 -0
  215. package/lib/cjs/entry/dependenciesAny/dependenciesSimplifyCore.generated.js +65 -0
  216. package/lib/cjs/entry/dependenciesAny.generated.js +24 -0
  217. package/lib/cjs/entry/dependenciesNumber/dependenciesRationalize.generated.js +3 -0
  218. package/lib/cjs/entry/dependenciesNumber/dependenciesResolve.generated.js +32 -0
  219. package/lib/cjs/entry/dependenciesNumber/dependenciesSimplify.generated.js +6 -0
  220. package/lib/cjs/entry/dependenciesNumber/dependenciesSimplifyCore.generated.js +65 -0
  221. package/lib/cjs/entry/dependenciesNumber.generated.js +16 -0
  222. package/lib/cjs/entry/impureFunctionsAny.generated.js +67 -29
  223. package/lib/cjs/entry/impureFunctionsNumber.generated.js +96 -64
  224. package/lib/cjs/entry/pureFunctionsAny.generated.js +53 -55
  225. package/lib/cjs/entry/pureFunctionsNumber.generated.js +46 -48
  226. package/lib/cjs/expression/Help.js +4 -0
  227. package/lib/cjs/expression/Parser.js +1 -1
  228. package/lib/cjs/expression/embeddedDocs/core/typed.js +1 -1
  229. package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +14 -5
  230. package/lib/cjs/expression/embeddedDocs/function/algebra/leafCount.js +15 -0
  231. package/lib/cjs/expression/embeddedDocs/function/algebra/resolve.js +16 -0
  232. package/lib/cjs/expression/embeddedDocs/function/algebra/simplify.js +1 -1
  233. package/lib/cjs/expression/embeddedDocs/function/algebra/simplifyCore.js +15 -0
  234. package/lib/cjs/expression/node/FunctionNode.js +7 -7
  235. package/lib/cjs/expression/node/IndexNode.js +1 -1
  236. package/lib/cjs/expression/node/Node.js +3 -3
  237. package/lib/cjs/expression/node/ObjectNode.js +1 -1
  238. package/lib/cjs/expression/node/utils/access.js +1 -1
  239. package/lib/cjs/expression/node/utils/assign.js +1 -1
  240. package/lib/cjs/expression/parse.js +13 -13
  241. package/lib/cjs/factoriesAny.js +24 -0
  242. package/lib/cjs/factoriesNumber.js +16 -0
  243. package/lib/cjs/function/algebra/decomposition/qr.js +1 -1
  244. package/lib/cjs/function/algebra/leafCount.js +66 -0
  245. package/lib/cjs/function/algebra/rationalize.js +24 -41
  246. package/lib/cjs/function/algebra/resolve.js +106 -0
  247. package/lib/cjs/function/algebra/simplify/simplifyConstant.js +5 -5
  248. package/lib/cjs/function/algebra/simplify/util.js +171 -33
  249. package/lib/cjs/function/algebra/simplify.js +554 -207
  250. package/lib/cjs/function/algebra/{simplify/simplifyCore.js → simplifyCore.js} +67 -43
  251. package/lib/cjs/function/algebra/solver/lsolveAll.js +2 -2
  252. package/lib/cjs/function/algebra/solver/usolveAll.js +2 -2
  253. package/lib/cjs/function/arithmetic/ceil.js +3 -3
  254. package/lib/cjs/function/arithmetic/floor.js +3 -3
  255. package/lib/cjs/function/arithmetic/invmod.js +1 -1
  256. package/lib/cjs/function/arithmetic/norm.js +1 -1
  257. package/lib/cjs/function/arithmetic/round.js +1 -1
  258. package/lib/cjs/function/matrix/eigs/complexEigs.js +5 -5
  259. package/lib/cjs/function/matrix/matrixFromColumns.js +1 -1
  260. package/lib/cjs/function/matrix/matrixFromRows.js +1 -1
  261. package/lib/cjs/function/probability/util/seededRNG.js +2 -2
  262. package/lib/cjs/function/relational/compareNatural.js +6 -6
  263. package/lib/cjs/header.js +2 -2
  264. package/lib/cjs/plain/bignumber/index.js +1 -1
  265. package/lib/cjs/plain/number/combinations.js +18 -6
  266. package/lib/cjs/type/bignumber/BigNumber.js +2 -2
  267. package/lib/cjs/type/bignumber/function/bignumber.js +1 -1
  268. package/lib/cjs/type/boolean.js +2 -2
  269. package/lib/cjs/type/complex/Complex.js +14 -14
  270. package/lib/cjs/type/complex/function/complex.js +1 -1
  271. package/lib/cjs/type/fraction/Fraction.js +6 -6
  272. package/lib/cjs/type/fraction/function/fraction.js +1 -1
  273. package/lib/cjs/type/matrix/DenseMatrix.js +5 -5
  274. package/lib/cjs/type/matrix/SparseMatrix.js +2 -2
  275. package/lib/cjs/type/number.js +1 -1
  276. package/lib/cjs/type/string.js +2 -2
  277. package/lib/cjs/type/unit/Unit.js +8 -8
  278. package/lib/cjs/utils/customs.js +2 -2
  279. package/lib/cjs/utils/emitter.js +1 -1
  280. package/lib/cjs/utils/function.js +2 -2
  281. package/lib/cjs/utils/is.js +6 -6
  282. package/lib/cjs/utils/latex.js +3 -3
  283. package/lib/cjs/utils/lruQueue.js +1 -1
  284. package/lib/cjs/utils/map.js +3 -3
  285. package/lib/cjs/utils/object.js +2 -2
  286. package/lib/cjs/utils/snapshot.js +7 -7
  287. package/lib/cjs/utils/string.js +2 -2
  288. package/lib/cjs/version.js +1 -1
  289. package/lib/esm/entry/dependenciesAny/dependenciesLeafCount.generated.js +12 -0
  290. package/lib/esm/entry/dependenciesAny/dependenciesRationalize.generated.js +2 -0
  291. package/lib/esm/entry/dependenciesAny/dependenciesResolve.generated.js +18 -0
  292. package/lib/esm/entry/dependenciesAny/dependenciesSimplify.generated.js +4 -0
  293. package/lib/esm/entry/dependenciesAny/dependenciesSimplifyCore.generated.js +40 -0
  294. package/lib/esm/entry/dependenciesAny.generated.js +3 -0
  295. package/lib/esm/entry/dependenciesNumber/dependenciesRationalize.generated.js +2 -0
  296. package/lib/esm/entry/dependenciesNumber/dependenciesResolve.generated.js +18 -0
  297. package/lib/esm/entry/dependenciesNumber/dependenciesSimplify.generated.js +4 -0
  298. package/lib/esm/entry/dependenciesNumber/dependenciesSimplifyCore.generated.js +40 -0
  299. package/lib/esm/entry/dependenciesNumber.generated.js +2 -0
  300. package/lib/esm/entry/impureFunctionsAny.generated.js +57 -22
  301. package/lib/esm/entry/impureFunctionsNumber.generated.js +83 -53
  302. package/lib/esm/entry/pureFunctionsAny.generated.js +42 -42
  303. package/lib/esm/entry/pureFunctionsNumber.generated.js +32 -32
  304. package/lib/esm/expression/Help.js +4 -0
  305. package/lib/esm/expression/embeddedDocs/core/typed.js +1 -1
  306. package/lib/esm/expression/embeddedDocs/embeddedDocs.js +6 -0
  307. package/lib/esm/expression/embeddedDocs/function/algebra/leafCount.js +8 -0
  308. package/lib/esm/expression/embeddedDocs/function/algebra/resolve.js +9 -0
  309. package/lib/esm/expression/embeddedDocs/function/algebra/simplify.js +1 -1
  310. package/lib/esm/expression/embeddedDocs/function/algebra/simplifyCore.js +8 -0
  311. package/lib/esm/factoriesAny.js +3 -0
  312. package/lib/esm/factoriesNumber.js +2 -0
  313. package/lib/esm/function/algebra/leafCount.js +59 -0
  314. package/lib/esm/function/algebra/rationalize.js +24 -40
  315. package/lib/esm/function/algebra/resolve.js +95 -0
  316. package/lib/esm/function/algebra/simplify/simplifyConstant.js +3 -3
  317. package/lib/esm/function/algebra/simplify/util.js +170 -34
  318. package/lib/esm/function/algebra/simplify.js +549 -202
  319. package/lib/esm/function/algebra/{simplify/simplifyCore.js → simplifyCore.js} +60 -44
  320. package/lib/esm/plain/number/combinations.js +18 -6
  321. package/lib/esm/version.js +1 -1
  322. package/package.json +15 -10
  323. package/types/index.d.ts +44 -2
  324. package/lib/cjs/function/algebra/simplify/resolve.js +0 -76
  325. package/lib/esm/function/algebra/simplify/resolve.js +0 -67
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { config } from './configReadonly.js';
6
6
  import { createBigNumberClass, createComplexClass, createE, createFalse, createFineStructure, createFractionClass, createI, createInfinity, createLN10, createLOG10E, createMatrixClass, createNaN, createNull, createPhi, createRangeClass, createResultSet, createSQRT1_2, // eslint-disable-line camelcase
7
- createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createUnaryPlus, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBignumber, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCosh, createCoth, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBin, createCombinationsWithRep, createCos, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createTanh, createUnaryMinus, createAcoth, createCot, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMod, createNthRoot, createNumeric, createOr, createProd, createReshape, createSize, createSmaller, createSqueeze, createSubset, createSubtract, createTo, createTranspose, createXgcd, createZeros, createAnd, createBitAnd, createBitXor, createCbrt, createCompare, createCompareText, createConcat, createCount, createCtranspose, createDiag, createDivideScalar, createDotDivide, createEqual, createFlatten, createGcd, createHasNumericValue, createHypot, createImmutableDenseMatrixClass, createIndexClass, createKron, createLargerEq, createLeftShift, createLsolve, createMatrixFromColumns, createMin, createMode, createNthRoots, createOnes, createPartitionSelect, createResize, createRightLogShift, createRound, createSmallerEq, createUnequal, createUsolve, createXor, createAdd, createAtan2, createBitOr, createCatalan, createCompareNatural, createDeepEqual, createDiff, createDot, createEqualText, createFloor, createIdentity, createInvmod, createLarger, createLog, createLsolveAll, createMatrixFromRows, createMultiply, createPow, createQr, createRange, createRightArithShift, createRow, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSlu, createSum, createTrace, createUsolveAll, createAsin, createCeil, createColumn, createComposition, createCross, createDistance, createDotMultiply, createFibonacciHeapClass, createFix, createGamma, createIndex, createLcm, createMax, createQuantileSeq, createSetDifference, createSetMultiplicity, createSetSymDifference, createSort, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCreateUnit, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createFactorial, createFermiCoupling, createGasConstant, createGravity, createIntersect, createInverseConductanceQuantum, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPermutations, createPlanckConstant, createPlanckMass, createPlanckTime, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSetIntersect, createSetUnion, createSpaClass, createStefanBoltzmann, createUnitFunction, createAvogadro, createBohrRadius, createCoulomb, createElectronMass, createFaraday, createHartreeEnergy, createLog1p, createMagneticFluxQuantum, createMolarMassC12, createPlanckCharge, createPlanckTemperature, createSecondRadiation, createSpeedOfLight, createStirlingS2, createBellNumbers, createFirstRadiation, createLup, createMolarVolume, createProtonMass, createSetSize, createThomsonCrossSection, createClassicalElectronRadius, createDet, createGravitationConstant, createInv, createLusolve, createSqrtm, createDivide, createExpm, createKldivergence, createMean, createMedian, createPlanckLength, createVariance, createStd, createEigs, createMultinomial, createMad, createNorm, createRotationMatrix, createRotate } from '../factoriesAny.js';
7
+ createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createUnaryPlus, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBignumber, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCosh, createCoth, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBin, createCombinationsWithRep, createCos, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createTanh, createUnaryMinus, createAcoth, createCot, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMod, createNthRoot, createNumeric, createOr, createProd, createReshape, createSize, createSmaller, createSqueeze, createSubset, createSubtract, createTo, createTranspose, createXgcd, createZeros, createAnd, createBitAnd, createBitXor, createCbrt, createCompare, createCompareText, createConcat, createCount, createCtranspose, createDiag, createDivideScalar, createDotDivide, createEqual, createFlatten, createGcd, createHasNumericValue, createHypot, createImmutableDenseMatrixClass, createIndexClass, createKron, createLargerEq, createLeftShift, createLsolve, createMatrixFromColumns, createMin, createMode, createNthRoots, createOnes, createPartitionSelect, createResize, createRightArithShift, createRound, createSmallerEq, createUnequal, createUsolve, createXor, createAdd, createAtan2, createBitOr, createCatalan, createCompareNatural, createDeepEqual, createDiff, createDot, createEqualText, createFloor, createIdentity, createInvmod, createLarger, createLog, createLsolveAll, createMatrixFromRows, createMultiply, createPow, createQr, createRange, createRightLogShift, createRow, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSlu, createSum, createTrace, createUsolveAll, createAsin, createCeil, createColumn, createComposition, createCross, createDistance, createDotMultiply, createFibonacciHeapClass, createFix, createGamma, createIndex, createLcm, createLog1p, createMax, createQuantileSeq, createSetDifference, createSetMultiplicity, createSetSymDifference, createSort, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCreateUnit, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createFactorial, createFermiCoupling, createGasConstant, createGravity, createIntersect, createInverseConductanceQuantum, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPermutations, createPlanckConstant, createPlanckMass, createPlanckTime, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSetIntersect, createSetUnion, createSpaClass, createStefanBoltzmann, createUnitFunction, createAvogadro, createBohrRadius, createCoulomb, createElectronMass, createFaraday, createHartreeEnergy, createLup, createMagneticFluxQuantum, createMolarMassC12, createPlanckCharge, createPlanckTemperature, createSecondRadiation, createSpeedOfLight, createStirlingS2, createBellNumbers, createDet, createFirstRadiation, createMolarVolume, createProtonMass, createSetSize, createThomsonCrossSection, createClassicalElectronRadius, createGravitationConstant, createInv, createLusolve, createSqrtm, createDivide, createExpm, createKldivergence, createMean, createMedian, createPlanckLength, createVariance, createEigs, createMad, createMultinomial, createStd, createNorm, createRotationMatrix, createRotate } from '../factoriesAny.js';
8
8
  export var BigNumber = /* #__PURE__ */createBigNumberClass({
9
9
  config
10
10
  });
@@ -645,7 +645,7 @@ export var resize = /* #__PURE__ */createResize({
645
645
  config,
646
646
  matrix
647
647
  });
648
- export var rightLogShift = /* #__PURE__ */createRightLogShift({
648
+ export var rightArithShift = /* #__PURE__ */createRightArithShift({
649
649
  DenseMatrix,
650
650
  equalScalar,
651
651
  matrix,
@@ -841,7 +841,7 @@ export var range = /* #__PURE__ */createRange({
841
841
  smallerEq,
842
842
  typed
843
843
  });
844
- export var rightArithShift = /* #__PURE__ */createRightArithShift({
844
+ export var rightLogShift = /* #__PURE__ */createRightLogShift({
845
845
  DenseMatrix,
846
846
  equalScalar,
847
847
  matrix,
@@ -993,6 +993,13 @@ export var lcm = /* #__PURE__ */createLcm({
993
993
  matrix,
994
994
  typed
995
995
  });
996
+ export var log1p = /* #__PURE__ */createLog1p({
997
+ Complex,
998
+ config,
999
+ divideScalar,
1000
+ log,
1001
+ typed
1002
+ });
996
1003
  export var max = /* #__PURE__ */createMax({
997
1004
  config,
998
1005
  larger,
@@ -1280,12 +1287,20 @@ export var hartreeEnergy = /* #__PURE__ */createHartreeEnergy({
1280
1287
  Unit,
1281
1288
  config
1282
1289
  });
1283
- export var log1p = /* #__PURE__ */createLog1p({
1284
- Complex,
1285
- config,
1290
+ export var lup = /* #__PURE__ */createLup({
1291
+ DenseMatrix,
1292
+ Spa,
1293
+ SparseMatrix,
1294
+ abs,
1295
+ addScalar,
1286
1296
  divideScalar,
1287
- log,
1288
- typed
1297
+ equalScalar,
1298
+ larger,
1299
+ matrix,
1300
+ multiplyScalar,
1301
+ subtract,
1302
+ typed,
1303
+ unaryMinus
1289
1304
  });
1290
1305
  export var magneticFluxQuantum = /* #__PURE__ */createMagneticFluxQuantum({
1291
1306
  BigNumber,
@@ -1337,26 +1352,19 @@ export var bellNumbers = /* #__PURE__ */createBellNumbers({
1337
1352
  stirlingS2,
1338
1353
  typed
1339
1354
  });
1340
- export var firstRadiation = /* #__PURE__ */createFirstRadiation({
1341
- BigNumber,
1342
- Unit,
1343
- config
1344
- });
1345
- export var lup = /* #__PURE__ */createLup({
1346
- DenseMatrix,
1347
- Spa,
1348
- SparseMatrix,
1349
- abs,
1350
- addScalar,
1351
- divideScalar,
1352
- equalScalar,
1353
- larger,
1355
+ export var det = /* #__PURE__ */createDet({
1356
+ lup,
1354
1357
  matrix,
1355
- multiplyScalar,
1358
+ multiply,
1356
1359
  subtract,
1357
1360
  typed,
1358
1361
  unaryMinus
1359
1362
  });
1363
+ export var firstRadiation = /* #__PURE__ */createFirstRadiation({
1364
+ BigNumber,
1365
+ Unit,
1366
+ config
1367
+ });
1360
1368
  export var molarVolume = /* #__PURE__ */createMolarVolume({
1361
1369
  BigNumber,
1362
1370
  Unit,
@@ -1381,14 +1389,6 @@ export var classicalElectronRadius = /* #__PURE__ */createClassicalElectronRadiu
1381
1389
  Unit,
1382
1390
  config
1383
1391
  });
1384
- export var det = /* #__PURE__ */createDet({
1385
- lup,
1386
- matrix,
1387
- multiply,
1388
- subtract,
1389
- typed,
1390
- unaryMinus
1391
- });
1392
1392
  export var gravitationConstant = /* #__PURE__ */createGravitationConstant({
1393
1393
  BigNumber,
1394
1394
  Unit,
@@ -1478,11 +1478,6 @@ export var variance = /* #__PURE__ */createVariance({
1478
1478
  subtract,
1479
1479
  typed
1480
1480
  });
1481
- export var std = /* #__PURE__ */createStd({
1482
- sqrt,
1483
- typed,
1484
- variance
1485
- });
1486
1481
  export var eigs = /* #__PURE__ */createEigs({
1487
1482
  abs,
1488
1483
  add,
@@ -1516,6 +1511,13 @@ export var eigs = /* #__PURE__ */createEigs({
1516
1511
  usolve,
1517
1512
  usolveAll
1518
1513
  });
1514
+ export var mad = /* #__PURE__ */createMad({
1515
+ abs,
1516
+ map,
1517
+ median,
1518
+ subtract,
1519
+ typed
1520
+ });
1519
1521
  export var multinomial = /* #__PURE__ */createMultinomial({
1520
1522
  add,
1521
1523
  divide,
@@ -1525,12 +1527,10 @@ export var multinomial = /* #__PURE__ */createMultinomial({
1525
1527
  multiply,
1526
1528
  typed
1527
1529
  });
1528
- export var mad = /* #__PURE__ */createMad({
1529
- abs,
1530
- map,
1531
- median,
1532
- subtract,
1533
- typed
1530
+ export var std = /* #__PURE__ */createStd({
1531
+ sqrt,
1532
+ typed,
1533
+ variance
1534
1534
  });
1535
1535
  export var norm = /* #__PURE__ */createNorm({
1536
1536
  abs,
@@ -3,8 +3,8 @@
3
3
  * DON'T MAKE CHANGES HERE
4
4
  */
5
5
  import { config } from './configReadonly.js';
6
- import { createE, createFalse, createIndex, createInfinity, createLN10, createLOG10E, createMatrix, createNaN, createNull, createPhi, createRangeClass, createReplacer, createSQRT1_2, // eslint-disable-line camelcase
7
- createSubset, createTau, createTyped, createUnaryPlus, createVersion, createXor, createAbs, createAcos, createAcot, createAcsc, createAdd, createAnd, createAsec, createAsin, createAtan, createAtanh, createBitAnd, createBitOr, createBoolean, createCbrt, createCombinations, createCompare, createCompareText, createCos, createCot, createCsc, createCube, createDivide, createEqualScalar, createErf, createExp, createFilter, createFix, createForEach, createFormat, createGamma, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLargerEq, createLeftShift, createLog10, createLog2, createMap, createMean, createMod, createMultiply, createNot, createNumber, createOr, createPi, createPow, createRandom, createRightArithShift, createRound, createSec, createSign, createSin, createSize, createSmallerEq, createSquare, createString, createSubtract, createTanh, createTypeOf, createUnequal, createXgcd, createAcoth, createAddScalar, createAsech, createBitNot, createCeil, createCombinationsWithRep, createCosh, createCsch, createDivideScalar, createEqualText, createExpm1, createIsNumeric, createLN2, createLcm, createLog1p, createMultiplyScalar, createNthRoot, createPickRandom, createRandomInt, createResultSet, createSQRT2, createSinh, createSqrt, createTan, createUnaryMinus, createAcosh, createApply, createAsinh, createBitXor, createCatalan, createCompareNatural, createEqual, createFactorial, createHasNumericValue, createIsNaN, createLarger, createMode, createNorm, createPartitionSelect, createPrint, createQuantileSeq, createRightLogShift, createSmaller, createStirlingS2, createTrue, createVariance, createAcsch, createAtan2, createComposition, createDeepEqual, createFloor, createHypot, createLog, createMedian, createMultinomial, createPermutations, createRange, createSech, createStd, createClone, createCoth, createGcd, createIsPrime, createNumeric, createProd, createBellNumbers, createMad, createSum, createMax, createMin } from '../factoriesNumber.js';
6
+ import { createE, createFalse, createIndex, createInfinity, createLN10, createLOG10E, createMatrix, createNaN, createNull, createPhi, createRangeClass, createReplacer, createResultSet, createSQRT1_2, // eslint-disable-line camelcase
7
+ createSubset, createTau, createTyped, createUnaryPlus, createVersion, createXor, createAbs, createAcos, createAcot, createAcsc, createAdd, createAnd, createAsec, createAsin, createAtan, createAtanh, createBitAnd, createBitOr, createBoolean, createCbrt, createCombinations, createCompare, createCompareText, createCos, createCot, createCsc, createCube, createDivide, createEqualScalar, createErf, createExp, createFilter, createFix, createForEach, createFormat, createGamma, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLargerEq, createLeftShift, createLog10, createLog2, createMap, createMean, createMod, createMultiply, createNot, createNumber, createOr, createPi, createPow, createRandom, createRightLogShift, createSQRT2, createSech, createSin, createSize, createSmallerEq, createSquare, createString, createSubtract, createTanh, createTypeOf, createUnequal, createXgcd, createAcoth, createAddScalar, createAsech, createBitNot, createCeil, createCombinationsWithRep, createCosh, createCsch, createDivideScalar, createEqualText, createExpm1, createIsNumeric, createLN2, createLcm, createLog1p, createMultiplyScalar, createNthRoot, createPickRandom, createRandomInt, createRightArithShift, createSec, createSinh, createSqrt, createTan, createUnaryMinus, createAcosh, createApply, createAsinh, createBitXor, createClone, createEqual, createFactorial, createHasNumericValue, createIsNaN, createLarger, createMode, createNorm, createPartitionSelect, createPrint, createQuantileSeq, createRound, createSmaller, createStirlingS2, createTrue, createVariance, createAcsch, createAtan2, createCatalan, createComposition, createDeepEqual, createFloor, createHypot, createLog, createMedian, createMultinomial, createPermutations, createRange, createSign, createStd, createCompareNatural, createCoth, createGcd, createIsPrime, createNumeric, createProd, createSum, createBellNumbers, createMad, createMax, createMin } from '../factoriesNumber.js';
8
8
  export var e = /* #__PURE__ */createE({
9
9
  config
10
10
  });
@@ -29,6 +29,7 @@ export var phi = /* #__PURE__ */createPhi({
29
29
  });
30
30
  export var Range = /* #__PURE__ */createRangeClass({});
31
31
  export var replacer = /* #__PURE__ */createReplacer({});
32
+ export var ResultSet = /* #__PURE__ */createResultSet({});
32
33
  export var SQRT1_2 = /* #__PURE__ */createSQRT1_2({
33
34
  config
34
35
  });
@@ -197,16 +198,13 @@ export var random = /* #__PURE__ */createRandom({
197
198
  config,
198
199
  typed
199
200
  });
200
- export var rightArithShift = /* #__PURE__ */createRightArithShift({
201
- typed
202
- });
203
- export var round = /* #__PURE__ */createRound({
201
+ export var rightLogShift = /* #__PURE__ */createRightLogShift({
204
202
  typed
205
203
  });
206
- export var sec = /* #__PURE__ */createSec({
207
- typed
204
+ export var SQRT2 = /* #__PURE__ */createSQRT2({
205
+ config
208
206
  });
209
- export var sign = /* #__PURE__ */createSign({
207
+ export var sech = /* #__PURE__ */createSech({
210
208
  typed
211
209
  });
212
210
  export var sin = /* #__PURE__ */createSin({
@@ -304,9 +302,11 @@ export var randomInt = /* #__PURE__ */createRandomInt({
304
302
  config,
305
303
  typed
306
304
  });
307
- export var ResultSet = /* #__PURE__ */createResultSet({});
308
- export var SQRT2 = /* #__PURE__ */createSQRT2({
309
- config
305
+ export var rightArithShift = /* #__PURE__ */createRightArithShift({
306
+ typed
307
+ });
308
+ export var sec = /* #__PURE__ */createSec({
309
+ typed
310
310
  });
311
311
  export var sinh = /* #__PURE__ */createSinh({
312
312
  typed
@@ -333,17 +333,7 @@ export var asinh = /* #__PURE__ */createAsinh({
333
333
  export var bitXor = /* #__PURE__ */createBitXor({
334
334
  typed
335
335
  });
336
- export var catalan = /* #__PURE__ */createCatalan({
337
- addScalar,
338
- combinations,
339
- divideScalar,
340
- isInteger,
341
- isNegative,
342
- multiplyScalar,
343
- typed
344
- });
345
- export var compareNatural = /* #__PURE__ */createCompareNatural({
346
- compare,
336
+ export var clone = /* #__PURE__ */createClone({
347
337
  typed
348
338
  });
349
339
  export var equal = /* #__PURE__ */createEqual({
@@ -389,7 +379,7 @@ export var quantileSeq = /* #__PURE__ */createQuantileSeq({
389
379
  partitionSelect,
390
380
  typed
391
381
  });
392
- export var rightLogShift = /* #__PURE__ */createRightLogShift({
382
+ export var round = /* #__PURE__ */createRound({
393
383
  typed
394
384
  });
395
385
  export var smaller = /* #__PURE__ */createSmaller({
@@ -425,6 +415,15 @@ export var acsch = /* #__PURE__ */createAcsch({
425
415
  export var atan2 = /* #__PURE__ */createAtan2({
426
416
  typed
427
417
  });
418
+ export var catalan = /* #__PURE__ */createCatalan({
419
+ addScalar,
420
+ combinations,
421
+ divideScalar,
422
+ isInteger,
423
+ isNegative,
424
+ multiplyScalar,
425
+ typed
426
+ });
428
427
  export var composition = /* #__PURE__ */createComposition({
429
428
  addScalar,
430
429
  combinations,
@@ -483,7 +482,7 @@ export var range = /* #__PURE__ */createRange({
483
482
  smallerEq,
484
483
  typed
485
484
  });
486
- export var sech = /* #__PURE__ */createSech({
485
+ export var sign = /* #__PURE__ */createSign({
487
486
  typed
488
487
  });
489
488
  export var std = /* #__PURE__ */createStd({
@@ -491,7 +490,8 @@ export var std = /* #__PURE__ */createStd({
491
490
  typed,
492
491
  variance
493
492
  });
494
- export var clone = /* #__PURE__ */createClone({
493
+ export var compareNatural = /* #__PURE__ */createCompareNatural({
494
+ compare,
495
495
  typed
496
496
  });
497
497
  export var coth = /* #__PURE__ */createCoth({
@@ -512,6 +512,12 @@ export var prod = /* #__PURE__ */createProd({
512
512
  numeric,
513
513
  typed
514
514
  });
515
+ export var sum = /* #__PURE__ */createSum({
516
+ add,
517
+ config,
518
+ numeric,
519
+ typed
520
+ });
515
521
  export var bellNumbers = /* #__PURE__ */createBellNumbers({
516
522
  addScalar,
517
523
  isInteger,
@@ -526,12 +532,6 @@ export var mad = /* #__PURE__ */createMad({
526
532
  subtract,
527
533
  typed
528
534
  });
529
- export var sum = /* #__PURE__ */createSum({
530
- add,
531
- config,
532
- numeric,
533
- typed
534
- });
535
535
  export var max = /* #__PURE__ */createMax({
536
536
  config,
537
537
  larger,
@@ -87,6 +87,10 @@ export var createHelpClass = /* #__PURE__ */factory(name, dependencies, _ref =>
87
87
  desc += '\n';
88
88
  }
89
89
 
90
+ if (doc.mayThrow && doc.mayThrow.length) {
91
+ desc += 'Throws: ' + doc.mayThrow.join(', ') + '\n\n';
92
+ }
93
+
90
94
  if (doc.seealso && doc.seealso.length) {
91
95
  desc += 'See also: ' + doc.seealso.join(', ') + '\n';
92
96
  }
@@ -3,6 +3,6 @@ export var typedDocs = {
3
3
  category: 'Core',
4
4
  syntax: ['typed(signatures)', 'typed(name, signatures)'],
5
5
  description: 'Create a typed function.',
6
- examples: ['double = typed({ "number, number": f(x)=x+x })', 'double(2)', 'double("hello")'],
6
+ examples: ['double = typed({ "number": f(x)=x+x })', 'double(2)', 'double("hello")'],
7
7
  seealso: []
8
8
  };
@@ -175,8 +175,11 @@ import { qrDocs } from './function/algebra/qr.js';
175
175
  import { usolveDocs } from './function/algebra/usolve.js';
176
176
  import { usolveAllDocs } from './function/algebra/usolveAll.js';
177
177
  import { sluDocs } from './function/algebra/slu.js';
178
+ import { leafCountDocs } from './function/algebra/leafCount.js';
178
179
  import { rationalizeDocs } from './function/algebra/rationalize.js';
179
180
  import { simplifyDocs } from './function/algebra/simplify.js';
181
+ import { simplifyCoreDocs } from './function/algebra/simplifyCore.js';
182
+ import { resolveDocs } from './function/algebra/resolve.js';
180
183
  import { lupDocs } from './function/algebra/lup.js';
181
184
  import { lsolveDocs } from './function/algebra/lsolve.js';
182
185
  import { lsolveAllDocs } from './function/algebra/lsolveAll.js';
@@ -466,7 +469,10 @@ export var embeddedDocs = {
466
469
  lsolveAll: lsolveAllDocs,
467
470
  lup: lupDocs,
468
471
  lusolve: lusolveDocs,
472
+ leafCount: leafCountDocs,
469
473
  simplify: simplifyDocs,
474
+ resolve: resolveDocs,
475
+ simplifyCore: simplifyCoreDocs,
470
476
  rationalize: rationalizeDocs,
471
477
  slu: sluDocs,
472
478
  usolve: usolveDocs,
@@ -0,0 +1,8 @@
1
+ export var leafCountDocs = {
2
+ name: 'leafCount',
3
+ category: 'Algebra',
4
+ syntax: ['leafCount(expr)'],
5
+ description: 'Computes the number of leaves in the parse tree of the given expression',
6
+ examples: ['leafCount("e^(i*pi)-1")', 'leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],
7
+ seealso: ['simplify']
8
+ };
@@ -0,0 +1,9 @@
1
+ export var resolveDocs = {
2
+ name: 'resolve',
3
+ category: 'Algebra',
4
+ syntax: ['resolve(node, scope)'],
5
+ description: 'Recursively substitute variables in an expression tree.',
6
+ examples: ['resolve(parse("1 + x"), { x: 7 })', 'resolve(parse("size(text)"), { text: "Hello World" })', 'resolve(parse("x + y"), { x: parse("3z") })', 'resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],
7
+ seealso: ['simplify', 'evaluate'],
8
+ mayThrow: ['ReferenceError']
9
+ };
@@ -4,5 +4,5 @@ export var simplifyDocs = {
4
4
  syntax: ['simplify(expr)', 'simplify(expr, rules)'],
5
5
  description: 'Simplify an expression tree.',
6
6
  examples: ['simplify("3 + 2 / 4")', 'simplify("2x + x")', 'f = parse("x * (x + 2 + x)")', 'simplified = simplify(f)', 'simplified.evaluate({x: 2})'],
7
- seealso: ['derivative', 'parse', 'evaluate']
7
+ seealso: ['simplifyCore', 'derivative', 'evaluate', 'parse', 'rationalize', 'resolve']
8
8
  };
@@ -0,0 +1,8 @@
1
+ export var simplifyCoreDocs = {
2
+ name: 'simplifyCore',
3
+ category: 'Algebra',
4
+ syntax: ['simplifyCore(node)'],
5
+ description: 'Perform simple one-pass simplifications on an expression tree.',
6
+ examples: ['simplifyCore(parse("0*x"))', 'simplifyCore(parse("(x+0)*2"))'],
7
+ seealso: ['simplify', 'evaluate']
8
+ };
@@ -241,7 +241,10 @@ export { createStirlingS2 } from './function/combinatorics/stirlingS2.js';
241
241
  export { createBellNumbers } from './function/combinatorics/bellNumbers.js';
242
242
  export { createCatalan } from './function/combinatorics/catalan.js';
243
243
  export { createComposition } from './function/combinatorics/composition.js';
244
+ export { createLeafCount } from './function/algebra/leafCount.js';
244
245
  export { createSimplify } from './function/algebra/simplify.js';
246
+ export { createSimplifyCore } from './function/algebra/simplifyCore.js';
247
+ export { createResolve } from './function/algebra/resolve.js';
245
248
  export { createDerivative } from './function/algebra/derivative.js';
246
249
  export { createRationalize } from './function/algebra/rationalize.js';
247
250
  export { createReviver } from './json/reviver.js';
@@ -13,7 +13,9 @@ export { createChainClass } from './type/chain/Chain.js';
13
13
  export { createHelp } from './expression/function/help.js';
14
14
  export { createChain } from './type/chain/function/chain.js'; // algebra
15
15
 
16
+ export { createResolve } from './function/algebra/resolve.js';
16
17
  export { createSimplify } from './function/algebra/simplify.js';
18
+ export { createSimplifyCore } from './function/algebra/simplifyCore.js';
17
19
  export { createDerivative } from './function/algebra/derivative.js';
18
20
  export { createRationalize } from './function/algebra/rationalize.js'; // arithmetic
19
21
 
@@ -0,0 +1,59 @@
1
+ import { factory } from '../../utils/factory.js';
2
+ var name = 'leafCount';
3
+ var dependencies = ['parse', 'typed'];
4
+ export var createLeafCount = /* #__PURE__ */factory(name, dependencies, _ref => {
5
+ var {
6
+ parse,
7
+ typed
8
+ } = _ref;
9
+
10
+ // This does the real work, but we don't have to recurse through
11
+ // a typed call if we separate it out
12
+ function countLeaves(node) {
13
+ var count = 0;
14
+ node.forEach(n => {
15
+ count += countLeaves(n);
16
+ });
17
+ return count || 1;
18
+ }
19
+ /**
20
+ * Gives the number of "leaf nodes" in the parse tree of the given expression
21
+ * A leaf node is one that has no subexpressions, essentially either a
22
+ * symbol or a constant. Note that `5!` has just one leaf, the '5'; the
23
+ * unary factorial operator does not add a leaf. On the other hand,
24
+ * function symbols do add leaves, so `sin(x)/cos(x)` has four leaves.
25
+ *
26
+ * The `simplify()` function should generally not increase the `leafCount()`
27
+ * of an expression, although currently there is no guarantee that it never
28
+ * does so. In many cases, `simplify()` reduces the leaf count.
29
+ *
30
+ * Syntax:
31
+ *
32
+ * leafCount(expr)
33
+ *
34
+ * Examples:
35
+ *
36
+ * math.leafCount('x') // 1
37
+ * math.leafCount(math.parse('a*d-b*c')) // 4
38
+ * math.leafCount('[a,b;c,d][0,1]') // 6
39
+ *
40
+ * See also:
41
+ *
42
+ * simplify
43
+ *
44
+ * @param {Node|string} expr The expression to count the leaves of
45
+ *
46
+ * @return {number} The number of leaves of `expr`
47
+ *
48
+ */
49
+
50
+
51
+ return typed(name, {
52
+ string: function string(expr) {
53
+ return this(parse(expr));
54
+ },
55
+ Node: function Node(expr) {
56
+ return countLeaves(expr);
57
+ }
58
+ });
59
+ });
@@ -1,9 +1,8 @@
1
1
  import { isInteger } from '../../utils/number.js';
2
2
  import { factory } from '../../utils/factory.js';
3
3
  import { createSimplifyConstant } from './simplify/simplifyConstant.js';
4
- import { createSimplifyCore } from './simplify/simplifyCore.js';
5
4
  var name = 'rationalize';
6
- var dependencies = ['config', 'typed', 'equal', 'isZero', 'add', 'subtract', 'multiply', 'divide', 'pow', 'parse', 'simplify', '?bignumber', '?fraction', 'mathWithTransform', 'matrix', 'AccessorNode', 'ArrayNode', 'ConstantNode', 'FunctionNode', 'IndexNode', 'ObjectNode', 'OperatorNode', 'SymbolNode', 'ParenthesisNode'];
5
+ var dependencies = ['config', 'typed', 'equal', 'isZero', 'add', 'subtract', 'multiply', 'divide', 'pow', 'parse', 'simplifyCore', 'simplify', '?bignumber', '?fraction', 'mathWithTransform', 'matrix', 'AccessorNode', 'ArrayNode', 'ConstantNode', 'FunctionNode', 'IndexNode', 'ObjectNode', 'OperatorNode', 'SymbolNode', 'ParenthesisNode'];
7
6
  export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref => {
8
7
  var {
9
8
  config,
@@ -16,6 +15,7 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
16
15
  divide,
17
16
  pow,
18
17
  parse,
18
+ simplifyCore,
19
19
  simplify,
20
20
  fraction,
21
21
  bignumber,
@@ -47,23 +47,6 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
47
47
  OperatorNode,
48
48
  SymbolNode
49
49
  });
50
- var simplifyCore = createSimplifyCore({
51
- equal,
52
- isZero,
53
- add,
54
- subtract,
55
- multiply,
56
- divide,
57
- pow,
58
- AccessorNode,
59
- ArrayNode,
60
- ConstantNode,
61
- FunctionNode,
62
- IndexNode,
63
- ObjectNode,
64
- OperatorNode,
65
- ParenthesisNode
66
- });
67
50
  /**
68
51
  * Transform a rationalizable expression in a rational fraction.
69
52
  * If rational fraction is one variable polynomial then converts
@@ -107,13 +90,13 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
107
90
  * @param {Object|boolean} optional scope of expression or true for already evaluated rational expression at input
108
91
  * @param {Boolean} detailed optional True if return an object, false if return expression node (default)
109
92
  *
110
- * @return {Object | Node} The rational polynomial of `expr` or na object
111
- * {Object}
112
- * {Expression Node} expression: node simplified expression
113
- * {Expression Node} numerator: simplified numerator of expression
114
- * {Expression Node | boolean} denominator: simplified denominator or false (if there is no denominator)
115
- * {Array} variables: variable names
116
- * {Array} coefficients: coefficients of numerator sorted by increased exponent
93
+ * @return {Object | Node} The rational polynomial of `expr` or an object
94
+ * `{expression, numerator, denominator, variables, coefficients}`, where
95
+ * `expression` is a `Node` with the node simplified expression,
96
+ * `numerator` is a `Node` with the simplified numerator of expression,
97
+ * `denominator` is a `Node` or `boolean` with the simplified denominator or `false` (if there is no denominator),
98
+ * `variables` is an array with variable names,
99
+ * and `coefficients` is an array with coefficients of numerator sorted by increased exponent
117
100
  * {Expression Node} node simplified expression
118
101
  *
119
102
  */
@@ -146,6 +129,12 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
146
129
  var polyRet = polynomial(expr, scope, true, setRules.firstRules); // Check if expression is a rationalizable polynomial
147
130
 
148
131
  var nVars = polyRet.variables.length;
132
+ var noExactFractions = {
133
+ exactFractions: false
134
+ };
135
+ var withExactFractions = {
136
+ exactFractions: true
137
+ };
149
138
  expr = polyRet.expression;
150
139
 
151
140
  if (nVars >= 1) {
@@ -156,18 +145,16 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
156
145
 
157
146
  var rules;
158
147
  var eDistrDiv = true;
159
- var redoInic = false;
160
- expr = simplify(expr, setRules.firstRules, {}, {
161
- exactFractions: false
162
- }); // Apply the initial rules, including succ div rules
148
+ var redoInic = false; // Apply the initial rules, including succ div rules:
163
149
 
150
+ expr = simplify(expr, setRules.firstRules, {}, noExactFractions);
164
151
  var s;
165
152
 
166
153
  while (true) {
167
- // Apply alternately successive division rules and distr.div.rules
154
+ // Alternate applying successive division rules and distr.div.rules
155
+ // until there are no more changes:
168
156
  rules = eDistrDiv ? setRules.distrDivRules : setRules.sucDivRules;
169
- expr = simplify(expr, rules); // until no more changes
170
-
157
+ expr = simplify(expr, rules, {}, withExactFractions);
171
158
  eDistrDiv = !eDistrDiv; // Swap between Distr.Div and Succ. Div. Rules
172
159
 
173
160
  s = expr.toString();
@@ -182,14 +169,11 @@ export var createRationalize = /* #__PURE__ */factory(name, dependencies, _ref =
182
169
 
183
170
  if (redoInic) {
184
171
  // Apply first rules again without succ div rules (if there are changes)
185
- expr = simplify(expr, setRules.firstRulesAgain, {}, {
186
- exactFractions: false
187
- });
188
- }
172
+ expr = simplify(expr, setRules.firstRulesAgain, {}, noExactFractions);
173
+ } // Apply final rules:
174
+
189
175
 
190
- expr = simplify(expr, setRules.finalRules, {}, {
191
- exactFractions: false
192
- }); // Apply final rules
176
+ expr = simplify(expr, setRules.finalRules, {}, noExactFractions);
193
177
  } // NVars >= 1
194
178
 
195
179