nerdamer 1.1.13 → 2.0.0-rc.2

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 (387) hide show
  1. package/BREAKING_CHANGES.md +244 -5
  2. package/LICENSE.md +184 -0
  3. package/README.md +232 -318
  4. package/dist/bundle.js +2 -0
  5. package/dist/bundle.js.LICENSE.txt +7 -0
  6. package/dist/parser.js +2 -0
  7. package/dist/parser.js.LICENSE.txt +7 -0
  8. package/docs-data/parser-functions.json +2248 -0
  9. package/index.d.ts +10 -426
  10. package/output/algebra/adapters.d.ts +3 -0
  11. package/output/algebra/adapters.js +11 -0
  12. package/output/algebra/algorithms/arith.d.ts +84 -0
  13. package/output/algebra/algorithms/arith.js +324 -0
  14. package/output/algebra/algorithms/groebnerBase.d.ts +161 -0
  15. package/output/algebra/algorithms/groebnerBase.js +929 -0
  16. package/output/algebra/dispatch.d.ts +1 -0
  17. package/output/algebra/dispatch.js +25 -0
  18. package/output/algebra/factor/factor.d.ts +77 -0
  19. package/output/algebra/factor/factor.js +245 -0
  20. package/output/algebra/gcd/gcd.d.ts +30 -0
  21. package/output/algebra/gcd/gcd.js +95 -0
  22. package/output/algebra/groebner.d.ts +21 -0
  23. package/output/algebra/groebner.js +36 -0
  24. package/output/algebra/partfrac.d.ts +19 -0
  25. package/output/algebra/partfrac.js +365 -0
  26. package/output/algebra/polynomial/ModularSparsePolynomial.d.ts +131 -0
  27. package/output/algebra/polynomial/ModularSparsePolynomial.js +378 -0
  28. package/output/algebra/polynomial/ModularSparsePolynomialFactor.d.ts +40 -0
  29. package/output/algebra/polynomial/ModularSparsePolynomialFactor.js +661 -0
  30. package/output/algebra/polynomial/SparsePolynomialFactor.d.ts +64 -0
  31. package/output/algebra/polynomial/SparsePolynomialFactor.js +492 -0
  32. package/output/algebra/polynomial/SparsePolynomialGcd.d.ts +29 -0
  33. package/output/algebra/polynomial/SparsePolynomialGcd.js +259 -0
  34. package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.d.ts +82 -0
  35. package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.js +604 -0
  36. package/output/algebra/polynomial/modularGcd.d.ts +40 -0
  37. package/output/algebra/polynomial/modularGcd.js +365 -0
  38. package/output/algebra/polynomialize.d.ts +20 -0
  39. package/output/algebra/polynomialize.js +26 -0
  40. package/output/algebra/simplify/complexsimp.d.ts +7 -0
  41. package/output/algebra/simplify/complexsimp.js +24 -0
  42. package/output/algebra/simplify/factorCommon.d.ts +13 -0
  43. package/output/algebra/simplify/factorCommon.js +136 -0
  44. package/output/algebra/simplify/funcsimp.d.ts +26 -0
  45. package/output/algebra/simplify/funcsimp.js +633 -0
  46. package/output/algebra/simplify/invtrigrewrite.d.ts +10 -0
  47. package/output/algebra/simplify/invtrigrewrite.js +96 -0
  48. package/output/algebra/simplify/ratsimp.d.ts +21 -0
  49. package/output/algebra/simplify/ratsimp.js +140 -0
  50. package/output/algebra/simplify/simplify.d.ts +25 -0
  51. package/output/algebra/simplify/simplify.js +237 -0
  52. package/output/algebra/simplify/trigreduce.d.ts +38 -0
  53. package/output/algebra/simplify/trigreduce.js +424 -0
  54. package/output/algebra/simplify/trigrewrite.d.ts +17 -0
  55. package/output/algebra/simplify/trigrewrite.js +156 -0
  56. package/output/algebra/simplify/trigsimp.d.ts +11 -0
  57. package/output/algebra/simplify/trigsimp.js +369 -0
  58. package/output/algebra/simplify/utils.d.ts +32 -0
  59. package/output/algebra/simplify/utils.js +56 -0
  60. package/output/algebra/utils.d.ts +32 -0
  61. package/output/algebra/utils.js +48 -0
  62. package/output/api/advanced.d.ts +8 -0
  63. package/output/api/advanced.js +18 -0
  64. package/output/api/algebra.d.ts +17 -0
  65. package/output/api/algebra.js +35 -0
  66. package/output/api/assumptions.d.ts +4 -0
  67. package/output/api/assumptions.js +11 -0
  68. package/output/api/calculus.d.ts +10 -0
  69. package/output/api/calculus.js +22 -0
  70. package/output/api/core.d.ts +17 -0
  71. package/output/api/core.js +41 -0
  72. package/output/api/debug.d.ts +16 -0
  73. package/output/api/debug.js +23 -0
  74. package/output/api/languages/deu.d.ts +3 -0
  75. package/output/api/languages/deu.js +266 -0
  76. package/output/api/languages/fra.d.ts +3 -0
  77. package/output/api/languages/fra.js +266 -0
  78. package/output/api/languages/ita.d.ts +3 -0
  79. package/output/api/languages/ita.js +266 -0
  80. package/output/api/languages/nld.d.ts +3 -0
  81. package/output/api/languages/nld.js +266 -0
  82. package/output/api/languages/por.d.ts +3 -0
  83. package/output/api/languages/por.js +266 -0
  84. package/output/api/languages/spa.d.ts +3 -0
  85. package/output/api/languages/spa.js +266 -0
  86. package/output/api/parser.d.ts +93 -0
  87. package/output/api/parser.js +18 -0
  88. package/output/api/solve.d.ts +10 -0
  89. package/output/api/solve.js +17 -0
  90. package/output/api/structures.d.ts +10 -0
  91. package/output/api/structures.js +23 -0
  92. package/output/calculus/adapters.d.ts +8 -0
  93. package/output/calculus/adapters.js +41 -0
  94. package/output/calculus/derivative/diff.d.ts +30 -0
  95. package/output/calculus/derivative/diff.js +241 -0
  96. package/output/calculus/dispatch.d.ts +1 -0
  97. package/output/calculus/dispatch.js +25 -0
  98. package/output/calculus/fresnel.d.ts +16 -0
  99. package/output/calculus/fresnel.js +39 -0
  100. package/output/calculus/integrate/byParts.d.ts +18 -0
  101. package/output/calculus/integrate/byParts.js +339 -0
  102. package/output/calculus/integrate/bySubstitution.d.ts +135 -0
  103. package/output/calculus/integrate/bySubstitution.js +411 -0
  104. package/output/calculus/integrate/integrate.d.ts +38 -0
  105. package/output/calculus/integrate/integrate.js +652 -0
  106. package/output/calculus/integrate/integrationTable.d.ts +2 -0
  107. package/output/calculus/integrate/integrationTable.js +914 -0
  108. package/output/calculus/integrate/utils.d.ts +28 -0
  109. package/output/calculus/integrate/utils.js +96 -0
  110. package/output/calculus/laplace/ilaplace.d.ts +31 -0
  111. package/output/calculus/laplace/ilaplace.js +192 -0
  112. package/output/calculus/laplace/ilaplaceTable.d.ts +2 -0
  113. package/output/calculus/laplace/ilaplaceTable.js +200 -0
  114. package/output/calculus/laplace/laplace.d.ts +22 -0
  115. package/output/calculus/laplace/laplace.js +109 -0
  116. package/output/calculus/laplace/laplaceTable.d.ts +2 -0
  117. package/output/calculus/laplace/laplaceTable.js +187 -0
  118. package/output/calculus/limit/limit.d.ts +35 -0
  119. package/output/calculus/limit/limit.js +1183 -0
  120. package/output/calculus/limit/limitsTable.d.ts +2 -0
  121. package/output/calculus/limit/limitsTable.js +7 -0
  122. package/output/core/Settings.d.ts +32 -0
  123. package/output/core/Settings.js +68 -0
  124. package/output/core/classes/assumption/Assumption.d.ts +218 -0
  125. package/output/core/classes/assumption/Assumption.js +609 -0
  126. package/output/core/classes/assumption/assertiveFunctions.d.ts +6 -0
  127. package/output/core/classes/assumption/assertiveFunctions.js +64 -0
  128. package/output/core/classes/assumption/assume.d.ts +90 -0
  129. package/output/core/classes/assumption/assume.js +145 -0
  130. package/output/core/classes/assumption/dispatch.d.ts +1 -0
  131. package/output/core/classes/assumption/dispatch.js +11 -0
  132. package/output/core/classes/collection/Collection.d.ts +107 -0
  133. package/output/core/classes/collection/Collection.js +240 -0
  134. package/output/core/classes/complex/Complex.d.ts +109 -0
  135. package/output/core/classes/complex/Complex.js +153 -0
  136. package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
  137. package/output/core/classes/decimalSet/DecimalSet.js +454 -0
  138. package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
  139. package/output/core/classes/dictionary/Dictionary.js +216 -0
  140. package/output/core/classes/equation/Equation.d.ts +256 -0
  141. package/output/core/classes/equation/Equation.js +350 -0
  142. package/output/core/classes/expression/CoeffObject.d.ts +100 -0
  143. package/output/core/classes/expression/CoeffObject.js +197 -0
  144. package/output/core/classes/expression/Expression.d.ts +1691 -0
  145. package/output/core/classes/expression/Expression.js +2381 -0
  146. package/output/core/classes/expression/analysis.d.ts +25 -0
  147. package/output/core/classes/expression/analysis.js +218 -0
  148. package/output/core/classes/expression/collect.d.ts +9 -0
  149. package/output/core/classes/expression/collect.js +49 -0
  150. package/output/core/classes/expression/format.d.ts +54 -0
  151. package/output/core/classes/expression/format.js +340 -0
  152. package/output/core/classes/expression/products.d.ts +23 -0
  153. package/output/core/classes/expression/products.js +115 -0
  154. package/output/core/classes/expression/shortcuts.d.ts +35 -0
  155. package/output/core/classes/expression/shortcuts.js +129 -0
  156. package/output/core/classes/expression/traversal.d.ts +31 -0
  157. package/output/core/classes/expression/traversal.js +216 -0
  158. package/output/core/classes/expression/trig.d.ts +25 -0
  159. package/output/core/classes/expression/trig.js +40 -0
  160. package/output/core/classes/expression/utils.d.ts +61 -0
  161. package/output/core/classes/expression/utils.js +235 -0
  162. package/output/core/classes/lookupTable/LookupTable.d.ts +12 -0
  163. package/output/core/classes/lookupTable/LookupTable.js +55 -0
  164. package/output/core/classes/matrix/Matrix.d.ts +227 -0
  165. package/output/core/classes/matrix/Matrix.js +901 -0
  166. package/output/core/classes/matrix/Sylvester.d.ts +11 -0
  167. package/output/core/classes/matrix/Sylvester.js +54 -0
  168. package/output/core/classes/matrix/dispatch.d.ts +1 -0
  169. package/output/core/classes/matrix/dispatch.js +19 -0
  170. package/output/core/classes/matrix/functions.d.ts +28 -0
  171. package/output/core/classes/matrix/functions.js +57 -0
  172. package/output/core/classes/matrix/utils.d.ts +9 -0
  173. package/output/core/classes/matrix/utils.js +22 -0
  174. package/output/core/classes/parser/Parser.d.ts +493 -0
  175. package/output/core/classes/parser/Parser.js +1863 -0
  176. package/output/core/classes/parser/Token.d.ts +58 -0
  177. package/output/core/classes/parser/Token.js +137 -0
  178. package/output/core/classes/parser/constants.d.ts +162 -0
  179. package/output/core/classes/parser/constants.js +229 -0
  180. package/output/core/classes/parser/controlFlowSignals.d.ts +38 -0
  181. package/output/core/classes/parser/controlFlowSignals.js +60 -0
  182. package/output/core/classes/parser/helpers.d.ts +21 -0
  183. package/output/core/classes/parser/helpers.js +42 -0
  184. package/output/core/classes/parser/operations/add.d.ts +15 -0
  185. package/output/core/classes/parser/operations/add.js +236 -0
  186. package/output/core/classes/parser/operations/comma.d.ts +7 -0
  187. package/output/core/classes/parser/operations/comma.js +11 -0
  188. package/output/core/classes/parser/operations/compare.d.ts +21 -0
  189. package/output/core/classes/parser/operations/compare.js +474 -0
  190. package/output/core/classes/parser/operations/divide.d.ts +2 -0
  191. package/output/core/classes/parser/operations/divide.js +72 -0
  192. package/output/core/classes/parser/operations/functions.d.ts +46 -0
  193. package/output/core/classes/parser/operations/functions.js +438 -0
  194. package/output/core/classes/parser/operations/multiply.d.ts +11 -0
  195. package/output/core/classes/parser/operations/multiply.js +328 -0
  196. package/output/core/classes/parser/operations/power.d.ts +48 -0
  197. package/output/core/classes/parser/operations/power.js +673 -0
  198. package/output/core/classes/parser/operations/subtract.d.ts +3 -0
  199. package/output/core/classes/parser/operations/subtract.js +36 -0
  200. package/output/core/classes/parser/preprocess.d.ts +7 -0
  201. package/output/core/classes/parser/preprocess.js +246 -0
  202. package/output/core/classes/parser/scripting/controlFlow.d.ts +23 -0
  203. package/output/core/classes/parser/scripting/controlFlow.js +279 -0
  204. package/output/core/classes/parser/scripting/deferred.d.ts +4 -0
  205. package/output/core/classes/parser/scripting/deferred.js +65 -0
  206. package/output/core/classes/parser/scripting/dispatch.d.ts +1 -0
  207. package/output/core/classes/parser/scripting/dispatch.js +62 -0
  208. package/output/core/classes/parser/scripting/evaluate.d.ts +23 -0
  209. package/output/core/classes/parser/scripting/evaluate.js +128 -0
  210. package/output/core/classes/parser/scripting/functions.d.ts +14 -0
  211. package/output/core/classes/parser/scripting/functions.js +59 -0
  212. package/output/core/classes/parser/scripting/scope.d.ts +8 -0
  213. package/output/core/classes/parser/scripting/scope.js +132 -0
  214. package/output/core/classes/parser/types.d.ts +130 -0
  215. package/output/core/classes/parser/types.js +2 -0
  216. package/output/core/classes/parser/wrappers/IndexedReference.d.ts +31 -0
  217. package/output/core/classes/parser/wrappers/IndexedReference.js +68 -0
  218. package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +24 -0
  219. package/output/core/classes/parser/wrappers/KeyValuePair.js +51 -0
  220. package/output/core/classes/polynomial/Polynomial.d.ts +504 -0
  221. package/output/core/classes/polynomial/Polynomial.js +1195 -0
  222. package/output/core/classes/polynomial/SparsePolynomial.d.ts +221 -0
  223. package/output/core/classes/polynomial/SparsePolynomial.js +824 -0
  224. package/output/core/classes/polynomial/SparsePolynomialAdapter.d.ts +56 -0
  225. package/output/core/classes/polynomial/SparsePolynomialAdapter.js +241 -0
  226. package/output/core/classes/polynomial/Term.d.ts +222 -0
  227. package/output/core/classes/polynomial/Term.js +430 -0
  228. package/output/core/classes/polynomial/adapters.d.ts +18 -0
  229. package/output/core/classes/polynomial/adapters.js +33 -0
  230. package/output/core/classes/polynomial/dispatch.d.ts +1 -0
  231. package/output/core/classes/polynomial/dispatch.js +14 -0
  232. package/output/core/classes/polynomial/functions.d.ts +77 -0
  233. package/output/core/classes/polynomial/functions.js +189 -0
  234. package/output/core/classes/polynomial/utils.d.ts +62 -0
  235. package/output/core/classes/polynomial/utils.js +207 -0
  236. package/output/core/classes/rational/Rational.d.ts +501 -0
  237. package/output/core/classes/rational/Rational.js +829 -0
  238. package/output/core/classes/seq/SEQ.d.ts +13 -0
  239. package/output/core/classes/seq/SEQ.js +137 -0
  240. package/output/core/classes/valuesSet/ValuesSet.d.ts +187 -0
  241. package/output/core/classes/valuesSet/ValuesSet.js +399 -0
  242. package/output/core/classes/vector/Vector.d.ts +222 -0
  243. package/output/core/classes/vector/Vector.js +501 -0
  244. package/output/core/classes/vector/dispatch.d.ts +1 -0
  245. package/output/core/classes/vector/dispatch.js +11 -0
  246. package/output/core/classes/vector/functions.d.ts +28 -0
  247. package/output/core/classes/vector/functions.js +47 -0
  248. package/output/core/common/classes/MathematicalAggregate.d.ts +53 -0
  249. package/output/core/common/classes/MathematicalAggregate.js +149 -0
  250. package/output/core/common/classes/Scope.d.ts +62 -0
  251. package/output/core/common/classes/Scope.js +122 -0
  252. package/output/core/common/classes/StructuredEntity.d.ts +55 -0
  253. package/output/core/common/classes/StructuredEntity.js +151 -0
  254. package/output/core/common/common.d.ts +62 -0
  255. package/output/core/common/common.js +74 -0
  256. package/output/core/common/functions/functions.d.ts +14 -0
  257. package/output/core/common/functions/functions.js +33 -0
  258. package/output/core/common/functions/structuredEntityUtils.d.ts +27 -0
  259. package/output/core/common/functions/structuredEntityUtils.js +40 -0
  260. package/output/core/converters/BaseConverter.d.ts +97 -0
  261. package/output/core/converters/BaseConverter.js +405 -0
  262. package/output/core/converters/Converter.d.ts +111 -0
  263. package/output/core/converters/Converter.js +806 -0
  264. package/output/core/converters/Pattern.d.ts +71 -0
  265. package/output/core/converters/Pattern.js +302 -0
  266. package/output/core/dispatch.d.ts +52 -0
  267. package/output/core/dispatch.js +26 -0
  268. package/output/core/errors.d.ts +316 -0
  269. package/output/core/errors.js +349 -0
  270. package/output/core/fullFunctions.d.ts +7 -0
  271. package/output/core/fullFunctions.js +31 -0
  272. package/output/core/functions/bigint/bigint.d.ts +133 -0
  273. package/output/core/functions/bigint/bigint.js +444 -0
  274. package/output/core/functions/bigint/primeFactor.d.ts +51 -0
  275. package/output/core/functions/bigint/primeFactor.js +267 -0
  276. package/output/core/functions/bigint/primes.d.ts +1 -0
  277. package/output/core/functions/bigint/primes.js +11 -0
  278. package/output/core/functions/build/definitions.d.ts +12 -0
  279. package/output/core/functions/build/definitions.js +139 -0
  280. package/output/core/functions/build/index.d.ts +32 -0
  281. package/output/core/functions/build/index.js +136 -0
  282. package/output/core/functions/complex.d.ts +90 -0
  283. package/output/core/functions/complex.dispatch.d.ts +1 -0
  284. package/output/core/functions/complex.dispatch.js +16 -0
  285. package/output/core/functions/complex.js +482 -0
  286. package/output/core/functions/decimal.d.ts +24 -0
  287. package/output/core/functions/decimal.js +665 -0
  288. package/output/core/functions/expand/expand.d.ts +42 -0
  289. package/output/core/functions/expand/expand.js +376 -0
  290. package/output/core/functions/fresnelNumeric.d.ts +12 -0
  291. package/output/core/functions/fresnelNumeric.js +123 -0
  292. package/output/core/functions/numeric.d.ts +140 -0
  293. package/output/core/functions/numeric.js +790 -0
  294. package/output/core/functions/rationalNormalization.d.ts +11 -0
  295. package/output/core/functions/rationalNormalization.js +117 -0
  296. package/output/core/functions/setFunction.d.ts +19 -0
  297. package/output/core/functions/setFunction.js +75 -0
  298. package/output/core/functions/string.d.ts +26 -0
  299. package/output/core/functions/string.js +102 -0
  300. package/output/core/functions/subst.d.ts +90 -0
  301. package/output/core/functions/subst.js +506 -0
  302. package/output/core/functions/utils.d.ts +24 -0
  303. package/output/core/functions/utils.js +51 -0
  304. package/output/core/parserFunctions.d.ts +7 -0
  305. package/output/core/parserFunctions.js +25 -0
  306. package/output/core/types.d.ts +48 -0
  307. package/output/core/types.js +2 -0
  308. package/output/index.d.ts +359 -0
  309. package/output/index.js +739 -0
  310. package/output/math/defint/defint.d.ts +18 -0
  311. package/output/math/defint/defint.js +60 -0
  312. package/output/math/defint/defintDecimal.d.ts +37 -0
  313. package/output/math/defint/defintDecimal.js +321 -0
  314. package/output/math/defint/defintNative.d.ts +57 -0
  315. package/output/math/defint/defintNative.js +281 -0
  316. package/output/math/dispatch.d.ts +1 -0
  317. package/output/math/dispatch.js +101 -0
  318. package/output/math/geometry.d.ts +12 -0
  319. package/output/math/geometry.js +55 -0
  320. package/output/math/math.d.ts +695 -0
  321. package/output/math/math.js +1955 -0
  322. package/output/math/trig.d.ts +518 -0
  323. package/output/math/trig.js +1444 -0
  324. package/output/math/trunc.d.ts +19 -0
  325. package/output/math/trunc.js +36 -0
  326. package/output/math/utils.d.ts +66 -0
  327. package/output/math/utils.js +219 -0
  328. package/output/solve/classes/DecimalMatrix.d.ts +17 -0
  329. package/output/solve/classes/DecimalMatrix.js +86 -0
  330. package/output/solve/classes/FunctionSolver.d.ts +135 -0
  331. package/output/solve/classes/FunctionSolver.js +433 -0
  332. package/output/solve/classes/MultivariateSolver.d.ts +84 -0
  333. package/output/solve/classes/MultivariateSolver.js +240 -0
  334. package/output/solve/classes/PolynomialSolver.d.ts +104 -0
  335. package/output/solve/classes/PolynomialSolver.js +492 -0
  336. package/output/solve/classes/SolutionSet.d.ts +172 -0
  337. package/output/solve/classes/SolutionSet.js +434 -0
  338. package/output/solve/classes/Solver.d.ts +17 -0
  339. package/output/solve/classes/Solver.js +132 -0
  340. package/output/solve/classes/SymbolicSolver.d.ts +74 -0
  341. package/output/solve/classes/SymbolicSolver.js +601 -0
  342. package/output/solve/dispatch.d.ts +1 -0
  343. package/output/solve/dispatch.js +13 -0
  344. package/output/solve/linsolve.d.ts +53 -0
  345. package/output/solve/linsolve.js +233 -0
  346. package/output/solve/solve.d.ts +44 -0
  347. package/output/solve/solve.js +368 -0
  348. package/output/solve/solveSystem.d.ts +31 -0
  349. package/output/solve/solveSystem.js +266 -0
  350. package/output/solve/utils.d.ts +10 -0
  351. package/output/solve/utils.js +58 -0
  352. package/output/utils/array.d.ts +42 -0
  353. package/output/utils/array.js +98 -0
  354. package/output/utils/debug.d.ts +131 -0
  355. package/output/utils/debug.js +296 -0
  356. package/output/utils/decimal.d.ts +3 -0
  357. package/output/utils/decimal.js +16 -0
  358. package/output/utils/numeric.d.ts +14 -0
  359. package/output/utils/numeric.js +51 -0
  360. package/output/utils/object.d.ts +26 -0
  361. package/output/utils/object.js +56 -0
  362. package/package.json +178 -57
  363. package/.travis.yml +0 -3
  364. package/Algebra.js +0 -4568
  365. package/CODE_OF_CONDUCT.md +0 -46
  366. package/CONTRIBUTING.md +0 -14
  367. package/Calculus.js +0 -2675
  368. package/Extra.js +0 -622
  369. package/Solve.js +0 -1783
  370. package/all.js +0 -16
  371. package/all.min.js +0 -1
  372. package/gulpfile.js +0 -16
  373. package/index.html +0 -158
  374. package/license.txt +0 -19
  375. package/nerdamer.core.js +0 -12510
  376. package/spec/LaTeX.spec.js +0 -302
  377. package/spec/TeXConvert.spec.js +0 -8
  378. package/spec/algebra.spec.js +0 -287
  379. package/spec/basic_parser.spec.js +0 -134
  380. package/spec/build.spec.js +0 -131
  381. package/spec/calculus.spec.js +0 -183
  382. package/spec/core.spec.js +0 -2970
  383. package/spec/extra.spec.js +0 -54
  384. package/spec/solve.spec.js +0 -126
  385. package/spec/support/jasmine.json +0 -11
  386. package/spec/support/utils.js +0 -42
  387. package/spec/text.spec.js +0 -132
@@ -0,0 +1,454 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DecimalSet = void 0;
7
+ const decimal_js_1 = __importDefault(require("decimal.js"));
8
+ const errors_1 = require("../../errors");
9
+ /**
10
+ * A high-performance set implementation for Decimal.js numbers.
11
+ *
12
+ * This class provides a complete set of operations for working with sets of
13
+ * arbitrary-precision decimal numbers. It uses string representation internally
14
+ * for efficient equality comparison and hashing.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const setA = new DecimalSet([1, 2, 3]);
19
+ * const setB = new DecimalSet([2, 3, 4]);
20
+ * const union = setA.union(setB); // {1, 2, 3, 4}
21
+ * const intersection = setA.intersection(setB); // {2, 3}
22
+ * ```
23
+ */
24
+ class DecimalSet {
25
+ elements;
26
+ /**
27
+ * Creates a new DecimalSet.
28
+ *
29
+ * @param values - Optional array of values to initialize the set
30
+ */
31
+ constructor(values) {
32
+ this.elements = new Map();
33
+ if (values) {
34
+ for (const value of values) {
35
+ this.add(value);
36
+ }
37
+ }
38
+ }
39
+ /**
40
+ * Creates a DecimalSet from an array of values.
41
+ *
42
+ * @param values - Array of values
43
+ * @returns A new DecimalSet
44
+ */
45
+ static from(values) {
46
+ return new DecimalSet(values);
47
+ }
48
+ /**
49
+ * Creates a DecimalSet from a range of values.
50
+ *
51
+ * @param start - Start value (inclusive)
52
+ * @param end - End value (exclusive)
53
+ * @param step - Step size (default 1)
54
+ * @returns A new DecimalSet
55
+ * @throws If a bound or step is non-finite, the step is zero, or the configured
56
+ * Decimal precision is too low for the step to advance the current value.
57
+ */
58
+ static range(start, end, step = 1) {
59
+ const result = new DecimalSet();
60
+ const startDec = new decimal_js_1.default(start);
61
+ const endDec = new decimal_js_1.default(end);
62
+ const stepDec = new decimal_js_1.default(step);
63
+ if (!startDec.isFinite() || !endDec.isFinite() || !stepDec.isFinite()) {
64
+ throw new Error((0, errors_1.message)('rangeValuesFinite'));
65
+ }
66
+ if (stepDec.isZero()) {
67
+ throw new Error((0, errors_1.message)('rangeStepNonzero'));
68
+ }
69
+ if (stepDec.isPositive()) {
70
+ let current = startDec;
71
+ while (current.lessThan(endDec)) {
72
+ result.add(current);
73
+ const next = current.plus(stepDec);
74
+ if (next.equals(current)) {
75
+ throw new Error((0, errors_1.message)('rangeStepNoAdvance'));
76
+ }
77
+ current = next;
78
+ }
79
+ }
80
+ else {
81
+ let current = startDec;
82
+ while (current.greaterThan(endDec)) {
83
+ result.add(current);
84
+ const next = current.plus(stepDec);
85
+ if (next.equals(current)) {
86
+ throw new Error((0, errors_1.message)('rangeStepNoAdvance'));
87
+ }
88
+ current = next;
89
+ }
90
+ }
91
+ return result;
92
+ }
93
+ /**
94
+ * Adds a value to the set.
95
+ *
96
+ * @param value - The value to add
97
+ * @returns The set instance for chaining
98
+ */
99
+ add(value) {
100
+ const decimal = new decimal_js_1.default(value);
101
+ const key = decimal.toString();
102
+ this.elements.set(key, decimal);
103
+ return this;
104
+ }
105
+ /**
106
+ * Removes all elements from the set.
107
+ */
108
+ clear() {
109
+ this.elements.clear();
110
+ }
111
+ /**
112
+ * Creates a shallow copy of the set.
113
+ */
114
+ clone() {
115
+ const result = new DecimalSet();
116
+ for (const [key, value] of this.elements) {
117
+ result.elements.set(key, value);
118
+ }
119
+ return result;
120
+ }
121
+ /**
122
+ * Removes a value from the set.
123
+ *
124
+ * @param value - The value to remove
125
+ * @returns True if the value was present and removed, false otherwise
126
+ */
127
+ delete(value) {
128
+ const key = new decimal_js_1.default(value).toString();
129
+ return this.elements.delete(key);
130
+ }
131
+ /**
132
+ * Creates a new set containing the difference (this \ other).
133
+ *
134
+ * @param other - The other set
135
+ * @returns A new set containing elements in this set but not in the other
136
+ */
137
+ difference(other) {
138
+ const result = new DecimalSet();
139
+ for (const [key, value] of this.elements) {
140
+ if (!other.elements.has(key)) {
141
+ result.elements.set(key, value);
142
+ }
143
+ }
144
+ return result;
145
+ }
146
+ /**
147
+ * Checks if this set equals another set.
148
+ *
149
+ * @param other - The other set
150
+ * @returns True if both sets contain the same elements
151
+ */
152
+ equals(other) {
153
+ if (this.size !== other.size) {
154
+ return false;
155
+ }
156
+ for (const key of this.elements.keys()) {
157
+ if (!other.elements.has(key)) {
158
+ return false;
159
+ }
160
+ }
161
+ return true;
162
+ }
163
+ /**
164
+ * Tests whether all elements pass the predicate test.
165
+ *
166
+ * @param predicate - Function to test each element
167
+ * @returns True if all elements pass the test
168
+ */
169
+ every(predicate) {
170
+ for (const value of this.elements.values()) {
171
+ if (!predicate(value)) {
172
+ return false;
173
+ }
174
+ }
175
+ return true;
176
+ }
177
+ /**
178
+ * Filters the set based on a predicate function.
179
+ *
180
+ * @param predicate - Function to test each element
181
+ * @returns A new set containing only elements that pass the test
182
+ */
183
+ filter(predicate) {
184
+ const result = new DecimalSet();
185
+ for (const [key, value] of this.elements) {
186
+ if (predicate(value)) {
187
+ result.elements.set(key, value);
188
+ }
189
+ }
190
+ return result;
191
+ }
192
+ /**
193
+ * Executes a callback for each element in the set.
194
+ *
195
+ * @param callback - Function to execute for each element
196
+ * @param thisArg - Value to use as 'this' when executing callback
197
+ */
198
+ forEach(callback, thisArg) {
199
+ for (const value of this.elements.values()) {
200
+ callback.call(thisArg, value, value, this);
201
+ }
202
+ }
203
+ /**
204
+ * Checks if a value is in the set.
205
+ *
206
+ * @param value - The value to check
207
+ * @returns True if the value is in the set
208
+ */
209
+ has(value) {
210
+ const key = new decimal_js_1.default(value).toString();
211
+ return this.elements.has(key);
212
+ }
213
+ /**
214
+ * Creates a new set containing the intersection of this set and another.
215
+ *
216
+ * @param other - The other set
217
+ * @returns A new set containing only elements present in both sets
218
+ */
219
+ intersection(other) {
220
+ const result = new DecimalSet();
221
+ // Iterate over the smaller set for better performance
222
+ const [smaller, larger] = this.size <= other.size ? [this, other] : [other, this];
223
+ for (const [key, value] of smaller.elements) {
224
+ if (larger.elements.has(key)) {
225
+ result.elements.set(key, value);
226
+ }
227
+ }
228
+ return result;
229
+ }
230
+ /**
231
+ * Checks if this set is disjoint with another set.
232
+ *
233
+ * @param other - The other set
234
+ * @returns True if the sets have no elements in common
235
+ */
236
+ isDisjointFrom(other) {
237
+ // Iterate over the smaller set for better performance
238
+ const [smaller, larger] = this.size <= other.size ? [this, other] : [other, this];
239
+ for (const key of smaller.elements.keys()) {
240
+ if (larger.elements.has(key)) {
241
+ return false;
242
+ }
243
+ }
244
+ return true;
245
+ }
246
+ /**
247
+ * Checks if the set is empty.
248
+ */
249
+ isEmpty() {
250
+ return this.elements.size === 0;
251
+ }
252
+ /**
253
+ * Checks if this set is a proper subset of another set.
254
+ *
255
+ * @param other - The other set
256
+ * @returns True if this is a subset but not equal to the other set
257
+ */
258
+ isProperSubsetOf(other) {
259
+ return this.size < other.size && this.isSubsetOf(other);
260
+ }
261
+ /**
262
+ * Checks if this set is a proper superset of another set.
263
+ *
264
+ * @param other - The other set
265
+ * @returns True if this is a superset but not equal to the other set
266
+ */
267
+ isProperSupersetOf(other) {
268
+ return this.size > other.size && this.isSupersetOf(other);
269
+ }
270
+ /**
271
+ * Checks if this set is a subset of another set.
272
+ *
273
+ * @param other - The other set
274
+ * @returns True if all elements of this set are in the other set
275
+ */
276
+ isSubsetOf(other) {
277
+ if (this.size > other.size) {
278
+ return false;
279
+ }
280
+ for (const key of this.elements.keys()) {
281
+ if (!other.elements.has(key)) {
282
+ return false;
283
+ }
284
+ }
285
+ return true;
286
+ }
287
+ /**
288
+ * Checks if this set is a superset of another set.
289
+ *
290
+ * @param other - The other set
291
+ * @returns True if all elements of the other set are in this set
292
+ */
293
+ isSupersetOf(other) {
294
+ return other.isSubsetOf(this);
295
+ }
296
+ /**
297
+ * Maps each element to a new value using a transform function.
298
+ *
299
+ * @param transform - Function to transform each element
300
+ * @returns A new set containing the transformed elements
301
+ */
302
+ map(transform) {
303
+ const result = new DecimalSet();
304
+ for (const value of this.elements.values()) {
305
+ result.add(transform(value));
306
+ }
307
+ return result;
308
+ }
309
+ /**
310
+ * Returns the maximum value in the set.
311
+ *
312
+ * @returns The maximum value, or undefined if the set is empty
313
+ */
314
+ max() {
315
+ if (this.elements.size === 0) {
316
+ return undefined;
317
+ }
318
+ let maxValue;
319
+ for (const value of this.elements.values()) {
320
+ if (maxValue === undefined || value.greaterThan(maxValue)) {
321
+ maxValue = value;
322
+ }
323
+ }
324
+ return maxValue;
325
+ }
326
+ /**
327
+ * Returns the minimum value in the set.
328
+ *
329
+ * @returns The minimum value, or undefined if the set is empty
330
+ */
331
+ min() {
332
+ if (this.elements.size === 0) {
333
+ return undefined;
334
+ }
335
+ let minValue;
336
+ for (const value of this.elements.values()) {
337
+ if (minValue === undefined || value.lessThan(minValue)) {
338
+ minValue = value;
339
+ }
340
+ }
341
+ return minValue;
342
+ }
343
+ /**
344
+ * Returns the number of elements in the set.
345
+ */
346
+ get size() {
347
+ return this.elements.size;
348
+ }
349
+ /**
350
+ * Tests whether some element passes the predicate test.
351
+ *
352
+ * @param predicate - Function to test each element
353
+ * @returns True if at least one element passes the test
354
+ */
355
+ some(predicate) {
356
+ for (const value of this.elements.values()) {
357
+ if (predicate(value)) {
358
+ return true;
359
+ }
360
+ }
361
+ return false;
362
+ }
363
+ /**
364
+ * Returns the sum of all values in the set.
365
+ *
366
+ * @returns The sum, or zero if the set is empty
367
+ */
368
+ sum() {
369
+ let total = new decimal_js_1.default(0);
370
+ for (const value of this.elements.values()) {
371
+ total = total.plus(value);
372
+ }
373
+ return total;
374
+ }
375
+ /**
376
+ * Returns an iterator over the values in the set (same as values()).
377
+ */
378
+ *[Symbol.iterator]() {
379
+ yield* this.values();
380
+ }
381
+ /**
382
+ * Creates a new set containing the symmetric difference.
383
+ *
384
+ * @param other - The other set
385
+ * @returns A new set containing elements in either set but not both
386
+ */
387
+ symmetricDifference(other) {
388
+ const result = new DecimalSet();
389
+ for (const [key, value] of this.elements) {
390
+ if (!other.elements.has(key)) {
391
+ result.elements.set(key, value);
392
+ }
393
+ }
394
+ for (const [key, value] of other.elements) {
395
+ if (!this.elements.has(key)) {
396
+ result.elements.set(key, value);
397
+ }
398
+ }
399
+ return result;
400
+ }
401
+ /**
402
+ * Converts the set to an array.
403
+ */
404
+ toArray() {
405
+ return Array.from(this.elements.values());
406
+ }
407
+ /**
408
+ * Returns a sorted array of the set's elements.
409
+ *
410
+ * @param compareFn - Optional comparison function
411
+ * @returns Sorted array of elements
412
+ */
413
+ toSorted(compareFn) {
414
+ const array = this.toArray();
415
+ if (compareFn) {
416
+ return array.sort(compareFn);
417
+ }
418
+ return array.sort((a, b) => a.comparedTo(b));
419
+ }
420
+ /**
421
+ * Creates a string representation of the set.
422
+ */
423
+ toString() {
424
+ const elements = this.toSorted()
425
+ .map(d => d.toString())
426
+ .join(', ');
427
+ return `DecimalSet { ${elements} }`;
428
+ }
429
+ /**
430
+ * Creates a new set containing the union of this set and another.
431
+ *
432
+ * @param other - The other set
433
+ * @returns A new set containing all elements from both sets
434
+ */
435
+ union(other) {
436
+ const result = new DecimalSet();
437
+ for (const [key, value] of this.elements) {
438
+ result.elements.set(key, value);
439
+ }
440
+ for (const [key, value] of other.elements) {
441
+ result.elements.set(key, value);
442
+ }
443
+ return result;
444
+ }
445
+ /**
446
+ * Returns an iterator over the values in the set.
447
+ */
448
+ *values() {
449
+ for (const decimal of this.elements.values()) {
450
+ yield decimal;
451
+ }
452
+ }
453
+ }
454
+ exports.DecimalSet = DecimalSet;
@@ -0,0 +1,102 @@
1
+ import { StructuredEntity } from '../../common/classes/StructuredEntity';
2
+ import { DICTIONARY } from '../parser/constants';
3
+ import type { ParserEntity } from '../../types';
4
+ /**
5
+ * A key-value container where keys are strings (variable names) and values
6
+ * are any ParserEntity. Supports element-wise arithmetic operations.
7
+ *
8
+ * @remarks
9
+ * The optional constructor Map is retained rather than copied. {@link set} and
10
+ * {@link merge} also retain value references, while {@link copy} copies every
11
+ * stored parser entity. Arrays returned by {@link keys}, {@link values}, and
12
+ * {@link entries} are new arrays, but their values still refer to the stored
13
+ * entities.
14
+ *
15
+ * Iteration and text output preserve Map insertion order. Replacing an existing
16
+ * key does not move it. {@link each} can replace values in place; returning
17
+ * nothing from its callback leaves a value unchanged. Use {@link forEach} for
18
+ * observation-only traversal. Evaluation and expansion return deep copies.
19
+ * Dictionaries support structural equality by key and value but define no
20
+ * greater-than or less-than ordering.
21
+ *
22
+ * Syntax: {x => 1, y => 2, z => x+3}
23
+ * Access: d[x] → 1, d[y] → 2
24
+ * Assign: d[y]: 10
25
+ */
26
+ export declare class Dictionary extends StructuredEntity<Dictionary> {
27
+ /**
28
+ * Internal storage. The ordered map preserves insertion order for
29
+ * deterministic iteration and text output.
30
+ */
31
+ private _entries;
32
+ dataType: typeof DICTIONARY;
33
+ isEnumerable: boolean;
34
+ precision?: number | undefined;
35
+ /** Creates a Dictionary, retaining the supplied Map when present. */
36
+ constructor(entries?: Map<string, ParserEntity>);
37
+ static isDictionary(obj: unknown): obj is Dictionary;
38
+ /**
39
+ * Returns the element for the given string key.
40
+ * Used by the parser for bracket indexing: d[x] → d.getter('x')
41
+ */
42
+ __get__(indices: number[] | string): ParserEntity;
43
+ /**
44
+ * Sets the element for the given string key.
45
+ * Used by the parser for bracket assignment: d[x]: 5
46
+ */
47
+ __set__(indices: number[] | string, value: ParserEntity): void;
48
+ /** Copies the Dictionary, including every stored value. */
49
+ copy(): Dictionary;
50
+ /** Number of entries. */
51
+ count(): number;
52
+ /** Removes a key-value pair. */
53
+ delete(key: string): boolean;
54
+ dimensions(): number[];
55
+ /**
56
+ * Visits or replaces entries in insertion order.
57
+ *
58
+ * Returning a ParserEntity replaces the current value. Returning `void` leaves
59
+ * that value unchanged, so callers can inspect a Dictionary without a dummy return.
60
+ * The callback receives the value and string key.
61
+ */
62
+ each(callback: (e: ParserEntity, i?: string | number, j?: string | number) => ParserEntity | void): Dictionary;
63
+ /**
64
+ * Satisfies the StructuredEntity abstract property.
65
+ * Returns the values as an array for compatibility with element-wise operations.
66
+ */
67
+ get elements(): ParserEntity[];
68
+ set elements(values: ParserEntity[]);
69
+ /**
70
+ * Returns all entries in insertion order as a new pair array.
71
+ * Stored value objects are not copied.
72
+ */
73
+ entries(): [string, ParserEntity][];
74
+ eq(other: ParserEntity): boolean;
75
+ /** Evaluates a copied Dictionary, leaving this one unchanged. */
76
+ evaluate(): Dictionary;
77
+ expand(): Dictionary;
78
+ /** Visits stored value references without changing the Dictionary. */
79
+ forEach(callback: (value: ParserEntity, key: string) => void): void;
80
+ /** Gets the stored value reference by key, or `undefined` when absent. */
81
+ get(key: string): ParserEntity | undefined;
82
+ gt(_other: ParserEntity): boolean;
83
+ gte(other: ParserEntity): boolean;
84
+ /** Checks if a key exists. */
85
+ has(key: string): boolean;
86
+ /** Returns all keys. */
87
+ keys(): string[];
88
+ lt(_other: ParserEntity): boolean;
89
+ lte(other: ParserEntity): boolean;
90
+ /**
91
+ * Merges another Dictionary into this one. Existing keys are overwritten and
92
+ * incoming value references are retained.
93
+ */
94
+ merge(other: Dictionary): Dictionary;
95
+ /** Sets a key-value pair by reference and returns this Dictionary. */
96
+ set(key: string, value: ParserEntity): Dictionary;
97
+ /** Iterates over `[key, value]` pairs in insertion order. */
98
+ [Symbol.iterator](): IterableIterator<[string, ParserEntity]>;
99
+ text(): string;
100
+ /** Returns stored value references in insertion order in a new array. */
101
+ values(): ParserEntity[];
102
+ }