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,14 @@
1
+ /**
2
+ * Reads the array of operators and breaks it up into individual symbols
3
+ *
4
+ * @returns An array with operator symbol
5
+ */
6
+ export declare function getOperatorSymbolArray(): string[];
7
+ /**
8
+ * Links operator actions to operator objects
9
+ *
10
+ * @returns The operators object
11
+ */
12
+ export declare function getOperators(): Record<string, import("../common").Operator & {
13
+ action: import("../common").OperatorAction;
14
+ }>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOperatorSymbolArray = getOperatorSymbolArray;
4
+ exports.getOperators = getOperators;
5
+ const common_1 = require("../common");
6
+ /**
7
+ * Reads the array of operators and breaks it up into individual symbols
8
+ *
9
+ * @returns An array with operator symbol
10
+ */
11
+ function getOperatorSymbolArray() {
12
+ // make them one long string and then filter out duplicates
13
+ const symbolSet = new Set(Object.keys(common_1.operators).join('').split(''));
14
+ //filter out letters used in keyword operators
15
+ const symbolArray = [...symbolSet].filter(x => {
16
+ return !/[a-z]/i.test(x);
17
+ });
18
+ return symbolArray;
19
+ }
20
+ /**
21
+ * Links operator actions to operator objects
22
+ *
23
+ * @returns The operators object
24
+ */
25
+ function getOperators() {
26
+ // for (const operator in operators) {
27
+ // // Get the object
28
+ // let operatorObject: Operator = operators[operator];
29
+ // // Link the operation function to the operator object or overwrite it
30
+ // operatorObject.operation = _[operatorObject.action]
31
+ // }
32
+ return common_1.operators;
33
+ }
@@ -0,0 +1,27 @@
1
+ import { Expression } from '../../classes/expression/Expression';
2
+ import type { SolutionSet } from '../../../solve/classes/SolutionSet';
3
+ import type { Collection } from '../../classes/collection/Collection';
4
+ import type { Dictionary } from '../../classes/dictionary/Dictionary';
5
+ import type { Matrix } from '../../classes/matrix/Matrix';
6
+ import type { ValuesSet } from '../../classes/valuesSet/ValuesSet';
7
+ import type { Vector } from '../../classes/vector/Vector';
8
+ import type { NerdamerInput, ParserEntity, ExpressionInput } from '../../types';
9
+ /**
10
+ * Checks to see if an obj is a set of values
11
+ *
12
+ * @param obj
13
+ * @returns
14
+ */
15
+ export declare function isEnumerable(obj: unknown): obj is Vector | Collection | Matrix | ValuesSet | SolutionSet | Dictionary;
16
+ /**
17
+ * Converts string and numbers to a parser supported type.
18
+ * @param elements
19
+ * @returns
20
+ */
21
+ export declare function toParserEntities(elements: NerdamerInput[]): ParserEntity[];
22
+ /**
23
+ * Converts all inputs to Expression
24
+ * @param inputs
25
+ * @returns
26
+ */
27
+ export declare function toExpressions(inputs: ExpressionInput[]): Expression[];
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEnumerable = isEnumerable;
4
+ exports.toParserEntities = toParserEntities;
5
+ exports.toExpressions = toExpressions;
6
+ const Expression_1 = require("../../classes/expression/Expression");
7
+ /**
8
+ * Checks to see if an obj is a set of values
9
+ *
10
+ * @param obj
11
+ * @returns
12
+ */
13
+ function isEnumerable(obj) {
14
+ if (obj === undefined) {
15
+ return false;
16
+ }
17
+ return !!obj
18
+ .isEnumerable;
19
+ }
20
+ /**
21
+ * Converts string and numbers to a parser supported type.
22
+ * @param elements
23
+ * @returns
24
+ */
25
+ function toParserEntities(elements) {
26
+ const retval = [];
27
+ for (let i = 0; i < elements.length; i++) {
28
+ const element = elements[i];
29
+ retval.push(isEnumerable(element) ? element : Expression_1.Expression.create(element));
30
+ }
31
+ return retval;
32
+ }
33
+ /**
34
+ * Converts all inputs to Expression
35
+ * @param inputs
36
+ * @returns
37
+ */
38
+ function toExpressions(inputs) {
39
+ return inputs.map(e => Expression_1.Expression.create(e));
40
+ }
@@ -0,0 +1,97 @@
1
+ import { Expression } from '../classes/expression/Expression';
2
+ import type { FracArray } from '../classes/parser/types';
3
+ import type { OptionsObject } from '../classes/parser/types';
4
+ import type { Rational } from '../classes/rational/Rational';
5
+ import type { ParserEntity } from '../types';
6
+ type BracketType = 'parens' | 'square' | 'brace' | 'abs';
7
+ /**
8
+ * Shared formatting pipeline for Nerdamer converters.
9
+ *
10
+ * @remarks
11
+ * This is an implementation base class. Public callers should construct `Converter`
12
+ * through `nerdamer.classes.Converter`; subclasses provide the
13
+ * expression-specific formatting hooks used by {@link BaseConverter.convert}.
14
+ *
15
+ * Conversion separates every expression into multiplier, value, and power fragments,
16
+ * each with numerator and denominator slots. Keeping those fragments separate lets the
17
+ * final formatting step place negative powers and rational multipliers into one
18
+ * denominator without algebraically rewriting the caller's symbolic value.
19
+ */
20
+ export declare class BaseConverter {
21
+ protected static readonly GREEK_LETTERS: string[];
22
+ static readonly modes: {
23
+ TeX: string;
24
+ TEXT: string;
25
+ };
26
+ protected greek: string[];
27
+ private readonly modes;
28
+ protected mode: string;
29
+ static convertNtRoot(input: Expression, root: Expression): Expression;
30
+ static convertSQRT(input: Expression): Expression;
31
+ private static join;
32
+ private static merge;
33
+ private static strip;
34
+ protected cleanup(): void;
35
+ protected convertPower(input: Expression, power: Expression, options: OptionsObject): string;
36
+ protected finalizePowerAndInput(power: Expression, input: Expression, _options?: OptionsObject): [Expression, Expression];
37
+ protected formatPowerOutput(pArray: FracArray, requiresBrackets: boolean): FracArray;
38
+ protected formatSubscripts(value: string): string;
39
+ protected getMultiplicationSymbol(): string;
40
+ protected inBraces(value: string): string;
41
+ protected inBrackets(value: string, type?: BracketType): string;
42
+ protected initInput(input: Expression): Expression;
43
+ protected isBracketed(v: string): boolean;
44
+ protected requiresMultiplicationSymbol(input: Expression): boolean;
45
+ protected set(m: FracArray, v: FracArray, p: FracArray, input: Expression): string;
46
+ protected setMultiplier(m: Rational, multiplierArray: FracArray, _input: Expression, options?: OptionsObject): void;
47
+ protected toFraction(n: string, d: string): string;
48
+ protected value(_input: Expression, _isInverted: boolean, _isNegative: boolean, _options?: OptionsObject): FracArray;
49
+ private convertCollection;
50
+ private convertDictionary;
51
+ private convertEquation;
52
+ private convertExpression;
53
+ private convertMatrix;
54
+ private convertValuesSet;
55
+ /**
56
+ * Removes a single outer \left(...\right) wrapper when the contents
57
+ * will already be visually grouped (e.g. inside \frac{}{}).
58
+ */
59
+ private stripOuterBrackets;
60
+ /**
61
+ * Formats a supported Nerdamer value in the converter's current mode.
62
+ *
63
+ * @remarks
64
+ * String input is parsed before formatting, so current parser settings, constants,
65
+ * and known values apply. Numbers are converted with JavaScript's string conversion.
66
+ * Expressions, equations, collections, vectors, matrices, solution sets, value sets,
67
+ * and dictionaries use their structured representations rather than being reparsed
68
+ * from display text.
69
+ * Reading an expression can initialize its lazily stored multiplier or power fields,
70
+ * but conversion does not change the expression's mathematical value.
71
+ *
72
+ * `convertRoots` defaults to `true`, rendering reciprocal integer powers as roots
73
+ * where the active mode supports that form. `decimal` requests decimal rational
74
+ * multipliers, `precision` is forwarded to rational formatting, `matrixStyle`
75
+ * selects the TeX matrix environment prefix, and `ignoreMultiplier` omits an
76
+ * expression's top-level multiplier. `insideMatrix` is used while formatting matrix
77
+ * elements and is normally managed by the converter itself.
78
+ *
79
+ * @param input - The parser entity, expression string, or number to format.
80
+ * @param options - Formatting options for this conversion and recursive child conversions.
81
+ * @returns The formatted text or TeX string for `input`.
82
+ * @throws Error When `input` is not one of the supported parser entity types.
83
+ */
84
+ convert(input: ParserEntity | string | number, options?: OptionsObject): string;
85
+ /**
86
+ * Selects the output syntax used by subsequent conversions.
87
+ *
88
+ * @remarks
89
+ * The mode is mutable converter state. Supported values are `"TeX"` and `"text"`;
90
+ * changing the mode does not alter parser settings or previously returned strings.
91
+ *
92
+ * @param mode - The output mode to activate.
93
+ * @throws Error When `mode` is not `"TeX"` or `"text"`.
94
+ */
95
+ setMode(mode: string): void;
96
+ }
97
+ export {};
@@ -0,0 +1,405 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseConverter = void 0;
4
+ const Expression_1 = require("../classes/expression/Expression");
5
+ const constants_1 = require("../classes/parser/constants");
6
+ const errors_1 = require("../errors");
7
+ const modes = {
8
+ TeX: 'TeX',
9
+ TEXT: 'text',
10
+ };
11
+ /**
12
+ * Shared formatting pipeline for Nerdamer converters.
13
+ *
14
+ * @remarks
15
+ * This is an implementation base class. Public callers should construct `Converter`
16
+ * through `nerdamer.classes.Converter`; subclasses provide the
17
+ * expression-specific formatting hooks used by {@link BaseConverter.convert}.
18
+ *
19
+ * Conversion separates every expression into multiplier, value, and power fragments,
20
+ * each with numerator and denominator slots. Keeping those fragments separate lets the
21
+ * final formatting step place negative powers and rational multipliers into one
22
+ * denominator without algebraically rewriting the caller's symbolic value.
23
+ */
24
+ class BaseConverter {
25
+ static GREEK_LETTERS = [
26
+ 'alpha',
27
+ 'beta',
28
+ 'gamma',
29
+ 'delta',
30
+ 'epsilon',
31
+ 'zeta',
32
+ 'eta',
33
+ 'theta',
34
+ 'iota',
35
+ 'kappa',
36
+ 'lambda',
37
+ 'mu',
38
+ 'nu',
39
+ 'xi',
40
+ 'omnikron',
41
+ 'pi',
42
+ 'rho',
43
+ 'sigma',
44
+ 'tau',
45
+ 'upsilon',
46
+ 'phi',
47
+ 'chi',
48
+ 'psi',
49
+ 'omega',
50
+ 'Gamma',
51
+ 'Delta',
52
+ 'Epsilon',
53
+ 'Theta',
54
+ 'Lambda',
55
+ 'Xi',
56
+ 'Pi',
57
+ 'Sigma',
58
+ 'Phi',
59
+ 'Psi',
60
+ 'Omega',
61
+ ];
62
+ static modes = modes;
63
+ greek = BaseConverter.GREEK_LETTERS;
64
+ modes = [modes.TeX, modes.TEXT];
65
+ mode = this.modes[0];
66
+ static convertNtRoot(input, root) {
67
+ return Expression_1.Expression.toFunction(constants_1.NTHROOT, [BaseConverter.strip(input), root]);
68
+ }
69
+ static convertSQRT(input) {
70
+ return Expression_1.Expression.toFunction(constants_1.SQRT, [BaseConverter.strip(input)]);
71
+ }
72
+ static join(n, d, glue) {
73
+ if (!n && !d) {
74
+ return '';
75
+ }
76
+ if (n && !d) {
77
+ return n;
78
+ }
79
+ if (d && !n) {
80
+ return d;
81
+ }
82
+ return n + glue + d;
83
+ }
84
+ static merge(a, b) {
85
+ return [a[0] + b[0], a[1] + b[1]];
86
+ }
87
+ static strip(input) {
88
+ const arg = input.copy();
89
+ delete arg.power;
90
+ delete arg.multiplier;
91
+ return arg;
92
+ }
93
+ cleanup() {
94
+ // Override in subclasses if needed
95
+ }
96
+ convertPower(input, power, options) {
97
+ return power.isOne() || (input.isNUM() && power.isZero())
98
+ ? ''
99
+ : this.convert(power, options);
100
+ }
101
+ finalizePowerAndInput(power, input, _options) {
102
+ return [power, input];
103
+ }
104
+ formatPowerOutput(pArray, requiresBrackets) {
105
+ const retval = ['', ''];
106
+ for (let i = 0; i < pArray.length; i++) {
107
+ const p = pArray[i];
108
+ if (p === '') {
109
+ retval[i] = '';
110
+ continue;
111
+ }
112
+ const formatted = this.mode === BaseConverter.modes.TEXT && requiresBrackets
113
+ ? this.inBrackets(p)
114
+ : this.inBraces(p);
115
+ retval[i] = '^' + formatted;
116
+ }
117
+ return retval;
118
+ }
119
+ formatSubscripts(value) {
120
+ const parts = value.split('_');
121
+ let formatted = '';
122
+ while (parts.length > 1) {
123
+ formatted = '_' + this.inBraces(parts.pop() + formatted);
124
+ }
125
+ return parts[0] + formatted;
126
+ }
127
+ getMultiplicationSymbol() {
128
+ return this.mode === 'TeX' ? ' \\cdot ' : '*';
129
+ }
130
+ inBraces(value) {
131
+ return this.mode === BaseConverter.modes.TEXT ? value : `{${value}}`;
132
+ }
133
+ inBrackets(value, type = 'parens') {
134
+ const bracketTypes = {
135
+ parens: ['(', ')'],
136
+ square: ['[', ']'],
137
+ brace: ['{', '}'],
138
+ abs: ['|', '|'],
139
+ };
140
+ const [L, R] = bracketTypes[type];
141
+ if (this.mode === BaseConverter.modes.TEXT) {
142
+ return `${L}${value}${R}`;
143
+ }
144
+ if (type === 'brace') {
145
+ return `\\left\\{${value}\\right\\}`;
146
+ }
147
+ return `\\left${L}${value}\\right${R}`;
148
+ }
149
+ initInput(input) {
150
+ return input;
151
+ }
152
+ isBracketed(v) {
153
+ return /^\\left\(.+\\right\)$/.test(v);
154
+ }
155
+ requiresMultiplicationSymbol(input) {
156
+ return input.isSum();
157
+ }
158
+ set(m, v, p, input) {
159
+ const mul = this.getMultiplicationSymbol();
160
+ const combinePower = input.isProduct();
161
+ // Format power
162
+ let tp;
163
+ if (p) {
164
+ const power = input.getPower();
165
+ const requiresBrackets = ((power.isSum() || power.isProduct()) && power.isLinear()) ||
166
+ (power.isNUM() && !power.isInteger()) ||
167
+ power.getPower().sign() === -1;
168
+ p = this.formatPowerOutput(p, requiresBrackets);
169
+ }
170
+ if (combinePower) {
171
+ tp = p[0];
172
+ p[0] = '';
173
+ }
174
+ // Merge v and p
175
+ v = BaseConverter.merge(v, p);
176
+ let [mn, md] = m;
177
+ const [vn, vd] = v;
178
+ // Filter out unnecessary ones
179
+ if (vn && Number(mn) === 1) {
180
+ mn = '';
181
+ }
182
+ if (Number(md) === 1) {
183
+ md = '';
184
+ }
185
+ const addMultiplication = this.requiresMultiplicationSymbol(input);
186
+ const alwaysMul = this.mode === BaseConverter.modes.TeX;
187
+ const top = BaseConverter.join(mn, vn, alwaysMul || !this.isBracketed(vn) || addMultiplication ? mul : '');
188
+ let bottom = BaseConverter.join(md, vd, alwaysMul || !this.isBracketed(vd) || addMultiplication ? mul : '');
189
+ if (md && vd && this.mode === BaseConverter.modes.TEXT) {
190
+ bottom = this.inBrackets(bottom);
191
+ }
192
+ if (top && bottom) {
193
+ let frac = this.toFraction(top, bottom);
194
+ if (combinePower && tp) {
195
+ frac = this.inBrackets(frac) + tp;
196
+ }
197
+ return frac;
198
+ }
199
+ return top;
200
+ }
201
+ setMultiplier(m, multiplierArray, _input, options) {
202
+ if (options?.decimal) {
203
+ multiplierArray[0] = m.isInteger() ? String(m.numerator) : m.text(options);
204
+ }
205
+ else {
206
+ multiplierArray[0] = String(m.numerator);
207
+ multiplierArray[1] = String(m.denominator);
208
+ }
209
+ }
210
+ toFraction(n, d) {
211
+ if (this.mode === 'TeX') {
212
+ return ('\\frac' +
213
+ this.inBraces(this.stripOuterBrackets(n)) +
214
+ this.inBraces(this.stripOuterBrackets(d)));
215
+ }
216
+ return `${n}/${d}`;
217
+ }
218
+ value(_input, _isInverted, _isNegative, _options) {
219
+ return ['', ''];
220
+ }
221
+ convertCollection(input, options) {
222
+ const elements = input.elements.map(e => this.convert(e, options));
223
+ const inner = elements.join(this.mode === BaseConverter.modes.TeX ? ', \\, ' : ', ');
224
+ return this.inBrackets(inner);
225
+ }
226
+ convertDictionary(input, options) {
227
+ const pairs = input.entries().map(([key, value]) => {
228
+ const convertedValue = this.convert(value, options);
229
+ if (this.mode === BaseConverter.modes.TeX) {
230
+ return `${key} \\mapsto ${convertedValue}`;
231
+ }
232
+ return `${key} => ${convertedValue}`;
233
+ });
234
+ const inner = pairs.join(this.mode === BaseConverter.modes.TeX ? ', \\, ' : ', ');
235
+ if (this.mode === BaseConverter.modes.TeX) {
236
+ return `\\left\\{${inner}\\right\\}`;
237
+ }
238
+ return `{${inner}}`;
239
+ }
240
+ convertEquation(input, options) {
241
+ return `${this.convert(input.LHS, options)}=${this.convert(input.RHS, options)}`;
242
+ }
243
+ convertExpression(input, options) {
244
+ input = this.initInput(input);
245
+ const pExpr = input.getPower();
246
+ // Complex exponents are not ordered, and signFree() would replace them with their modulus.
247
+ // Preserve them verbatim instead of trying to move them into the denominator.
248
+ const isComplexPower = pExpr.isComplex();
249
+ const power = isComplexPower ? pExpr : pExpr.signFree();
250
+ const isInverted = !isComplexPower && (pExpr.lt(0) || pExpr.sign() === -1);
251
+ const isNegative = input.getMultiplier().isNegative();
252
+ const m = input.getMultiplier().abs();
253
+ const multiplierArray = ['', ''];
254
+ if (!options.ignoreMultiplier) {
255
+ this.setMultiplier(m, multiplierArray, input, options);
256
+ }
257
+ const [finalPower, finalInput] = this.finalizePowerAndInput(power, input, options);
258
+ const valueArray = this.value(finalInput, isInverted, isNegative, options);
259
+ const p = this.convertPower(finalInput, finalPower, options);
260
+ const powerArray = ['', ''];
261
+ powerArray[isInverted ? 1 : 0] = p;
262
+ const result = (isNegative ? '-' : '') + this.set(multiplierArray, valueArray, powerArray, finalInput);
263
+ this.cleanup();
264
+ return result.replace(/\+-/g, '-');
265
+ }
266
+ convertMatrix(input, options) {
267
+ let retval;
268
+ if (this.mode === BaseConverter.modes.TEXT) {
269
+ const rows = input.elements.map(row => {
270
+ return `[${row.map(e => this.convert(e, options)).join(', ')}]`;
271
+ });
272
+ retval = `matrix(${rows.join(', ')})`;
273
+ }
274
+ else {
275
+ const style = options.matrixStyle || '';
276
+ const matrixOptions = { ...options, insideMatrix: true };
277
+ const rows = input.elements.map(row => row.map(e => this.convert(e, matrixOptions)).join(' & '));
278
+ retval = `\\begin{${style}matrix} ${rows.join(' \\\\ ')} \\end{${style}matrix}`;
279
+ }
280
+ return retval;
281
+ }
282
+ convertValuesSet(input, options) {
283
+ const elements = input.elements.map(e => this.convert(e, options));
284
+ const inner = elements.join(this.mode === BaseConverter.modes.TeX ? ', \\, ' : ', ');
285
+ if (this.mode === BaseConverter.modes.TeX) {
286
+ return `\\left\\{${inner}\\right\\}`;
287
+ }
288
+ return `{${inner}}`;
289
+ }
290
+ /**
291
+ * Removes a single outer \left(...\right) wrapper when the contents
292
+ * will already be visually grouped (e.g. inside \frac{}{}).
293
+ */
294
+ stripOuterBrackets(s) {
295
+ const left = '\\left(';
296
+ const right = '\\right)';
297
+ let retval = s;
298
+ if (s.startsWith(left) && s.endsWith(right)) {
299
+ let depth = 0;
300
+ let isOuterWrapper = true;
301
+ for (let i = 0; i < s.length && isOuterWrapper;) {
302
+ if (s.startsWith(left, i)) {
303
+ depth++;
304
+ i += left.length;
305
+ }
306
+ else if (s.startsWith(right, i)) {
307
+ depth--;
308
+ i += right.length;
309
+ if (depth === 0 && i < s.length) {
310
+ isOuterWrapper = false;
311
+ }
312
+ else if (depth < 0) {
313
+ isOuterWrapper = false;
314
+ }
315
+ }
316
+ else {
317
+ i++;
318
+ }
319
+ }
320
+ if (isOuterWrapper && depth === 0) {
321
+ retval = s.slice(left.length, -right.length);
322
+ }
323
+ }
324
+ return retval;
325
+ }
326
+ /**
327
+ * Formats a supported Nerdamer value in the converter's current mode.
328
+ *
329
+ * @remarks
330
+ * String input is parsed before formatting, so current parser settings, constants,
331
+ * and known values apply. Numbers are converted with JavaScript's string conversion.
332
+ * Expressions, equations, collections, vectors, matrices, solution sets, value sets,
333
+ * and dictionaries use their structured representations rather than being reparsed
334
+ * from display text.
335
+ * Reading an expression can initialize its lazily stored multiplier or power fields,
336
+ * but conversion does not change the expression's mathematical value.
337
+ *
338
+ * `convertRoots` defaults to `true`, rendering reciprocal integer powers as roots
339
+ * where the active mode supports that form. `decimal` requests decimal rational
340
+ * multipliers, `precision` is forwarded to rational formatting, `matrixStyle`
341
+ * selects the TeX matrix environment prefix, and `ignoreMultiplier` omits an
342
+ * expression's top-level multiplier. `insideMatrix` is used while formatting matrix
343
+ * elements and is normally managed by the converter itself.
344
+ *
345
+ * @param input - The parser entity, expression string, or number to format.
346
+ * @param options - Formatting options for this conversion and recursive child conversions.
347
+ * @returns The formatted text or TeX string for `input`.
348
+ * @throws Error When `input` is not one of the supported parser entity types.
349
+ */
350
+ convert(input, options) {
351
+ options = { convertRoots: true, ...options };
352
+ if (typeof input === 'number') {
353
+ return String(input);
354
+ }
355
+ if (typeof input === 'string' || Expression_1.Expression.isExpression(input)) {
356
+ return this.convertExpression(Expression_1.Expression.create(input), options);
357
+ }
358
+ if (input.dataType === constants_1.COLLECTION) {
359
+ return this.convertCollection(input, options);
360
+ }
361
+ if (input.dataType === constants_1.EQUATION) {
362
+ return this.convertEquation(input, options);
363
+ }
364
+ if (input.dataType === constants_1.VECTOR) {
365
+ const vector = input;
366
+ const separator = options.insideMatrix
367
+ ? ' & '
368
+ : this.mode === BaseConverter.modes.TeX
369
+ ? ', \\, '
370
+ : ', ';
371
+ const inner = vector.arrayMap(e => this.convert(e, options)).join(separator);
372
+ return options.insideMatrix ? inner : this.inBrackets(inner, 'square');
373
+ }
374
+ if (input.dataType === constants_1.MATRIX) {
375
+ return this.convertMatrix(input, options);
376
+ }
377
+ if (input.dataType === constants_1.SOLUTIONS_SET) {
378
+ return this.convertValuesSet(input, options);
379
+ }
380
+ if (input.dataType === constants_1.SET) {
381
+ return this.convertValuesSet(input, options);
382
+ }
383
+ if (input.dataType === constants_1.DICTIONARY) {
384
+ return this.convertDictionary(input, options);
385
+ }
386
+ throw new Error((0, errors_1.message)('unsupportedType', { type: constants_1.dataTypes[input.dataType] || typeof input }));
387
+ }
388
+ /**
389
+ * Selects the output syntax used by subsequent conversions.
390
+ *
391
+ * @remarks
392
+ * The mode is mutable converter state. Supported values are `"TeX"` and `"text"`;
393
+ * changing the mode does not alter parser settings or previously returned strings.
394
+ *
395
+ * @param mode - The output mode to activate.
396
+ * @throws Error When `mode` is not `"TeX"` or `"text"`.
397
+ */
398
+ setMode(mode) {
399
+ if (!this.modes.includes(mode)) {
400
+ throw new Error((0, errors_1.message)('unrecognizedMode', { mode }));
401
+ }
402
+ this.mode = mode;
403
+ }
404
+ }
405
+ exports.BaseConverter = BaseConverter;