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
package/index.d.ts CHANGED
@@ -1,430 +1,14 @@
1
- export as namespace nerdamer
2
- export = nerdamer
3
- declare function nerdamer(
4
- expression: nerdamer.ExpressionParam,
5
- subs?: { [name: string]: string },
6
- option?: keyof nerdamer.Options | (keyof nerdamer.Options)[],
7
- location?: nerdamer.int): nerdamer.Expression
8
- declare namespace nerdamer {
9
- export type ExpressionParam = Expression | string
10
- export interface Options {
11
- numer: never, expand: never
12
- }
13
- type int = number
14
- /**
15
- * Returns the current version of nerdamer.
16
- */
17
- export function version(): string
1
+ import * as generated from './output/index';
18
2
 
19
- /**
20
- * Sets a constant value which nerdamer will automatically substitute when parsing expression/equation
21
- * @param name The variable to be set as the constant.
22
- * @param value The value for the expression to be set to.
23
- */
24
- export function setConstant(name: string, value: number | string): typeof nerdamer
3
+ import type { SettingsType } from './output/core/Settings';
25
4
 
26
- /**
27
- * Sets a function which can then be called using nerdamer.
28
- * @param function_name The function name
29
- * @param param_array The parameter array in the order in which the arguments are to be passed
30
- * @param function_body The body of the function
31
- * @example
32
- * nerdamer.setFunction('f', ['x', 'y'], 'x^2+y')
33
- * var x = nerdamer('f(4, 7)').toString()
34
- * console.log(x.toString())
35
- * nerdamer.setFunction('g', ['z', 'x', 'y'], '2*x+3*y+4*z')
36
- * x = nerdamer('g(3, 1, 2)')
37
- * console.log(x.toString())
38
- */
39
- export function setFunction(function_name: string, param_array: string[], function_body: string): typeof nerdamer
5
+ type GeneratedNerdamer = typeof generated.default;
6
+ type RootSettings = SettingsType & { PRECISION: number };
7
+ type Nerdamer = Omit<GeneratedNerdamer, 'get'> &
8
+ ((...args: Parameters<GeneratedNerdamer>) => ReturnType<GeneratedNerdamer>) & {
9
+ get<K extends keyof RootSettings>(setting: K): RootSettings[K];
10
+ };
40
11
 
41
- /**
42
- * Returns the nerdamer core object. This object contains all the core functions of nerdamer and houses the parser.
43
- * @example
44
- * Object.keys(nerdamer.getCore())
45
- */
46
- export function getCore(): any
12
+ declare const nerdamer: Nerdamer;
47
13
 
48
- /**
49
- * Gets the list of reserved names. This is a list of names already in use by nerdamer excluding variable names. This is not a static list.
50
- * @param asArray Pass in true to get the list back as an array instead of as an object.
51
- */
52
- export function reserved(asArray: true): string[]
53
- export function reserved(asArray?: false): any
54
-
55
- /**
56
- * Clears all stored expressions.
57
- * @example
58
- * var x = nerdamer('x*x')
59
- console.log(nerdamer.expressions())
60
- nerdamer.flush() //clear all expressions
61
- console.log(nerdamer.expressions())
62
- */
63
- export function flush(): typeof nerdamer
64
-
65
- /**
66
- * Converts and expression to LaTeX without evaluating expression.
67
- * @param expression The expression being converted.
68
- */
69
- export function convertToLaTeX(expression: string): string
70
-
71
- /**
72
- * Attempts to import a LaTeX string.
73
- * @param TeX The expression being converted.
74
- */
75
- export function convertFromLaTeX(TeX: string): Expression
76
-
77
- /**
78
- * Each time an expression is parsed nerdamer stores the result. Use this method to get back stored expressions.
79
- * @param asObject Pass in true to get expressions as numbered object with 1 as starting index
80
- * @param asLatex Pass in the string "LaTeX" to get the expression to LaTeX, otherwise expressions come back as strings
81
- */
82
- export function expressions(asObject?: boolean, asLatex?: 'LaTeX'): string[]
83
-
84
- /**
85
- * Registers a module function with nerdamer. The object needs to contain at a minimum, a name property (text), a numargs property (int), this is -1 for variable arguments or an array containing the min and max arguments, the visible property (bool) which allows use of this function through nerdamer, defaults to true, and a build property containing a function which returns the function to be used. This function is also handy for creating aliases to functions. See below how the alias D was created for the diff function).
86
- * @param o
87
- */
88
- export interface ModuleFunction {
89
- /**
90
- * Name of function.
91
- */
92
- name: string,
93
-
94
- /**
95
- * Number of function arguments, -1 for variable arguments or an tuple containing minimum and maximum number of arguments.
96
- */
97
- numargs: int | [int, int],
98
-
99
- /**
100
- * Allows use of this function through nerdamer. Defaults to true.
101
- */
102
- visible?: boolean,
103
-
104
- /**
105
- * Return the function to be used.
106
- */
107
- build(): (...args: number[]) => number
108
- }
109
-
110
- /**
111
- * Registers one or more module functions with nerdamer.
112
- * @param f
113
- * @example
114
- * var core = nerdamer.getCore()
115
- var _ = core.PARSER
116
- function f(a, b) {
117
- //use clone for safety since a or b might be returned
118
- var sum = _.add(a.clone(), b.clone())
119
- var product = _.multiply(a.clone(), b.clone())
120
- return _.multiply(sum, product)
121
- }
122
- //register the function with nerdamer
123
- nerdamer.register({
124
- name: 'myFunction',
125
- numargs: 2,
126
- visible: true,
127
- build: function(){ return f }
128
- })
129
-
130
- //create an alias for the diff function
131
- var core = nerdamer.getCore()
132
- nerdamer.register({
133
- name: 'D',
134
- visible: true,
135
- numargs: [1, 3],
136
- build: function(){ return core.Calculus.diff }
137
- })
138
- */
139
- export function register(f: ModuleFunction | ModuleFunction[]): typeof nerdamer
140
-
141
- /**
142
- * This method can be used to check that the variable meets variable name requirements for nerdamer. Variable names Must start with a letter or underscore and may contains any combination of numbers, letters, and underscores after that.
143
- * @param variable_name The variable name being validated.
144
- * @example
145
- * nerdamer.validVarName('cos') // false
146
- * nerdamer.validVarName('chicken1') // true
147
- * nerdamer.validVarName('1chicken') // false
148
- * nerdamer.validVarName('_') // true
149
- */
150
- export function validVarName(variable_name: string): boolean
151
-
152
- /**
153
- * Sets a known value in nerdamer. This differs from setConstant as the value can be overridden trough the scope. See example.
154
- * @param name The known value to be set.
155
- * @param value The value for the expression to be set to
156
- * @example
157
- * nerdamer.setVar('x', '11')
158
- * nerdamer('x*x') // == 121
159
- * // nerdamer will use 13 instead of 11:
160
- * nerdamer('x*x', {x: 13}) // == 169
161
- * // the value will be 121 again since the known value isn't being overridden:
162
- * nerdamer('x*x') // == 121
163
- * nerdamer.setVar('x', 'delete')
164
- * // since there no longer is a known value it will just be evaluated symbolically:
165
- * nerdamer('x*x') // == x^2
166
- */
167
- export function setVar(name: string, value: number | string | 'delete'): void
168
-
169
- /**
170
- * Clears all previously set variables.
171
- */
172
- export function clearVars(): typeof nerdamer
173
-
174
- /**
175
- * Gets all previously set variables.
176
- * @param option Use "LaTeX" to get as LaTeX. Defaults to text.
177
- */
178
- export function getVars(option: 'LaTeX' | 'text'): { [name: string]: string }
179
-
180
- /**
181
- * Sets the value of a nerdamer setting. Currently PARSE2NUMBER and IMAGINARY. Setting PARSE2NUMBER to true will let nerdamer always try to return a number whenenver possible. IMAGINARY allows you to change the variable used for imaginary to j for instance.
182
- * @param setting The setting to be changed
183
- * @param value The value to set the setting to.
184
- * @example
185
- * nerdamer.set('PARSE2NUMBER', true)
186
- * nerdamer('cos(9)+1') // == 14846499/167059106
187
- * nerdamer.set('IMAGINARY', 'j')
188
- * nerdamer('sqrt(-1)') // == j
189
- */
190
- export function set(setting: 'PARSE2NUMBER', value: boolean): typeof nerdamer
191
- export function set(setting: 'IMAGINARY', value: string | 'i'): typeof nerdamer
192
- export function set(setting: 'POWER_OPERATOR', value: '**' | '^'): typeof nerdamer
193
-
194
- export interface Expression {
195
- /**
196
- * Generates a JavaScript function given the expression. This is perfect for plotting and filtering user input. Plotting for the demo is accomplished using this. The order of the parameters is in alphabetical order by default but an argument array can be provided with the desired order.
197
- * @param args_array The argument array with the order in which they are preferred.
198
- */
199
- buildFunction(args_array?: string[]): (...args: number[]) => number
200
-
201
- /**
202
- * Forces evaluation of the expression.
203
- * @example
204
- * const x = nerdamer('sin(9+5)')
205
- * //the expression is simplified but the functions aren't called:
206
- * x.toString() // == sin(14)
207
- * // force function calls with evaluate:
208
- * x.evaluate().toString() // == 127690464/128901187
209
- */
210
- evaluate(): Expression
211
-
212
- /**
213
- * Substitutes a given value for another given value
214
- * @param value The value being substituted.
215
- * @param for_value The value to substitute for.
216
- */
217
- sub(value: string, for_value: string): Expression
218
-
219
- /**
220
- * Get a list of the variables contained within the expression.
221
- */
222
- variables(): string[]
223
-
224
- /**
225
- * Gets expression as LaTeX
226
- */
227
- toTeX(): string
228
-
229
- /**
230
- * Returns the value of the expression as a string or a number
231
- */
232
- valueOf(): string | number
233
-
234
- /**
235
- * Gets the list of reserved names. This is a list of names already in use by nerdamer excluding variable names. This is not a static list.
236
- * @param outputType Pass in the string 'decimals' to always get back numers as decimals. Pass in the string 'fractions' to always get back number as fractions. Defaults to decimals.
237
- */
238
- text(outputType?: 'decimals' | 'fractions'): string
239
-
240
- /**
241
- * This method requires that the Solve, Calculus, and Algebra add-ons are loaded. It will attempt to solve an equation. If solutions no solutions are found then an empty array is returned. It can solve for multivariate polynomials up to the third degree. After which it can solve numerically for polynomials up to the the 100th degree. If it's a univariate equation it will attempt to solve it using numerical methods.
242
- * @param variable The variable to solve for.
243
- * @example
244
- * nerdamer('a*x^2+b*x=y').evaluate({y: 'x-7'}) // == ??
245
- * eq.solveFor('x') // ?? TODO
246
- */
247
- solveFor(variable: string): Expression
248
-
249
- /**
250
- * Forces the expression to displayed with decimals
251
- */
252
- toDecimal(prec?: number): string
253
-
254
- /**
255
- * Checks to see if the expression's value equals a number. Compares the direct value returned.
256
- * The function will not check for all possible cases. To avoid this call evaluate.
257
- * @example
258
- * nerdamer('sqrt(5)').isNumber()
259
- * // false
260
- * nerdamer('sqrt(5)').evaluate().isNumber()
261
- * // true
262
- */
263
- isNumber(): boolean
264
-
265
- /**
266
- * Checks if a number evaluates to an imaginary number
267
- * @example
268
- * nerdamer('sqrt(-5)+8').isImaginary()
269
- * // true
270
- * nerdamer('sqrt(5)+8').isImaginary()
271
- * // false
272
- */
273
- isImaginary(): boolean
274
-
275
- /**
276
- * Adds a value to an expression
277
- * @example
278
- * nerdamer('x').add(3)
279
- */
280
- add(symbol: number | string | Expression): Expression
281
-
282
- /**
283
- * Subtracts a value from an expression
284
- * @example
285
- * nerdamer('x').subtract(3)
286
- */
287
- subtract(symbol: number | string | Expression): Expression
288
-
289
- /**
290
- * Multiplies an expression by a value
291
- * @example
292
- * nerdamer('x').multiply(3)
293
- */
294
- multiply(symbol: number | string | Expression): Expression
295
-
296
- /**
297
- * Divides an expression by a valule
298
- * @example
299
- * nerdamer('9*x').divide(3)
300
- */
301
- divide(symbol: number | string | Expression): Expression
302
-
303
- /**
304
- * Raises an expression to a power
305
- * @example
306
- * nerdamer('x').pow(3)
307
- */
308
- pow(symbol: number | string | Expression): Expression
309
-
310
- /**
311
- * Checks if two values are equal
312
- * @param value The value being tested
313
- * @example
314
- * nerdamer('sqrt(9)').eq(3)
315
- * // true
316
- * nerdamer('x').eq('y')
317
- * // false
318
- */
319
- eq(value: number | string | Expression): boolean
320
-
321
- /**
322
- * Checks if a value is less than another
323
- * @param value The value being tested
324
- * @example
325
- * nerdamer('sqrt(9)').lt(3)
326
- * // false
327
- * nerdamer('8').lt(100)
328
- * // true
329
- */
330
- lt(value: number | string | Expression): boolean
331
-
332
- /**
333
- * Checks if a value is less than or equal to another
334
- * @param value The value being tested
335
- * @example
336
- * nerdamer('sqrt(9)').lte(3)
337
- * // true
338
- * nerdamer('x').lte(100)
339
- * // false
340
- */
341
- lte(value: number | string | Expression): boolean
342
-
343
- /**
344
- * Checks if a value is greater than another
345
- * @param value The value being tested
346
- * @example
347
- * nerdamer('sqrt(9)').gt(3)
348
- * // false
349
- * nerdamer('800').gt(100)
350
- * // true
351
- */
352
- gt(value: number | string | Expression): boolean
353
-
354
- /**
355
- * Checks if a value is greater than or equal to another
356
- * @param value The value being tested
357
- * @example
358
- * nerdamer('sqrt(9)').gte(3)
359
- * // true
360
- * nerdamer('x').gte(100)
361
- * // false
362
- */
363
- gte(value: number | string | Expression): boolean
364
-
365
- /**
366
- * Expands a function or expression.
367
- * @example
368
- * nerdamer('x*(x+1)').expand();
369
- * // x+x^2
370
- * nerdamer('(x+y)*(x-5)*x').expand();
371
- * // -5*x*y-5*x^2+x^3+x^2*y
372
- */
373
- expand(): Expression
374
- }
375
-
376
- ////////// CALCULUS
377
-
378
- /**
379
- * Gets the GCD of 2 polynomials
380
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
381
- * @param index The index of summation.
382
- * @param lower Starting index.
383
- * @param upper Ending index.
384
- */
385
- export function sum(expression: ExpressionParam,
386
- index: string,
387
- lower: ExpressionParam,
388
- upper: ExpressionParam): Expression
389
-
390
- /**
391
- *
392
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
393
- * @param variable The variable with respect to which to integrate.
394
- */
395
- export function integrate(expression: ExpressionParam, variable: string): Expression
396
-
397
- /**
398
- *
399
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
400
- * @param variable The variable with respect to which to differentiate.
401
- * @param n Calculate the nth derivative.
402
- */
403
- export function diff(expression: ExpressionParam, variable: string, n?: int): Expression
404
-
405
- ////////// ALGEBRA
406
-
407
- /**
408
- * Divides 2 polynominals.
409
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
410
- */
411
- export function divide(expression: ExpressionParam): Expression
412
-
413
- /**
414
- * Factor an expression.
415
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
416
- */
417
- export function factor(expression: ExpressionParam): Expression
418
-
419
- /**
420
- * Gets the GCD of 2 polynomials.
421
- * @param expression Returns the appropriate value if possible otherwise it returns the function with the simplified expression.
422
- */
423
- export function gcd(expression: ExpressionParam): Expression
424
-
425
- /**
426
- * Finds the roots of a univariate polynomial.
427
- * @param expression
428
- */
429
- export function factor(expression: ExpressionParam): Expression
430
- }
14
+ export = nerdamer;
@@ -0,0 +1,3 @@
1
+ import type { Expression } from '../core/classes/expression/Expression';
2
+ /** Completes the square and returns the expression expected by parser notation. */
3
+ export declare function completeSquare(expr: Expression, variable?: Expression): Expression;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.completeSquare = completeSquare;
4
+ const utils_1 = require("../core/classes/expression/utils");
5
+ const utils_2 = require("./utils");
6
+ /** Completes the square and returns the expression expected by parser notation. */
7
+ function completeSquare(expr, variable) {
8
+ const variableName = variable === undefined ? undefined : (0, utils_1.assertPlainVariableAndGetString)(variable);
9
+ const retval = (0, utils_2.sqcomp)(expr, variableName).expression;
10
+ return retval;
11
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @module arith
3
+ *
4
+ * Low-level integer and modular arithmetic helpers used throughout the library.
5
+ *
6
+ * - All integer arithmetic is done with `bigint`.
7
+ * - Modular routines assume a prime modulus `p` when inverses are required.
8
+ */
9
+ /**
10
+ * Shared integer + modular arithmetic primitives used across Zippel GCD and
11
+ * multivariate factorization.
12
+ *
13
+ * Design goals:
14
+ * - BigInt-only arithmetic for coefficient paths.
15
+ * - Small, stable surface area: use `abs`, `gcd`, `pow`.
16
+ */
17
+ /** Absolute value for BigInt. */
18
+ export declare function abs(a: bigint): bigint;
19
+ /**
20
+ * Euclidean GCD for BigInt.
21
+ *
22
+ * Returns a nonnegative gcd. gcd(0,0) = 0.
23
+ */
24
+ export declare function gcd(a: bigint, b: bigint): bigint;
25
+ /**
26
+ * Integer exponentiation for BigInt with a nonnegative exponent.
27
+ *
28
+ * This is NOT modular exponentiation (see {@link modPow}).
29
+ */
30
+ export declare function pow(base: bigint, exp: bigint): bigint;
31
+ /**
32
+ * Integer exponentiation for BigInt with a small nonnegative JS number exponent.
33
+ *
34
+ * Convenience wrapper used throughout factorization code where exponents are known
35
+ * to fit in a number.
36
+ */
37
+ export declare function powN(base: bigint, exp: number): bigint;
38
+ /**
39
+ * Integer square root: floor(sqrt(n)) for n >= 0.
40
+ */
41
+ export declare function bigIntSqrt(n: bigint): bigint;
42
+ /**
43
+ * Exact n-th root if it exists.
44
+ * Returns r such that r^n === value, or null if value is not a perfect n-th power.
45
+ */
46
+ export declare function intNthRootExact(value: bigint, n: number): bigint | null;
47
+ /**
48
+ * Return positive divisors of n (n > 0) by trial division.
49
+ *
50
+ * NOTE: This is intended for small integers used in factoring heuristics.
51
+ */
52
+ export declare function getDivisors(n: bigint): bigint[];
53
+ /** Normalize a into the range [0, |p|). Throws if p is zero. */
54
+ export declare function modNorm(a: bigint, p: bigint): bigint;
55
+ /** Map a to the symmetric residue class (-|p|/2, |p|/2]. */
56
+ export declare function modSymmetric(a: bigint, p: bigint): bigint;
57
+ /** Modular multiplicative inverse of a mod p, where gcd(a,p)=1. */
58
+ export declare function modInv(a: bigint, p: bigint): bigint;
59
+ /**
60
+ * Content (GCD of coefficients) for an iterable of bigint coefficients.
61
+ * Returns 0n for the all-zero collection.
62
+ */
63
+ export declare function contentBigint(coeffs: Iterable<bigint>): bigint;
64
+ /** Bit-length of a bigint (0 -> 0). */
65
+ export declare function bigintBitLength(a: bigint): number;
66
+ /** Next prime >= start. */
67
+ export declare function nextPrime32(start: number): number;
68
+ type AlgebraPhase = 'prime-selection' | 'specialization' | 'lift' | 'reconstruction' | 'verification' | 'budget' | 'normalization' | 'unknown';
69
+ declare class AlgebraError extends Error {
70
+ /** Additional structured debugging info. Always present (possibly empty). */
71
+ readonly details: Record<string, unknown>;
72
+ readonly phase: AlgebraPhase;
73
+ constructor(message: string, phase?: AlgebraPhase, details?: Record<string, unknown>);
74
+ }
75
+ export declare class PrimeSelectionError extends AlgebraError {
76
+ constructor(message: string, details?: Record<string, unknown>);
77
+ }
78
+ /**
79
+ * Thrown when Zippel-style multivariate GCD exceeds its specialization / interpolation budget.
80
+ */
81
+ export declare class GcdBudgetExceededError extends AlgebraError {
82
+ constructor(message: string, details?: Record<string, unknown>);
83
+ }
84
+ export {};