nerdamer 1.1.13 → 2.0.0-rc.1

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 (341) hide show
  1. package/LICENSE.md +184 -0
  2. package/README.md +293 -312
  3. package/dist/bundle.js +2 -0
  4. package/dist/bundle.js.LICENSE.txt +7 -0
  5. package/dist/parser.js +2 -0
  6. package/dist/parser.js.LICENSE.txt +7 -0
  7. package/docs-data/parser-functions.json +1960 -0
  8. package/index.d.ts +10 -426
  9. package/output/algebra/adapters.d.ts +33 -0
  10. package/output/algebra/adapters.js +109 -0
  11. package/output/algebra/algorithms/arith.d.ts +84 -0
  12. package/output/algebra/algorithms/arith.js +323 -0
  13. package/output/algebra/algorithms/factor.d.ts +3 -0
  14. package/output/algebra/algorithms/factor.js +5 -0
  15. package/output/algebra/algorithms/factorMultivariate.d.ts +23 -0
  16. package/output/algebra/algorithms/factorMultivariate.js +2393 -0
  17. package/output/algebra/algorithms/factorUnivariate.d.ts +72 -0
  18. package/output/algebra/algorithms/factorUnivariate.js +1072 -0
  19. package/output/algebra/algorithms/gcd.d.ts +22 -0
  20. package/output/algebra/algorithms/gcd.js +690 -0
  21. package/output/algebra/algorithms/groebnerBase.d.ts +157 -0
  22. package/output/algebra/algorithms/groebnerBase.js +1166 -0
  23. package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +137 -0
  24. package/output/algebra/algorithms/multiPoly/MultiPoly.js +346 -0
  25. package/output/algebra/algorithms/poly.d.ts +228 -0
  26. package/output/algebra/algorithms/poly.js +1299 -0
  27. package/output/algebra/algorithms/rational.d.ts +17 -0
  28. package/output/algebra/algorithms/rational.js +115 -0
  29. package/output/algebra/factor/factor.d.ts +62 -0
  30. package/output/algebra/factor/factor.js +158 -0
  31. package/output/algebra/gcd/gcd.d.ts +29 -0
  32. package/output/algebra/gcd/gcd.js +141 -0
  33. package/output/algebra/groebner.d.ts +21 -0
  34. package/output/algebra/groebner.js +42 -0
  35. package/output/algebra/partfrac.d.ts +19 -0
  36. package/output/algebra/partfrac.js +398 -0
  37. package/output/algebra/polynomialize.d.ts +20 -0
  38. package/output/algebra/polynomialize.js +24 -0
  39. package/output/algebra/simplify/complexsimp.d.ts +7 -0
  40. package/output/algebra/simplify/complexsimp.js +24 -0
  41. package/output/algebra/simplify/factorCommon.d.ts +13 -0
  42. package/output/algebra/simplify/factorCommon.js +136 -0
  43. package/output/algebra/simplify/funcsimp.d.ts +26 -0
  44. package/output/algebra/simplify/funcsimp.js +633 -0
  45. package/output/algebra/simplify/invtrigrewrite.d.ts +10 -0
  46. package/output/algebra/simplify/invtrigrewrite.js +96 -0
  47. package/output/algebra/simplify/ratsimp.d.ts +21 -0
  48. package/output/algebra/simplify/ratsimp.js +140 -0
  49. package/output/algebra/simplify/simplify.d.ts +25 -0
  50. package/output/algebra/simplify/simplify.js +228 -0
  51. package/output/algebra/simplify/trigreduce.d.ts +38 -0
  52. package/output/algebra/simplify/trigreduce.js +424 -0
  53. package/output/algebra/simplify/trigrewrite.d.ts +17 -0
  54. package/output/algebra/simplify/trigrewrite.js +156 -0
  55. package/output/algebra/simplify/trigsimp.d.ts +11 -0
  56. package/output/algebra/simplify/trigsimp.js +369 -0
  57. package/output/algebra/simplify/utils.d.ts +32 -0
  58. package/output/algebra/simplify/utils.js +56 -0
  59. package/output/algebra/utils.d.ts +32 -0
  60. package/output/algebra/utils.js +48 -0
  61. package/output/api/advanced.d.ts +7 -0
  62. package/output/api/advanced.js +18 -0
  63. package/output/api/algebra.d.ts +17 -0
  64. package/output/api/algebra.js +32 -0
  65. package/output/api/assumptions.d.ts +4 -0
  66. package/output/api/assumptions.js +11 -0
  67. package/output/api/calculus.d.ts +9 -0
  68. package/output/api/calculus.js +21 -0
  69. package/output/api/core.d.ts +17 -0
  70. package/output/api/core.js +41 -0
  71. package/output/api/debug.d.ts +16 -0
  72. package/output/api/debug.js +23 -0
  73. package/output/api/parser.d.ts +85 -0
  74. package/output/api/parser.js +16 -0
  75. package/output/api/solve.d.ts +10 -0
  76. package/output/api/solve.js +16 -0
  77. package/output/api/structures.d.ts +10 -0
  78. package/output/api/structures.js +22 -0
  79. package/output/calculus/derivative/diff.d.ts +30 -0
  80. package/output/calculus/derivative/diff.js +238 -0
  81. package/output/calculus/fresnel.d.ts +16 -0
  82. package/output/calculus/fresnel.js +39 -0
  83. package/output/calculus/integrate/byParts.d.ts +18 -0
  84. package/output/calculus/integrate/byParts.js +339 -0
  85. package/output/calculus/integrate/bySubstitution.d.ts +135 -0
  86. package/output/calculus/integrate/bySubstitution.js +411 -0
  87. package/output/calculus/integrate/integrate.d.ts +38 -0
  88. package/output/calculus/integrate/integrate.js +652 -0
  89. package/output/calculus/integrate/integrationTable.d.ts +2 -0
  90. package/output/calculus/integrate/integrationTable.js +914 -0
  91. package/output/calculus/integrate/utils.d.ts +28 -0
  92. package/output/calculus/integrate/utils.js +96 -0
  93. package/output/calculus/laplace/ilaplace.d.ts +31 -0
  94. package/output/calculus/laplace/ilaplace.js +192 -0
  95. package/output/calculus/laplace/ilaplaceTable.d.ts +2 -0
  96. package/output/calculus/laplace/ilaplaceTable.js +200 -0
  97. package/output/calculus/laplace/laplace.d.ts +22 -0
  98. package/output/calculus/laplace/laplace.js +109 -0
  99. package/output/calculus/laplace/laplaceTable.d.ts +2 -0
  100. package/output/calculus/laplace/laplaceTable.js +187 -0
  101. package/output/calculus/limit/limit.d.ts +35 -0
  102. package/output/calculus/limit/limit.js +1183 -0
  103. package/output/calculus/limit/limitsTable.d.ts +2 -0
  104. package/output/calculus/limit/limitsTable.js +7 -0
  105. package/output/core/Settings.d.ts +32 -0
  106. package/output/core/Settings.js +68 -0
  107. package/output/core/adapters.d.ts +18 -0
  108. package/output/core/adapters.js +40 -0
  109. package/output/core/classes/assumption/Assumption.d.ts +218 -0
  110. package/output/core/classes/assumption/Assumption.js +605 -0
  111. package/output/core/classes/assumption/assertiveFunctions.d.ts +6 -0
  112. package/output/core/classes/assumption/assertiveFunctions.js +64 -0
  113. package/output/core/classes/assumption/assume.d.ts +90 -0
  114. package/output/core/classes/assumption/assume.js +145 -0
  115. package/output/core/classes/collection/Collection.d.ts +107 -0
  116. package/output/core/classes/collection/Collection.js +231 -0
  117. package/output/core/classes/complex/Complex.d.ts +99 -0
  118. package/output/core/classes/complex/Complex.js +135 -0
  119. package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
  120. package/output/core/classes/decimalSet/DecimalSet.js +453 -0
  121. package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
  122. package/output/core/classes/dictionary/Dictionary.js +213 -0
  123. package/output/core/classes/equation/Equation.d.ts +256 -0
  124. package/output/core/classes/equation/Equation.js +350 -0
  125. package/output/core/classes/expression/CoeffObject.d.ts +100 -0
  126. package/output/core/classes/expression/CoeffObject.js +198 -0
  127. package/output/core/classes/expression/Expression.d.ts +1674 -0
  128. package/output/core/classes/expression/Expression.js +2332 -0
  129. package/output/core/classes/expression/analysis.d.ts +25 -0
  130. package/output/core/classes/expression/analysis.js +218 -0
  131. package/output/core/classes/expression/collect.d.ts +9 -0
  132. package/output/core/classes/expression/collect.js +49 -0
  133. package/output/core/classes/expression/format.d.ts +45 -0
  134. package/output/core/classes/expression/format.js +217 -0
  135. package/output/core/classes/expression/products.d.ts +23 -0
  136. package/output/core/classes/expression/products.js +115 -0
  137. package/output/core/classes/expression/shortcuts.d.ts +35 -0
  138. package/output/core/classes/expression/shortcuts.js +129 -0
  139. package/output/core/classes/expression/traversal.d.ts +31 -0
  140. package/output/core/classes/expression/traversal.js +216 -0
  141. package/output/core/classes/expression/trig.d.ts +25 -0
  142. package/output/core/classes/expression/trig.js +40 -0
  143. package/output/core/classes/expression/utils.d.ts +52 -0
  144. package/output/core/classes/expression/utils.js +189 -0
  145. package/output/core/classes/lookupTable/LookupTable.d.ts +12 -0
  146. package/output/core/classes/lookupTable/LookupTable.js +55 -0
  147. package/output/core/classes/matrix/Matrix.d.ts +227 -0
  148. package/output/core/classes/matrix/Matrix.js +889 -0
  149. package/output/core/classes/matrix/Sylvester.d.ts +11 -0
  150. package/output/core/classes/matrix/Sylvester.js +54 -0
  151. package/output/core/classes/matrix/functions.d.ts +26 -0
  152. package/output/core/classes/matrix/functions.js +52 -0
  153. package/output/core/classes/matrix/utils.d.ts +9 -0
  154. package/output/core/classes/matrix/utils.js +22 -0
  155. package/output/core/classes/parser/Parser.d.ts +480 -0
  156. package/output/core/classes/parser/Parser.js +1812 -0
  157. package/output/core/classes/parser/Token.d.ts +58 -0
  158. package/output/core/classes/parser/Token.js +137 -0
  159. package/output/core/classes/parser/constants.d.ts +160 -0
  160. package/output/core/classes/parser/constants.js +227 -0
  161. package/output/core/classes/parser/helpers.d.ts +21 -0
  162. package/output/core/classes/parser/helpers.js +42 -0
  163. package/output/core/classes/parser/operations/add.d.ts +15 -0
  164. package/output/core/classes/parser/operations/add.js +238 -0
  165. package/output/core/classes/parser/operations/comma.d.ts +7 -0
  166. package/output/core/classes/parser/operations/comma.js +11 -0
  167. package/output/core/classes/parser/operations/compare.d.ts +21 -0
  168. package/output/core/classes/parser/operations/compare.js +461 -0
  169. package/output/core/classes/parser/operations/divide.d.ts +2 -0
  170. package/output/core/classes/parser/operations/divide.js +72 -0
  171. package/output/core/classes/parser/operations/functions.d.ts +46 -0
  172. package/output/core/classes/parser/operations/functions.js +430 -0
  173. package/output/core/classes/parser/operations/multiply.d.ts +11 -0
  174. package/output/core/classes/parser/operations/multiply.js +321 -0
  175. package/output/core/classes/parser/operations/power.d.ts +48 -0
  176. package/output/core/classes/parser/operations/power.js +673 -0
  177. package/output/core/classes/parser/operations/subtract.d.ts +3 -0
  178. package/output/core/classes/parser/operations/subtract.js +35 -0
  179. package/output/core/classes/parser/preprocess.d.ts +14 -0
  180. package/output/core/classes/parser/preprocess.js +259 -0
  181. package/output/core/classes/parser/scripting/controlFlow.d.ts +121 -0
  182. package/output/core/classes/parser/scripting/controlFlow.js +355 -0
  183. package/output/core/classes/parser/scripting/evaluate.d.ts +10 -0
  184. package/output/core/classes/parser/scripting/evaluate.js +112 -0
  185. package/output/core/classes/parser/scripting/functions.d.ts +14 -0
  186. package/output/core/classes/parser/scripting/functions.js +59 -0
  187. package/output/core/classes/parser/scripting/scope.d.ts +35 -0
  188. package/output/core/classes/parser/scripting/scope.js +155 -0
  189. package/output/core/classes/parser/types.d.ts +125 -0
  190. package/output/core/classes/parser/types.js +2 -0
  191. package/output/core/classes/parser/wrappers/IndexedReference.d.ts +31 -0
  192. package/output/core/classes/parser/wrappers/IndexedReference.js +68 -0
  193. package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +24 -0
  194. package/output/core/classes/parser/wrappers/KeyValuePair.js +51 -0
  195. package/output/core/classes/polynomial/Polynomial.d.ts +500 -0
  196. package/output/core/classes/polynomial/Polynomial.js +1149 -0
  197. package/output/core/classes/polynomial/Term.d.ts +222 -0
  198. package/output/core/classes/polynomial/Term.js +430 -0
  199. package/output/core/classes/polynomial/functions.d.ts +69 -0
  200. package/output/core/classes/polynomial/functions.js +126 -0
  201. package/output/core/classes/polynomial/utils.d.ts +62 -0
  202. package/output/core/classes/polynomial/utils.js +206 -0
  203. package/output/core/classes/rational/Rational.d.ts +504 -0
  204. package/output/core/classes/rational/Rational.js +779 -0
  205. package/output/core/classes/seq/SEQ.d.ts +13 -0
  206. package/output/core/classes/seq/SEQ.js +137 -0
  207. package/output/core/classes/valuesSet/ValuesSet.d.ts +179 -0
  208. package/output/core/classes/valuesSet/ValuesSet.js +381 -0
  209. package/output/core/classes/vector/Vector.d.ts +222 -0
  210. package/output/core/classes/vector/Vector.js +497 -0
  211. package/output/core/classes/vector/functions.d.ts +28 -0
  212. package/output/core/classes/vector/functions.js +47 -0
  213. package/output/core/common/classes/MathematicalAggregate.d.ts +53 -0
  214. package/output/core/common/classes/MathematicalAggregate.js +140 -0
  215. package/output/core/common/classes/Scope.d.ts +62 -0
  216. package/output/core/common/classes/Scope.js +122 -0
  217. package/output/core/common/classes/StructuredEntity.d.ts +55 -0
  218. package/output/core/common/classes/StructuredEntity.js +151 -0
  219. package/output/core/common/common.d.ts +63 -0
  220. package/output/core/common/common.js +279 -0
  221. package/output/core/common/functions/functions.d.ts +14 -0
  222. package/output/core/common/functions/functions.js +33 -0
  223. package/output/core/common/functions/structuredEntityUtils.d.ts +27 -0
  224. package/output/core/common/functions/structuredEntityUtils.js +40 -0
  225. package/output/core/converters/BaseConverter.d.ts +97 -0
  226. package/output/core/converters/BaseConverter.js +405 -0
  227. package/output/core/converters/Converter.d.ts +111 -0
  228. package/output/core/converters/Converter.js +802 -0
  229. package/output/core/converters/Pattern.d.ts +71 -0
  230. package/output/core/converters/Pattern.js +302 -0
  231. package/output/core/dispatch.d.ts +34 -0
  232. package/output/core/dispatch.js +304 -0
  233. package/output/core/errors.d.ts +531 -0
  234. package/output/core/errors.js +621 -0
  235. package/output/core/functions/bigint/bigint.d.ts +121 -0
  236. package/output/core/functions/bigint/bigint.js +392 -0
  237. package/output/core/functions/bigint/primeFactor.d.ts +49 -0
  238. package/output/core/functions/bigint/primeFactor.js +267 -0
  239. package/output/core/functions/bigint/primes.d.ts +1 -0
  240. package/output/core/functions/bigint/primes.js +11 -0
  241. package/output/core/functions/build/definitions.d.ts +12 -0
  242. package/output/core/functions/build/definitions.js +133 -0
  243. package/output/core/functions/build/index.d.ts +32 -0
  244. package/output/core/functions/build/index.js +136 -0
  245. package/output/core/functions/complex.d.ts +90 -0
  246. package/output/core/functions/complex.js +482 -0
  247. package/output/core/functions/decimal.d.ts +24 -0
  248. package/output/core/functions/decimal.js +664 -0
  249. package/output/core/functions/expand/expand.d.ts +42 -0
  250. package/output/core/functions/expand/expand.js +376 -0
  251. package/output/core/functions/fresnelNumeric.d.ts +12 -0
  252. package/output/core/functions/fresnelNumeric.js +123 -0
  253. package/output/core/functions/numeric.d.ts +140 -0
  254. package/output/core/functions/numeric.js +790 -0
  255. package/output/core/functions/rationalNormalization.d.ts +11 -0
  256. package/output/core/functions/rationalNormalization.js +117 -0
  257. package/output/core/functions/setFunction.d.ts +19 -0
  258. package/output/core/functions/setFunction.js +75 -0
  259. package/output/core/functions/string.d.ts +26 -0
  260. package/output/core/functions/string.js +101 -0
  261. package/output/core/functions/subst.d.ts +90 -0
  262. package/output/core/functions/subst.js +498 -0
  263. package/output/core/functions/utils.d.ts +24 -0
  264. package/output/core/functions/utils.js +51 -0
  265. package/output/core/types.d.ts +48 -0
  266. package/output/core/types.js +2 -0
  267. package/output/index.d.ts +339 -0
  268. package/output/index.js +715 -0
  269. package/output/math/defint/defintDecimal.d.ts +37 -0
  270. package/output/math/defint/defintDecimal.js +320 -0
  271. package/output/math/defint/defintNative.d.ts +57 -0
  272. package/output/math/defint/defintNative.js +292 -0
  273. package/output/math/geometry.d.ts +8 -0
  274. package/output/math/geometry.js +32 -0
  275. package/output/math/math.d.ts +655 -0
  276. package/output/math/math.js +1811 -0
  277. package/output/math/trig.d.ts +518 -0
  278. package/output/math/trig.js +1444 -0
  279. package/output/math/trunc.d.ts +19 -0
  280. package/output/math/trunc.js +36 -0
  281. package/output/math/utils.d.ts +60 -0
  282. package/output/math/utils.js +180 -0
  283. package/output/solve/classes/DecimalMatrix.d.ts +17 -0
  284. package/output/solve/classes/DecimalMatrix.js +86 -0
  285. package/output/solve/classes/FunctionSolver.d.ts +135 -0
  286. package/output/solve/classes/FunctionSolver.js +433 -0
  287. package/output/solve/classes/MultivariateSolver.d.ts +84 -0
  288. package/output/solve/classes/MultivariateSolver.js +240 -0
  289. package/output/solve/classes/PolynomialSolver.d.ts +85 -0
  290. package/output/solve/classes/PolynomialSolver.js +292 -0
  291. package/output/solve/classes/SolutionSet.d.ts +153 -0
  292. package/output/solve/classes/SolutionSet.js +357 -0
  293. package/output/solve/classes/Solver.d.ts +17 -0
  294. package/output/solve/classes/Solver.js +132 -0
  295. package/output/solve/classes/SymbolicSolver.d.ts +74 -0
  296. package/output/solve/classes/SymbolicSolver.js +601 -0
  297. package/output/solve/linsolve.d.ts +51 -0
  298. package/output/solve/linsolve.js +225 -0
  299. package/output/solve/solve.d.ts +34 -0
  300. package/output/solve/solve.js +260 -0
  301. package/output/solve/solveSystem.d.ts +31 -0
  302. package/output/solve/solveSystem.js +290 -0
  303. package/output/solve/utils.d.ts +9 -0
  304. package/output/solve/utils.js +62 -0
  305. package/output/utils/array.d.ts +42 -0
  306. package/output/utils/array.js +98 -0
  307. package/output/utils/debug.d.ts +131 -0
  308. package/output/utils/debug.js +295 -0
  309. package/output/utils/decimal.d.ts +3 -0
  310. package/output/utils/decimal.js +16 -0
  311. package/output/utils/numeric.d.ts +14 -0
  312. package/output/utils/numeric.js +51 -0
  313. package/output/utils/object.d.ts +26 -0
  314. package/output/utils/object.js +56 -0
  315. package/package.json +213 -57
  316. package/.travis.yml +0 -3
  317. package/Algebra.js +0 -4568
  318. package/BREAKING_CHANGES.md +0 -5
  319. package/CODE_OF_CONDUCT.md +0 -46
  320. package/CONTRIBUTING.md +0 -14
  321. package/Calculus.js +0 -2675
  322. package/Extra.js +0 -622
  323. package/Solve.js +0 -1783
  324. package/all.js +0 -16
  325. package/all.min.js +0 -1
  326. package/gulpfile.js +0 -16
  327. package/index.html +0 -158
  328. package/license.txt +0 -19
  329. package/nerdamer.core.js +0 -12510
  330. package/spec/LaTeX.spec.js +0 -302
  331. package/spec/TeXConvert.spec.js +0 -8
  332. package/spec/algebra.spec.js +0 -287
  333. package/spec/basic_parser.spec.js +0 -134
  334. package/spec/build.spec.js +0 -131
  335. package/spec/calculus.spec.js +0 -183
  336. package/spec/core.spec.js +0 -2970
  337. package/spec/extra.spec.js +0 -54
  338. package/spec/solve.spec.js +0 -126
  339. package/spec/support/jasmine.json +0 -11
  340. package/spec/support/utils.js +0 -42
  341. package/spec/text.spec.js +0 -132
@@ -0,0 +1,11 @@
1
+ import { Expression } from '../expression/Expression';
2
+ /**
3
+ * Constructs a Sylvester matrix from the coefficient of two polynomials
4
+ * Ideals, Varieties, and Algorithms 4th edition p. 163
5
+ */
6
+ export declare class Syl {
7
+ private M;
8
+ constructor(f: Expression, g: Expression, variable: string);
9
+ Res(): Expression;
10
+ text(): string;
11
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Syl = void 0;
4
+ const expand_1 = require("../../functions/expand/expand");
5
+ const Expression_1 = require("../expression/Expression");
6
+ const Matrix_1 = require("./Matrix");
7
+ /**
8
+ * Constructs a Sylvester matrix from the coefficient of two polynomials
9
+ * Ideals, Varieties, and Algorithms 4th edition p. 163
10
+ */
11
+ class Syl {
12
+ M;
13
+ constructor(f, g, variable) {
14
+ const M = (this.M = new Matrix_1.Matrix([]));
15
+ function addCoefficients(coeffs, d, m) {
16
+ const cols = M.cols();
17
+ let c = 0;
18
+ // Populate the rows first with the coefficients of f and then g
19
+ for (let col = cols; col < m + cols; col++) {
20
+ for (let row = 0; row < d; row++) {
21
+ const max = coeffs.length - 1 + c;
22
+ const outOfRange = row < c || row > max;
23
+ const value = outOfRange ? Expression_1.Expression.Number('0') : coeffs[row - c];
24
+ // const i = m + c;
25
+ // const value = i < c || i > row? Expression.Number('0') : fCoeffs[row];
26
+ M.elements[row][col] = value;
27
+ // console.log('i: '+i, 'max: '+max, 'row: '+row, 'col: '+col, 'value: '+value.toString())
28
+ }
29
+ c++;
30
+ }
31
+ }
32
+ // Get the coefficients wrt the variable
33
+ const fCoeffs = f.coeffs(variable).toArray().reverse();
34
+ const gCoeffs = g.coeffs(variable).toArray().reverse();
35
+ // The columns for the matrix
36
+ const l = fCoeffs.length - 1;
37
+ const m = gCoeffs.length - 1;
38
+ // The matrix will be an (l+m) x (l+m) matrix so we store the dimension in d
39
+ const d = l + m;
40
+ // Create the rows
41
+ for (let i = 0; i < d; i++) {
42
+ M.elements.push([]);
43
+ }
44
+ addCoefficients(fCoeffs, d, m);
45
+ addCoefficients(gCoeffs, d, l);
46
+ }
47
+ Res() {
48
+ return (0, expand_1.expand)(this.M.determinant());
49
+ }
50
+ text() {
51
+ return this.M.text();
52
+ }
53
+ }
54
+ exports.Syl = Syl;
@@ -0,0 +1,26 @@
1
+ import { Expression } from '../expression/Expression';
2
+ import { Polynomial } from '../polynomial/Polynomial';
3
+ import { Vector } from '../vector/Vector';
4
+ import { Matrix } from './Matrix';
5
+ /**
6
+ * Computes the determinant without mutating the supplied Matrix.
7
+ * @throws {@link core!UnsupportedOperationError} If `M` is not square.
8
+ */
9
+ export declare function determinant(M: Matrix): Expression;
10
+ /** Returns the nullspace basis as a Vector of basis vectors. */
11
+ export declare function nullspace(M: Matrix, prime?: string | number | Expression): Vector;
12
+ /**
13
+ * Computes the monic characteristic polynomial `det(variable*I - M)`.
14
+ *
15
+ * @remarks
16
+ * The spectral variable is explicit so callers can choose a name that does not collide with
17
+ * symbols already present in a symbolic matrix. The Faddeev-LeVerrier recurrence reuses exact
18
+ * Matrix multiplication, trace, scalar arithmetic, and identity construction without introducing
19
+ * symbolic pivot denominators from Gaussian determinant elimination.
20
+ *
21
+ * @param M - Square matrix whose characteristic polynomial is requested.
22
+ * @param variable - Variable name used for the polynomial indeterminate.
23
+ * @returns The exact characteristic polynomial in `variable`.
24
+ * @throws {@link core!UnsupportedOperationError} If `M` is not square.
25
+ */
26
+ export declare function characteristicPolynomial(M: Matrix, variable: string): Polynomial;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.determinant = determinant;
4
+ exports.nullspace = nullspace;
5
+ exports.characteristicPolynomial = characteristicPolynomial;
6
+ const errors_1 = require("../../errors");
7
+ const Expression_1 = require("../expression/Expression");
8
+ const Polynomial_1 = require("../polynomial/Polynomial");
9
+ const Vector_1 = require("../vector/Vector");
10
+ const Matrix_1 = require("./Matrix");
11
+ /**
12
+ * Computes the determinant without mutating the supplied Matrix.
13
+ * @throws {@link core!UnsupportedOperationError} If `M` is not square.
14
+ */
15
+ function determinant(M) {
16
+ return M.copy().determinant();
17
+ }
18
+ /** Returns the nullspace basis as a Vector of basis vectors. */
19
+ function nullspace(M, prime) {
20
+ return new Vector_1.Vector(M.nullspace(prime).map(vector => new Vector_1.Vector(vector)));
21
+ }
22
+ /**
23
+ * Computes the monic characteristic polynomial `det(variable*I - M)`.
24
+ *
25
+ * @remarks
26
+ * The spectral variable is explicit so callers can choose a name that does not collide with
27
+ * symbols already present in a symbolic matrix. The Faddeev-LeVerrier recurrence reuses exact
28
+ * Matrix multiplication, trace, scalar arithmetic, and identity construction without introducing
29
+ * symbolic pivot denominators from Gaussian determinant elimination.
30
+ *
31
+ * @param M - Square matrix whose characteristic polynomial is requested.
32
+ * @param variable - Variable name used for the polynomial indeterminate.
33
+ * @returns The exact characteristic polynomial in `variable`.
34
+ * @throws {@link core!UnsupportedOperationError} If `M` is not square.
35
+ */
36
+ function characteristicPolynomial(M, variable) {
37
+ if (!M.isSquare()) {
38
+ throw new errors_1.UnsupportedOperationError((0, errors_1.message)('squareMatrixRequired'));
39
+ }
40
+ const n = M.rows();
41
+ const spectralParameter = Expression_1.Expression.Variable(variable);
42
+ const identity = Matrix_1.Matrix.identity(n);
43
+ let recurrenceMatrix = identity;
44
+ let characteristicExpression = spectralParameter.pow(n);
45
+ for (let k = 1; k <= n; k++) {
46
+ const product = M.times(recurrenceMatrix);
47
+ const coefficient = product.trace().neg().div(k);
48
+ characteristicExpression = characteristicExpression.plus(coefficient.times(spectralParameter.pow(n - k)));
49
+ recurrenceMatrix = product.plus(identity.times(coefficient));
50
+ }
51
+ return new Polynomial_1.Polynomial(characteristicExpression, [variable]);
52
+ }
@@ -0,0 +1,9 @@
1
+ import { Expression } from '../expression/Expression';
2
+ import { Matrix } from './Matrix';
3
+ /**
4
+ * Creates an identity matrix of integer size.
5
+ *
6
+ * @returns A Matrix for an integer argument, or an unevaluated `imatrix(x)`
7
+ * Expression when the size is not an integer.
8
+ */
9
+ export declare function imatrix(x: Expression): Expression | Matrix;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.imatrix = imatrix;
4
+ const Expression_1 = require("../expression/Expression");
5
+ const constants_1 = require("../parser/constants");
6
+ const Matrix_1 = require("./Matrix");
7
+ /**
8
+ * Creates an identity matrix of integer size.
9
+ *
10
+ * @returns A Matrix for an integer argument, or an unevaluated `imatrix(x)`
11
+ * Expression when the size is not an integer.
12
+ */
13
+ function imatrix(x) {
14
+ let retval;
15
+ if (!x.isInteger()) {
16
+ retval = Expression_1.Expression.toFunction(constants_1.IMATRIX, [x]);
17
+ }
18
+ else {
19
+ retval = Matrix_1.Matrix.identity(Number(x));
20
+ }
21
+ return retval;
22
+ }
@@ -0,0 +1,480 @@
1
+ import { Scope } from '../../common/classes/Scope';
2
+ import { Settings } from '../../Settings';
3
+ import type { Operator, OperatorDefinition } from '../../common/common';
4
+ import type { ParserEntity, ExpressionInput } from '../../types';
5
+ import type { Operation, PreFixFunction, PostFixFunction, OptionsObject, ParserValuesObject, ParserConstants } from './types';
6
+ type OperatorFunction = Operation | PostFixFunction | PreFixFunction;
7
+ /**
8
+ * Parses Nerdamer notation into symbolic and structured parser entities.
9
+ *
10
+ * @remarks
11
+ * The parser has three main stages: {@link tokenize} builds a nested token tree,
12
+ * {@link toRPN} applies the Shunting Yard algorithm within those scopes, and
13
+ * {@link parseRPN} evaluates the resulting stack representation. {@link parse} is
14
+ * the ordinary front end that runs that pipeline for a caller.
15
+ *
16
+ * Parsing does not always produce an {@link Expression}. Depending on the syntax
17
+ * and functions involved, the result can also be an equation, vector, matrix,
18
+ * collection, finite value set, or dictionary. Callers that require a specific
19
+ * parser entity should narrow the returned type rather than assuming an expression.
20
+ *
21
+ * The exported {@link Parser} singleton is the normal parser instance. Several
22
+ * parts of parser behavior are process-wide rather than instance-local, including
23
+ * parser settings, the constant and operator registries, Rational/Decimal precision,
24
+ * and the symbol reserved for the imaginary unit. {@link create} therefore creates
25
+ * another parser object, but it does not create an isolated parser context.
26
+ *
27
+ * The parser is a convenient notation front end, not the only supported way to use
28
+ * Nerdamer. Algorithms that already have {@link Expression} or other Nerdamer
29
+ * objects can operate on those objects directly without converting through text.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * Parser.parse('2*x + 1').text(); // "1+2*x"
34
+ * Parser.parse('x^2', { x: 3 }).text(); // "9"
35
+ * Parser.parse('[x, 2]').text(); // "[x, 2]"
36
+ * Parser.parse('{a => x, b => 2}').text(); // "{a => x, b => 2}"
37
+ * ```
38
+ */
39
+ declare class ExpressionParser {
40
+ /**
41
+ * Registry of named constants recognized by this parser.
42
+ *
43
+ * @remarks
44
+ * The registry object is shared by parser instances. Use {@link setConstants}
45
+ * instead of replacing or mutating this object directly so constant registration
46
+ * follows the parser's normal behavior.
47
+ */
48
+ private CONSTANTS;
49
+ /**
50
+ * The maximum number of operators a compound operator can consist of
51
+ */
52
+ private MAX_COMPOUND_OPERATOR_LENGTH;
53
+ private operators;
54
+ private VALUE_SETS;
55
+ private WHITE_SPACE;
56
+ /**
57
+ * Persistent known-value substitutions consulted during parsing.
58
+ *
59
+ * @remarks
60
+ * Known values are substituted only while the global `SUBSTITUTE` setting is
61
+ * enabled. A stored parser entity is copied before it is inserted into a parsed
62
+ * result, so ordinary substitution does not hand out the stored object itself.
63
+ */
64
+ KNOWN_VALUES: Record<string, ParserEntity>;
65
+ /**
66
+ * Converts an index scope to the zero-based indices used internally.
67
+ *
68
+ * Literal numeric indices are converted directly without parsing or evaluation.
69
+ * Symbolic or computed indices are returned as Expressions when they cannot yet
70
+ * be resolved. Resolved numeric values subtract `INDEX_BASE`; symbolic values retain
71
+ * the public index expressions so they can be evaluated later.
72
+ */
73
+ private extractIndices;
74
+ /**
75
+ * Extracts string keys from an index scope for Dictionary access.
76
+ * For d[x], the scope contains a single variable token "x" → returns ["x"].
77
+ * For d[myKey], returns ["myKey"].
78
+ */
79
+ private extractStringKeys;
80
+ /** Creates another spelling for an existing operator without changing its action. */
81
+ aliasOperator(symbol: string, alias: string): this;
82
+ /**
83
+ * Creates another parser instance.
84
+ *
85
+ * @remarks
86
+ * The returned parser object is distinct and starts with its own `KNOWN_VALUES`
87
+ * table, but it is not an isolated parser environment. Parser settings, constants,
88
+ * operators, Rational/Decimal precision, and the imaginary-unit symbol are shared
89
+ * process-wide. Changes made through methods such as {@link set},
90
+ * {@link setConstants}, {@link setPrecision}, or {@link setI} therefore affect
91
+ * parsing outside the newly created instance as well.
92
+ *
93
+ * @returns A distinct parser instance that shares Nerdamer's global parser state.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const parser = Parser.create();
98
+ *
99
+ * parser === Parser; // false
100
+ * parser.parse('x + 1').text(); // "1+x"
101
+ * ```
102
+ */
103
+ create(): ExpressionParser;
104
+ /**
105
+ * Parses an expression with evaluation mode temporarily enabled.
106
+ *
107
+ * @remarks
108
+ * Supported numeric constants and functions are evaluated eagerly at the current
109
+ * configured precision, but this method does not guarantee a purely numeric result;
110
+ * symbolic terms that cannot be evaluated remain symbolic. The previous global
111
+ * `EVALUATE` setting is restored after parsing, including when parsing throws.
112
+ *
113
+ * @param str - Expression text to parse while evaluation mode is enabled.
114
+ * @param values - Optional call-scoped substitutions applied as in {@link parse}.
115
+ * @returns The parser entity produced by the evaluated parse.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * Parser.evaluate('2^10').text(); // "1024"
120
+ * Parser.evaluate('x+y', { x: 1, y: 2 }).text(); // "3"
121
+ * Parser.evaluate('x+1').text(); // "1+x"
122
+ * ```
123
+ */
124
+ evaluate(str: string, values?: ParserValuesObject): ParserEntity;
125
+ /**
126
+ * Reads the current value of a process-wide parser setting.
127
+ *
128
+ * @param setting - The parser setting to read.
129
+ * @returns The setting's current global value.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const evaluate = Parser.get('EVALUATE');
134
+ * const indexBase = Parser.get('INDEX_BASE');
135
+ * ```
136
+ */
137
+ get(setting: keyof typeof Settings): number | bigint | boolean | "eng" | "spa" | "fra" | "deu" | "por" | "ita" | "nld";
138
+ /**
139
+ * Returns the symbol currently reserved for the imaginary unit.
140
+ *
141
+ * @remarks
142
+ * The symbol is process-wide and can be changed through {@link setI}. Changing it
143
+ * affects subsequent parser behavior and complex-number classification; it does
144
+ * not rewrite expressions that have already been created.
145
+ *
146
+ * @returns The current imaginary-unit variable name.
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * Parser.getI(); // "i" with the default configuration
151
+ * ```
152
+ */
153
+ getI(): string;
154
+ /** Returns a detached snapshot of registered operator metadata. */
155
+ getOperator(symbol: string): Operator | undefined;
156
+ /**
157
+ * Returns the current shared precision used by Decimal-backed numeric operations.
158
+ *
159
+ * @remarks
160
+ * This is the same precision reported by {@link Rational.getPrecision}. Exact
161
+ * rational arithmetic remains exact; the setting matters when Nerdamer crosses
162
+ * into Decimal-backed numerical work, generates numerical constants, or formats
163
+ * precision-sensitive decimal results.
164
+ *
165
+ * @returns The configured number of significant digits.
166
+ */
167
+ getPrecision(): number;
168
+ /**
169
+ * Parses supported expression input into a Nerdamer parser entity.
170
+ *
171
+ * @remarks
172
+ * The input is converted to text, tokenized with {@link tokenize}, transformed
173
+ * with {@link toRPN}, and evaluated with {@link parseRPN}. Passing an existing
174
+ * {@link Expression} therefore reparses its textual representation rather than
175
+ * preserving that object's identity.
176
+ *
177
+ * The result is determined by the parsed syntax. Ordinary scalar input produces
178
+ * an {@link Expression}, while equations and structured syntax can produce other
179
+ * parser entities such as vectors, matrices, collections, finite value sets, or
180
+ * dictionaries.
181
+ *
182
+ * The `values` object provides substitutions for this parse call. The caller's
183
+ * object is not mutated; scalar values are normalized to expressions before use,
184
+ * while existing parser entities are preserved structurally. Each inserted parser
185
+ * entity is copied. Registered string constants are resolved before call-scoped
186
+ * values. Call-scoped values in turn take precedence over persistent known values
187
+ * and over function-backed constants such as `pi` and `e` when those constants are
188
+ * being numerically evaluated.
189
+ *
190
+ * Parser and operator errors are propagated when the input is malformed or an
191
+ * operation is not valid for the parsed operands.
192
+ *
193
+ * @param str - Expression-compatible input whose textual form should be parsed.
194
+ * @param values - Optional call-scoped substitutions. Scalar values are normalized
195
+ * to {@link Expression} objects; existing parser entities are preserved structurally
196
+ * and copied when inserted.
197
+ * @returns The expression or structured parser entity represented by the input.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * Parser.parse('x^2 + 2*x + 1').text(); // "1+2*x+x^2"
202
+ * Parser.parse('a + b', { a: 3, b: 4 }).text(); // "7"
203
+ * Parser.parse('x = 2').text(); // "x=2"
204
+ * Parser.parse('[x, 2, 3]').text(); // "[x, 2, 3]"
205
+ * ```
206
+ */
207
+ parse(str: ExpressionInput, values?: ParserValuesObject): ParserEntity;
208
+ /**
209
+ * Evaluates a token scope that has been converted to Reverse Polish Notation.
210
+ *
211
+ * @remarks
212
+ * This is the parser's core stack evaluator. It applies prefix, postfix, and
213
+ * binary operators; dispatches function calls; resolves substitutions and known
214
+ * values; performs indexing and indexed assignment; and routes operations involving
215
+ * equations or enumerable structures to the appropriate aggregate implementation.
216
+ *
217
+ * Square scopes become vectors. Curly scopes become dictionaries when they contain
218
+ * `=>` key/value markers and otherwise become finite value sets. Multiple unresolved
219
+ * top-level values become a collection. Internal stack markers used for indexing and
220
+ * dictionary construction are resolved or consumed before a successful return.
221
+ *
222
+ * When `assertive` is `true`, operators use their assertive actions where defined.
223
+ * This is used by assumption-related functions so comparisons can assert conditions
224
+ * instead of performing ordinary comparison evaluation.
225
+ *
226
+ * @param rpn - RPN scope, normally produced by {@link toRPN}.
227
+ * @param values - Optional call-scoped substitutions already prepared for parser use.
228
+ * @param assertive - Use assertion-oriented operator actions where the operator defines one.
229
+ * @returns The parser entity produced by evaluating the scope.
230
+ * @throws {@link ParserError} When the stack contains a malformed or unresolved parser construct.
231
+ */
232
+ parseRPN(rpn: Scope, values?: ParserValuesObject, assertive?: boolean): ParserEntity;
233
+ /**
234
+ * Converts a preprocessed TeX token scope to Nerdamer's ordinary parser syntax.
235
+ *
236
+ * @remarks
237
+ * This is a low-level conversion helper used by the TeX converter, not a complete
238
+ * LaTeX parser. The input is the nested scope produced after TeX-specific cleanup
239
+ * and tokenization; despite this method's historical name, callers should not assume
240
+ * that the scope has passed through {@link toRPN}.
241
+ *
242
+ * The converter recognizes the subset of commands handled in this routine, including
243
+ * fractions, integrals, sums, products, limits, square roots, infinity, real/imaginary
244
+ * part notation, and common trigonometric functions. Some command branches consume or
245
+ * modify child scopes while assembling the output, so callers should treat the supplied
246
+ * token tree as conversion input rather than as an immutable value to reuse afterward.
247
+ *
248
+ * Prefer the public TeX conversion API for ordinary LaTeX input.
249
+ *
250
+ * @param rpn - Preprocessed TeX token scope to convert.
251
+ * @returns Equivalent Nerdamer parser text for the supported TeX subset.
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * // Internal conversion examples:
256
+ * // \frac{x}{2} -> "(x)/(2)"
257
+ * // \int x^2 dx -> "int(x^2,x)"
258
+ * ```
259
+ */
260
+ parseTeXRPN(rpn: Scope): string;
261
+ /**
262
+ * Runs a callback while temporarily overriding one global parser setting.
263
+ *
264
+ * @remarks
265
+ * The previous value is restored in a `finally` block, so it is restored even if
266
+ * the callback throws. The override is process-wide for the duration of the
267
+ * synchronous callback; it is not an isolated setting attached to this parser
268
+ * instance. The `setting` parameter remains a string for compatibility, so callers
269
+ * should supply a valid parser setting name.
270
+ *
271
+ * @param setting - Parser setting to override for the callback.
272
+ * @param value - Temporary boolean value for that setting.
273
+ * @param callback - Synchronous parser operation to run under the temporary setting.
274
+ * @returns The parser entity returned by `callback`.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * const symbolicPi = Parser.scopedBlock('EVALUATE', false, () => {
279
+ * return Parser.parse('pi');
280
+ * });
281
+ *
282
+ * symbolicPi.text(); // "pi"
283
+ * ```
284
+ */
285
+ scopedBlock(setting: string, value: boolean, callback: () => ParserEntity): ParserEntity;
286
+ /**
287
+ * Changes one or more process-wide parser settings.
288
+ *
289
+ * @remarks
290
+ * Settings persist until changed again and are shared by the exported parser,
291
+ * parsers returned by {@link create}, and higher-level Nerdamer entry points.
292
+ * Use {@link scopedBlock} when a setting should apply only for one synchronous
293
+ * operation.
294
+ *
295
+ * This method accepts string keys for compatibility and does not validate arbitrary
296
+ * setting names at runtime. Callers should use the settings defined by Nerdamer
297
+ * rather than adding ad hoc properties to the settings object.
298
+ *
299
+ * @param setting - Setting name, or an object containing settings to update.
300
+ * @param value - New value when `setting` is supplied as a single name.
301
+ * @returns This parser instance for chaining.
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * Parser.set('EVALUATE', false);
306
+ * Parser.set({ EVALUATE: false, ALLOW_IMPLICIT_MULTIPLICATION: true });
307
+ * ```
308
+ */
309
+ set(setting: string | OptionsObject, value?: boolean | string | number | bigint): this;
310
+ /**
311
+ * Registers, updates, or removes named parser constants.
312
+ *
313
+ * @remarks
314
+ * The constant registry is shared by parser instances, so changes affect subsequent
315
+ * parsing throughout the process. String-valued constants are reparsed and substituted
316
+ * whenever their name is encountered, even when evaluation mode is disabled. They also
317
+ * take precedence over a same-named value supplied in a parse call.
318
+ *
319
+ * Function-valued constants are deferred factories. They are invoked when evaluation
320
+ * mode is enabled; otherwise the constant name remains symbolic. Nerdamer's built-in
321
+ * `pi` and `e` factories use this mechanism to generate values at the active precision.
322
+ *
323
+ * Assign an empty string to an existing constant to remove it. Changing the registry
324
+ * does not rewrite expressions that have already been parsed.
325
+ *
326
+ * @param constants - Constant names mapped to parser text or to factories that return
327
+ * parser text.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * Parser.setConstants({ G: '6.674e-11' });
332
+ * Parser.parse('G').text(); // "0.00000000006674"
333
+ *
334
+ * Parser.setConstants({ G: '' });
335
+ * Parser.parse('G').text(); // "G"
336
+ * ```
337
+ */
338
+ setConstants(constants: ParserConstants): void;
339
+ /**
340
+ * Changes the symbol Nerdamer treats as the imaginary unit.
341
+ *
342
+ * @remarks
343
+ * This is a process-wide change. The previous imaginary-unit name is removed from
344
+ * Nerdamer's restricted-variable list, the new name is reserved, and
345
+ * {@link Expression.imaginary} is updated. Existing expression trees are not renamed
346
+ * or reparsed, so changing this setting affects subsequent interpretation rather than
347
+ * rewriting values that already exist.
348
+ *
349
+ * @param variable - Parser variable name to reserve for the imaginary unit.
350
+ * @returns This parser instance for chaining.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * const previous = Parser.getI();
355
+ * Parser.setI('j');
356
+ * Parser.parse('3+2*j').text(); // "3+2*j"
357
+ * Parser.setI(previous);
358
+ * ```
359
+ */
360
+ setI(variable: string): this;
361
+ /**
362
+ * Alias for {@link setI}.
363
+ *
364
+ * @param variable - Parser variable name to reserve for the imaginary unit.
365
+ * @returns This parser instance for chaining.
366
+ */
367
+ setImaginary(variable: string): this;
368
+ /**
369
+ * Registers or updates an operator in the shared parser registry. Legacy `prefix`
370
+ * and `postfix` fields are accepted alongside the current metadata names.
371
+ */
372
+ setOperator(definition: OperatorDefinition, action?: OperatorFunction): this;
373
+ /**
374
+ * Sets the shared precision used by Decimal-backed numerical calculations.
375
+ *
376
+ * @remarks
377
+ * This delegates to {@link Rational.set}. It updates the global `decimal.js`
378
+ * precision and recomputes Nerdamer's finite-precision `pi` and `e` rational
379
+ * constants. Exact numerator/denominator arithmetic remains exact and does not
380
+ * become approximate merely because this setting changes.
381
+ *
382
+ * The setting is process-wide and affects parsers returned by {@link create} as
383
+ * well as the exported {@link Parser} singleton.
384
+ *
385
+ * @param precision - Number of significant digits for Decimal-backed work.
386
+ *
387
+ * @example
388
+ * ```ts
389
+ * const previous = Parser.getPrecision();
390
+ * Parser.setPrecision(50);
391
+ * Parser.getPrecision(); // 50
392
+ * Parser.setPrecision(previous);
393
+ * ```
394
+ */
395
+ setPrecision(precision: number): void;
396
+ /**
397
+ * Tokenizes parser text into a nested scope tree.
398
+ *
399
+ * @remarks
400
+ * The tokenizer recognizes numbers, variables, functions, keyword and symbolic
401
+ * operators, and round/square/curly bracket scopes. Scientific notation is normalized
402
+ * to decimal token text and configured aliases such as `π` and `∞` are normalized to
403
+ * their parser names.
404
+ *
405
+ * When implicit multiplication is enabled, the normal mode inserts synthetic `*`
406
+ * tokens where adjacency implies multiplication. Square-bracket adjacency is deferred:
407
+ * the child scope is marked so {@link parseRPN} can decide at evaluation time whether
408
+ * the construct is indexing or multiplication after the left operand's type is known.
409
+ * Unknown variable-parenthesis adjacency keeps its synthetic multiplication token but
410
+ * is also marked so {@link toRPN} can reinterpret it as a function call if the name is
411
+ * registered before that scope is converted. `options.pure` suppresses inserted
412
+ * multiplication tokens and is used by conversion code that needs the original token
413
+ * relationships. `options.keepWhiteSpace` retains whitespace tokens instead of
414
+ * discarding them.
415
+ *
416
+ * This is a low-level parser-pipeline API. Ordinary callers should normally use
417
+ * {@link parse} instead of depending on token representation details.
418
+ *
419
+ * @param inputStr - Parser text to tokenize.
420
+ * @param options - Tokenization options. Set `pure` to suppress synthetic
421
+ * implicit-multiplication tokens, or `keepWhiteSpace` to retain whitespace tokens.
422
+ * @returns The root `Scope` containing the nested token tree.
423
+ * @throws {@link UnexpectedTokenError} When brackets are mismatched or token adjacency is invalid.
424
+ *
425
+ * @example
426
+ * ```ts
427
+ * const tokens = Parser.tokenize('2*x + 1');
428
+ * tokens.text(); // "2 * x + 1"
429
+ * ```
430
+ */
431
+ tokenize(inputStr: string, options?: OptionsObject): Scope;
432
+ /**
433
+ * Converts a tokenized scope to Nerdamer's nested Reverse Polish Notation form.
434
+ *
435
+ * @remarks
436
+ * The conversion uses the Shunting Yard algorithm to apply precedence,
437
+ * associativity, prefix/postfix rules, and bracket scoping. Nested scopes remain
438
+ * nested; each child scope is recursively converted rather than flattening the
439
+ * entire expression into one token array. Deferred adjacency markers are retained
440
+ * on child scopes so square-bracket indexing can be decided by {@link parseRPN} and
441
+ * newly registered function names can be recognized before parenthesis adjacency is
442
+ * committed to implicit multiplication.
443
+ *
444
+ * The returned `Scope` containers are new, but token objects are reused. Prefix
445
+ * detection can retag those shared `Token` objects while converting the input, so
446
+ * callers should not treat the original token tree as an immutable snapshot after
447
+ * this method has run.
448
+ *
449
+ * @param scope - Tokenized scope, normally produced by {@link tokenize}.
450
+ * @returns A new scope hierarchy containing the tokens in evaluation order.
451
+ * @throws {@link ParserError} When an invalid operator sequence requires a prefix operator.
452
+ *
453
+ * @example
454
+ * ```ts
455
+ * const tokens = Parser.tokenize('2 + 3 * x');
456
+ * const rpn = Parser.toRPN(tokens);
457
+ *
458
+ * rpn.text(); // "2 3 x * +"
459
+ * ```
460
+ */
461
+ toRPN(scope: Scope): Scope;
462
+ }
463
+ /**
464
+ * The shared parser instance used by Nerdamer's ordinary parsing APIs.
465
+ *
466
+ * @remarks
467
+ * {@link Parser.parse} is the primary notation-to-object entry point. State-changing
468
+ * methods on this object can affect the rest of Nerdamer because settings, constants,
469
+ * numeric precision, operator metadata, and the imaginary-unit symbol are process-wide.
470
+ * Use scoped setting changes where possible, and do not assume that {@link Parser.create}
471
+ * provides an isolated parser environment.
472
+ *
473
+ * @example
474
+ * ```ts
475
+ * Parser.parse('x^2 + 1').text(); // "1+x^2"
476
+ * Parser.evaluate('2^10').text(); // "1024"
477
+ * ```
478
+ */
479
+ export declare const Parser: ExpressionParser;
480
+ export {};