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,19 @@
1
+ import { Expression } from '../core/classes/expression/Expression';
2
+ import type { ExpressionInput } from '../core/types';
3
+ /**
4
+ * Truncates a number toward zero.
5
+ *
6
+ * Numeric inputs discard their fractional part without changing the sign of the
7
+ * integer portion. Symbolic inputs remain unevaluated.
8
+ *
9
+ * @param x - The expression to truncate.
10
+ * @returns The integer portion of `x`, or symbolic `trunc(x)`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * trunc('3.7').text() // "3"
15
+ * trunc('-2.7').text() // "-2"
16
+ * trunc('x').text() // "trunc(x)"
17
+ * ```
18
+ */
19
+ export declare function trunc(x: ExpressionInput): Expression;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trunc = trunc;
4
+ const Expression_1 = require("../core/classes/expression/Expression");
5
+ const constants_1 = require("../core/classes/parser/constants");
6
+ /**
7
+ * Truncates a number toward zero.
8
+ *
9
+ * Numeric inputs discard their fractional part without changing the sign of the
10
+ * integer portion. Symbolic inputs remain unevaluated.
11
+ *
12
+ * @param x - The expression to truncate.
13
+ * @returns The integer portion of `x`, or symbolic `trunc(x)`.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * trunc('3.7').text() // "3"
18
+ * trunc('-2.7').text() // "-2"
19
+ * trunc('x').text() // "trunc(x)"
20
+ * ```
21
+ */
22
+ function trunc(x) {
23
+ x = Expression_1.Expression.create(x);
24
+ let retval;
25
+ if (x.isPosInf() || x.isNegInf()) {
26
+ retval = x.isNegInf() ? Expression_1.Expression.NegInf() : Expression_1.Expression.Inf();
27
+ }
28
+ else if (x.isNUM()) {
29
+ const m = x.getMultiplier();
30
+ retval = Expression_1.Expression.Number(m.numerator / m.denominator);
31
+ }
32
+ else {
33
+ retval = Expression_1.Expression.toFunction(constants_1.TRUNC, [x]);
34
+ }
35
+ return retval;
36
+ }
@@ -0,0 +1,66 @@
1
+ import { Collection } from '../core/classes/collection/Collection';
2
+ import { Expression } from '../core/classes/expression/Expression';
3
+ export { product, stripPower, sum } from '../core/classes/expression/utils';
4
+ import type { ExpressionInput, ParserEntity } from '../core/types';
5
+ /**
6
+ * Returns the continued-fraction decomposition as a Collection containing
7
+ * sign, whole part, and a Vector of partial quotients.
8
+ */
9
+ export declare function continuedFraction(x: ExpressionInput, depth?: ExpressionInput): Collection;
10
+ /**
11
+ * Contains useful functions which are not likely to be exported to the user through `build`
12
+ */
13
+ /**
14
+ * Places the Expression in a form that will defer any simplification. Expand must be explicitly called.
15
+ * TODO: This should likely be its own type but it seems a bit overblown to create whole new type
16
+ * just for factors.
17
+ *
18
+ * @param x
19
+ * @returns
20
+ */
21
+ export declare function toFactor(x: Expression): Expression;
22
+ export declare function roots(x: number, y: number, product: number): [number, number];
23
+ export declare function getCombinations(factors: number[], num?: number, startAt?: number, combinations?: number[]): number[];
24
+ export declare function findMatches(factors: number[], target: number): number[][];
25
+ /**
26
+ * Converts an array of coefficient in decending power order to a polynomial string
27
+ *
28
+ * @param arr Array of coefficients in order of descending powers
29
+ * @param variable The variable to be used. Defaults to 'x'
30
+ * @returns
31
+ */
32
+ export declare function polynomialStringFromArray(arr: number[], variable?: string): string;
33
+ /**
34
+ * Trims leading zeroes from an array
35
+ *
36
+ * @param polyArray
37
+ * @returns
38
+ */
39
+ export declare function trimZeros(polyArray: Expression[]): Expression[];
40
+ /**
41
+ * Returns the index of an element in an array. Use this instead of Array.indexOf
42
+ * since it recognized equality in Expression, Vectors, Matrices, etc.
43
+ *
44
+ * @param arr
45
+ * @param e
46
+ * @returns
47
+ */
48
+ export declare function indexOf(arr: ParserEntity[], e: ParserEntity): number;
49
+ /**
50
+ * Returns the number of elements in a Vector, SolutionSet, ValuesSet
51
+ * @param x
52
+ * @returns
53
+ */
54
+ export declare function count(x: ParserEntity): Expression;
55
+ /** Returns the dimensions of a structured parser value. */
56
+ export declare function size(x: ParserEntity): ParserEntity;
57
+ /**
58
+ * Tests whether an exact integer expression is prime.
59
+ *
60
+ * Non-integer or unresolved symbolic input remains as an unevaluated `isprime(...)`
61
+ * expression so it can be simplified later.
62
+ *
63
+ * @param x - Expression-compatible value to test.
64
+ * @returns `1` for prime integers, `0` for composite integers, or an unevaluated symbolic call.
65
+ */
66
+ export declare function isprime(x: ExpressionInput): Expression;
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sum = exports.stripPower = exports.product = void 0;
4
+ exports.continuedFraction = continuedFraction;
5
+ exports.toFactor = toFactor;
6
+ exports.roots = roots;
7
+ exports.getCombinations = getCombinations;
8
+ exports.findMatches = findMatches;
9
+ exports.polynomialStringFromArray = polynomialStringFromArray;
10
+ exports.trimZeros = trimZeros;
11
+ exports.indexOf = indexOf;
12
+ exports.count = count;
13
+ exports.size = size;
14
+ exports.isprime = isprime;
15
+ const Collection_1 = require("../core/classes/collection/Collection");
16
+ const Dictionary_1 = require("../core/classes/dictionary/Dictionary");
17
+ const Expression_1 = require("../core/classes/expression/Expression");
18
+ const shortcuts_1 = require("../core/classes/expression/shortcuts");
19
+ var utils_1 = require("../core/classes/expression/utils");
20
+ Object.defineProperty(exports, "product", { enumerable: true, get: function () { return utils_1.product; } });
21
+ Object.defineProperty(exports, "stripPower", { enumerable: true, get: function () { return utils_1.stripPower; } });
22
+ Object.defineProperty(exports, "sum", { enumerable: true, get: function () { return utils_1.sum; } });
23
+ const Matrix_1 = require("../core/classes/matrix/Matrix");
24
+ const constants_1 = require("../core/classes/parser/constants");
25
+ const ValuesSet_1 = require("../core/classes/valuesSet/ValuesSet");
26
+ const Vector_1 = require("../core/classes/vector/Vector");
27
+ const errors_1 = require("../core/errors");
28
+ const primeFactor_1 = require("../core/functions/bigint/primeFactor");
29
+ /**
30
+ * Returns the continued-fraction decomposition as a Collection containing
31
+ * sign, whole part, and a Vector of partial quotients.
32
+ */
33
+ function continuedFraction(x, depth = 10) {
34
+ const input = Expression_1.Expression.create(x);
35
+ const limitExpression = Expression_1.Expression.create(depth);
36
+ if (!limitExpression.isNUM() ||
37
+ !limitExpression.isInteger() ||
38
+ limitExpression.lt((0, shortcuts_1.zero)()) ||
39
+ limitExpression.getMultiplier().numerator > BigInt(Number.MAX_SAFE_INTEGER)) {
40
+ throw new errors_1.UnexpectedInputError((0, errors_1.message)('wrongInput', {
41
+ expected: 'a non-negative integer',
42
+ received: limitExpression.text(),
43
+ }));
44
+ }
45
+ const limit = Number(limitExpression.getMultiplier().numerator);
46
+ const evaluated = input.isConstant() ? input.evaluate() : input;
47
+ if (!evaluated.isNUM()) {
48
+ return new Collection_1.Collection([(0, shortcuts_1.one)(), input, new Vector_1.Vector()]);
49
+ }
50
+ const rational = evaluated.getMultiplier();
51
+ const sign = Expression_1.Expression.Number(rational.sign());
52
+ const numerator = rational.numerator < 0n ? -rational.numerator : rational.numerator;
53
+ let denominator = rational.denominator;
54
+ const whole = numerator / denominator;
55
+ let remainder = numerator % denominator;
56
+ const fractions = [];
57
+ for (let i = 0; i < limit && remainder !== 0n; i++) {
58
+ const quotient = denominator / remainder;
59
+ fractions.push(Expression_1.Expression.Number(quotient));
60
+ const nextRemainder = denominator % remainder;
61
+ denominator = remainder;
62
+ remainder = nextRemainder;
63
+ }
64
+ return new Collection_1.Collection([sign, Expression_1.Expression.Number(whole), new Vector_1.Vector(fractions)]);
65
+ }
66
+ /**
67
+ * Contains useful functions which are not likely to be exported to the user through `build`
68
+ */
69
+ /**
70
+ * Places the Expression in a form that will defer any simplification. Expand must be explicitly called.
71
+ * TODO: This should likely be its own type but it seems a bit overblown to create whole new type
72
+ * just for factors.
73
+ *
74
+ * @param x
75
+ * @returns
76
+ */
77
+ function toFactor(x) {
78
+ return Expression_1.Expression.toEXP(x, (0, shortcuts_1.one)());
79
+ }
80
+ function roots(x, y, product) {
81
+ const a = (x + y + Math.sqrt((x + y) ** 2 - 4 * product)) / 2;
82
+ const b = (x + y - Math.sqrt((x + y) ** 2 - 4 * product)) / 2;
83
+ return [Math.min(a, b), Math.max(a, b)];
84
+ }
85
+ function getCombinations(factors, num, startAt = 1, combinations) {
86
+ combinations ??= [factors[0]];
87
+ // Start at the beginning
88
+ num = num || factors[0];
89
+ for (let i = startAt; i < factors.length; i++) {
90
+ // Calculate this combination
91
+ const product = num * factors[i];
92
+ combinations.push(product);
93
+ // Get the rest of the combinations with this
94
+ for (let j = startAt + 1; j < factors.length; j++) {
95
+ combinations.push(factors[startAt] * factors[j]);
96
+ }
97
+ // We now have to calculate the combinations witht the remaining factors
98
+ getCombinations(factors, product, i + 1, combinations);
99
+ }
100
+ combinations = [...new Set(combinations)].sort((a, b) => a - b);
101
+ return combinations;
102
+ }
103
+ function findMatches(factors, target) {
104
+ const matches = [];
105
+ for (let i = 0; i < factors.length; i++) {
106
+ const a = factors[i];
107
+ for (let j = factors.length - 1; j > i; j--) {
108
+ const b = factors[j];
109
+ const product = a * b;
110
+ // If the range is less than the target number then we're out of range
111
+ if (product < target) {
112
+ break;
113
+ }
114
+ // The combination has to be an exact match
115
+ if (product === target) {
116
+ matches.push([Math.min(a, b), Math.max(a, b)]);
117
+ }
118
+ }
119
+ }
120
+ return matches;
121
+ }
122
+ /**
123
+ * Converts an array of coefficient in decending power order to a polynomial string
124
+ *
125
+ * @param arr Array of coefficients in order of descending powers
126
+ * @param variable The variable to be used. Defaults to 'x'
127
+ * @returns
128
+ */
129
+ function polynomialStringFromArray(arr, variable = 'x') {
130
+ const terms = [];
131
+ // Make a copy and reverse
132
+ const polyArray = [...arr].reverse();
133
+ for (let p = 0; p < polyArray.length; p++) {
134
+ const c = polyArray[p];
135
+ if (c !== 0) {
136
+ if (p === 0) {
137
+ terms.push(String(c));
138
+ }
139
+ else {
140
+ const m = c === 1 ? '' : c === -1 ? '-' : `${c}*`;
141
+ const pow = p === 1 ? '' : '^' + p;
142
+ terms.push(`${m}${variable}${pow}`);
143
+ }
144
+ }
145
+ }
146
+ return terms.reverse().join('+').replace(/\+-/g, '-');
147
+ }
148
+ /**
149
+ * Trims leading zeroes from an array
150
+ *
151
+ * @param polyArray
152
+ * @returns
153
+ */
154
+ function trimZeros(polyArray) {
155
+ let i = polyArray.length - 1;
156
+ while (i > 0 && polyArray[i].isZero()) {
157
+ i--;
158
+ }
159
+ return polyArray.slice(0, i + 1);
160
+ }
161
+ /**
162
+ * Returns the index of an element in an array. Use this instead of Array.indexOf
163
+ * since it recognized equality in Expression, Vectors, Matrices, etc.
164
+ *
165
+ * @param arr
166
+ * @param e
167
+ * @returns
168
+ */
169
+ function indexOf(arr, e) {
170
+ for (let i = 0; i < arr.length; i++) {
171
+ const element = arr[i];
172
+ if (element.eq(e)) {
173
+ return i;
174
+ }
175
+ }
176
+ return -1;
177
+ }
178
+ /**
179
+ * Returns the number of elements in a Vector, SolutionSet, ValuesSet
180
+ * @param x
181
+ * @returns
182
+ */
183
+ function count(x) {
184
+ if (Vector_1.Vector.isVector(x) || ValuesSet_1.ValuesSet.isValuesSet(x) || Dictionary_1.Dictionary.isDictionary(x)) {
185
+ return Expression_1.Expression.Number(x.count());
186
+ }
187
+ return Expression_1.Expression.toFunction(constants_1.COUNT, [x]);
188
+ }
189
+ /** Returns the dimensions of a structured parser value. */
190
+ function size(x) {
191
+ if (Vector_1.Vector.isVector(x) ||
192
+ Matrix_1.Matrix.isMatrix(x) ||
193
+ Collection_1.Collection.isCollection(x) ||
194
+ ValuesSet_1.ValuesSet.isValuesSet(x) ||
195
+ Dictionary_1.Dictionary.isDictionary(x)) {
196
+ return Vector_1.Vector.create(x.dimensions());
197
+ }
198
+ return Expression_1.Expression.toFunction(constants_1.SIZE, [x]);
199
+ }
200
+ /**
201
+ * Tests whether an exact integer expression is prime.
202
+ *
203
+ * Non-integer or unresolved symbolic input remains as an unevaluated `isprime(...)`
204
+ * expression so it can be simplified later.
205
+ *
206
+ * @param x - Expression-compatible value to test.
207
+ * @returns `1` for prime integers, `0` for composite integers, or an unevaluated symbolic call.
208
+ */
209
+ function isprime(x) {
210
+ const expression = Expression_1.Expression.create(x);
211
+ let retval;
212
+ if (expression.isInteger()) {
213
+ retval = Expression_1.Expression.Number(Number((0, primeFactor_1.isPrimeBig)(expression.getMultiplier().numerator)));
214
+ }
215
+ else {
216
+ retval = Expression_1.Expression.toFunction(constants_1.ISPRIME, [expression]);
217
+ }
218
+ return retval;
219
+ }
@@ -0,0 +1,17 @@
1
+ import Decimal from 'decimal.js';
2
+ /**
3
+ * A lightweight numeric matrix over Decimal.js for use in numerical solvers.
4
+ * Supports only the operations needed for Newton-Raphson: construction and linear solve.
5
+ */
6
+ export declare class DecimalMatrix {
7
+ private readonly cols;
8
+ private data;
9
+ private readonly rows;
10
+ constructor(data: Decimal[][]);
11
+ /**
12
+ * Solves the linear system Ax = b using Gaussian elimination with partial pivoting.
13
+ * Returns the solution vector x, or null if the system is singular.
14
+ */
15
+ static solve(A: DecimalMatrix, b: Decimal[]): Decimal[] | null;
16
+ private get;
17
+ }
@@ -0,0 +1,86 @@
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.DecimalMatrix = void 0;
7
+ const decimal_js_1 = __importDefault(require("decimal.js"));
8
+ /**
9
+ * A lightweight numeric matrix over Decimal.js for use in numerical solvers.
10
+ * Supports only the operations needed for Newton-Raphson: construction and linear solve.
11
+ */
12
+ class DecimalMatrix {
13
+ cols;
14
+ data;
15
+ rows;
16
+ constructor(data) {
17
+ this.rows = data.length;
18
+ this.cols = data.length > 0 ? data[0].length : 0;
19
+ this.data = data.map(row => row.map(v => new decimal_js_1.default(v)));
20
+ }
21
+ /**
22
+ * Solves the linear system Ax = b using Gaussian elimination with partial pivoting.
23
+ * Returns the solution vector x, or null if the system is singular.
24
+ */
25
+ static solve(A, b) {
26
+ const n = A.rows;
27
+ if (n !== A.cols || n !== b.length) {
28
+ return null;
29
+ }
30
+ // Build augmented matrix [A | b]
31
+ const aug = [];
32
+ for (let i = 0; i < n; i++) {
33
+ const row = [];
34
+ for (let j = 0; j < n; j++) {
35
+ row.push(new decimal_js_1.default(A.get(i, j)));
36
+ }
37
+ row.push(new decimal_js_1.default(b[i]));
38
+ aug.push(row);
39
+ }
40
+ // Forward elimination with partial pivoting
41
+ for (let col = 0; col < n; col++) {
42
+ // Find pivot
43
+ let maxAbs = aug[col][col].abs();
44
+ let maxRow = col;
45
+ for (let row = col + 1; row < n; row++) {
46
+ const val = aug[row][col].abs();
47
+ if (val.greaterThan(maxAbs)) {
48
+ maxAbs = val;
49
+ maxRow = row;
50
+ }
51
+ }
52
+ if (maxAbs.lessThan(new decimal_js_1.default('1e-30'))) {
53
+ return null; // Singular
54
+ }
55
+ // Swap rows
56
+ if (maxRow !== col) {
57
+ [aug[col], aug[maxRow]] = [aug[maxRow], aug[col]];
58
+ }
59
+ // Eliminate below
60
+ const pivot = aug[col][col];
61
+ for (let row = col + 1; row < n; row++) {
62
+ const factor = aug[row][col].div(pivot);
63
+ for (let j = col; j <= n; j++) {
64
+ aug[row][j] = aug[row][j].minus(factor.times(aug[col][j]));
65
+ }
66
+ }
67
+ }
68
+ // Back substitution
69
+ const x = new Array(n);
70
+ for (let i = n - 1; i >= 0; i--) {
71
+ let sum = aug[i][n];
72
+ for (let j = i + 1; j < n; j++) {
73
+ sum = sum.minus(aug[i][j].times(x[j]));
74
+ }
75
+ if (aug[i][i].abs().lessThan(new decimal_js_1.default('1e-30'))) {
76
+ return null; // Singular
77
+ }
78
+ x[i] = sum.div(aug[i][i]);
79
+ }
80
+ return x;
81
+ }
82
+ get(i, j) {
83
+ return this.data[i][j];
84
+ }
85
+ }
86
+ exports.DecimalMatrix = DecimalMatrix;
@@ -0,0 +1,135 @@
1
+ import Decimal from 'decimal.js';
2
+ import { Expression } from '../../core/classes/expression/Expression';
3
+ /** Numerical method used to refine a candidate interval. */
4
+ export type RootFindingMethod = 'Brent' | 'NewtonRaphson';
5
+ /** Options for numerical root searches over a fixed interval with {@link FunctionSolver}. */
6
+ export interface FunctionSolverOptions {
7
+ /** Upper endpoint of the search interval. Defaults to `100`. */
8
+ upperBound?: Decimal | number;
9
+ /** Lower endpoint of the search interval. Defaults to `-100`. */
10
+ lowerBound?: Decimal | number;
11
+ /** Central-difference step used by Newton-Raphson. Defaults to `1e-15`. */
12
+ derivativeStep?: Decimal | number;
13
+ /** Maximum refinement iterations for each candidate. Defaults to `200`. */
14
+ maxIterations?: number;
15
+ /** Spacing used to scan for candidate intervals. Defaults to `0.1`. */
16
+ stepSize?: number;
17
+ /** Residual and convergence tolerance. Defaults to `1e-14`. */
18
+ tolerance?: number;
19
+ /** Maximum number of roots to return. Defaults to `20`. */
20
+ maxRoots?: number;
21
+ /** Reserved diagnostic flag. The current implementation emits no output. */
22
+ verbose?: boolean;
23
+ /** Refinement method. Defaults to `'Brent'`. */
24
+ method?: RootFindingMethod;
25
+ }
26
+ /**
27
+ * Metadata returned by a single numerical root-refinement attempt.
28
+ */
29
+ export interface Root {
30
+ /** The root found */
31
+ root: Decimal;
32
+ /** Number of iterations performed */
33
+ iterations: number;
34
+ /** Whether the algorithm converged */
35
+ converged: boolean;
36
+ /** Final error estimate */
37
+ error: Decimal;
38
+ /** The error message if any */
39
+ errorMsg?: string;
40
+ }
41
+ /**
42
+ * Searches a fixed interval for real roots of a univariate expression.
43
+ *
44
+ * @remarks
45
+ * {@link roots} scans the configured interval from its center toward both
46
+ * endpoints. It refines sign-changing intervals with Brent's method or
47
+ * Newton-Raphson, verifies residuals, merges nearby results, and returns roots
48
+ * in ascending order. This is a heuristic search: an even-multiplicity root
49
+ * can be missed unless a scan point lands sufficiently close to it, and
50
+ * periodic functions are limited by both the interval and `maxRoots`.
51
+ *
52
+ * Calculations use the ambient `decimal.js` precision. An Expression supplied
53
+ * to the constructor is retained rather than copied, and the public settings
54
+ * may be adjusted before a search.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const solver = new FunctionSolver('cos(x)-x', 'x', {
59
+ * lowerBound: 0,
60
+ * upperBound: 1,
61
+ * });
62
+ * const roots = solver.roots();
63
+ * ```
64
+ */
65
+ export declare class FunctionSolver {
66
+ derivativeStep: Decimal;
67
+ func: Expression;
68
+ lowerBound: Decimal;
69
+ maxIters: number;
70
+ maxRoots: number;
71
+ method?: RootFindingMethod;
72
+ stepSize: number;
73
+ tolerance: Decimal;
74
+ upperBound: Decimal;
75
+ variable: string;
76
+ verbose: boolean;
77
+ /**
78
+ * Creates a real-root solver for the configured search interval.
79
+ *
80
+ * @param func - Expression to evaluate, or a string parsed as an Expression.
81
+ * @param variable - Variable to substitute. When omitted, the expression must
82
+ * contain at most one variable.
83
+ * @param options - Search interval, refinement method, and tolerances.
84
+ * @throws {@link core!UnsupportedOperationError} If `variable` is omitted and the
85
+ * expression contains more than one variable.
86
+ */
87
+ constructor(func: Expression | string, variable?: string, options?: FunctionSolverOptions);
88
+ private calculateIntervals;
89
+ private getVariable;
90
+ /**
91
+ * Refines a bracket using Brent's combination of bisection, secant, and
92
+ * inverse-quadratic interpolation.
93
+ *
94
+ * @param a - First bracket endpoint.
95
+ * @param b - Second bracket endpoint.
96
+ * @returns Refinement metadata. Invalid brackets and exhausted iterations are
97
+ * represented in the returned {@link Root}; they are not thrown.
98
+ */
99
+ Brent(a: Decimal, b: Decimal): Root;
100
+ /** Approximates the derivative with a central difference. */
101
+ df(x: Decimal, h: Decimal): Decimal;
102
+ /**
103
+ * Evaluates the configured expression at a real value.
104
+ *
105
+ * @throws {@link core!UnexpectedInputError} If evaluation does not produce a scalar
106
+ * Expression.
107
+ */
108
+ evaluate(at: Decimal | number | string): Decimal;
109
+ /**
110
+ * Refines a root from an initial guess using Newton-Raphson and a numerical
111
+ * derivative.
112
+ *
113
+ * @returns Refinement metadata, including non-convergence or a zero derivative.
114
+ */
115
+ NewtonRaphson(guess: Decimal): {
116
+ root: Decimal;
117
+ iterations: number;
118
+ converged: boolean;
119
+ error: Decimal;
120
+ errorMsg: string;
121
+ } | {
122
+ root: Decimal;
123
+ iterations: number;
124
+ converged: boolean;
125
+ error: Decimal;
126
+ errorMsg?: undefined;
127
+ };
128
+ /**
129
+ * Searches the configured interval for real roots.
130
+ *
131
+ * @returns Verified, deduplicated roots in ascending order, limited by
132
+ * `maxRoots`. Failed evaluations and failed refinements are skipped.
133
+ */
134
+ roots(): Expression[];
135
+ }