nerdamer 2.0.0-rc.1 → 2.0.0

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 (236) hide show
  1. package/BREAKING_CHANGES.md +244 -0
  2. package/README.md +168 -229
  3. package/dist/bundle.js +1 -1
  4. package/dist/bundle.js.LICENSE.txt +6 -6
  5. package/output/algebra/adapters.d.ts +3 -33
  6. package/output/algebra/adapters.js +7 -105
  7. package/output/algebra/algorithms/arith.js +10 -9
  8. package/output/algebra/algorithms/groebnerBase.d.ts +24 -20
  9. package/output/algebra/algorithms/groebnerBase.js +486 -723
  10. package/output/algebra/dispatch.d.ts +1 -0
  11. package/output/algebra/dispatch.js +25 -0
  12. package/output/algebra/factor/factor.d.ts +15 -0
  13. package/output/algebra/factor/factor.js +99 -12
  14. package/output/algebra/gcd/gcd.d.ts +8 -7
  15. package/output/algebra/gcd/gcd.js +32 -78
  16. package/output/algebra/groebner.d.ts +2 -2
  17. package/output/algebra/groebner.js +6 -12
  18. package/output/algebra/partfrac.d.ts +3 -3
  19. package/output/algebra/partfrac.js +28 -61
  20. package/output/algebra/polynomial/ModularSparsePolynomial.d.ts +131 -0
  21. package/output/algebra/polynomial/ModularSparsePolynomial.js +378 -0
  22. package/output/algebra/polynomial/ModularSparsePolynomialFactor.d.ts +40 -0
  23. package/output/algebra/polynomial/ModularSparsePolynomialFactor.js +661 -0
  24. package/output/algebra/polynomial/SparsePolynomialFactor.d.ts +64 -0
  25. package/output/algebra/polynomial/SparsePolynomialFactor.js +492 -0
  26. package/output/algebra/polynomial/SparsePolynomialGcd.d.ts +29 -0
  27. package/output/algebra/polynomial/SparsePolynomialGcd.js +259 -0
  28. package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.d.ts +82 -0
  29. package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.js +604 -0
  30. package/output/algebra/polynomial/modularGcd.d.ts +40 -0
  31. package/output/algebra/polynomial/modularGcd.js +365 -0
  32. package/output/algebra/polynomialize.js +4 -2
  33. package/output/algebra/simplify/funcsimp.js +1 -1
  34. package/output/algebra/simplify/ratsimp.js +1 -1
  35. package/output/algebra/simplify/simplify.js +11 -2
  36. package/output/algebra/utils.d.ts +1 -1
  37. package/output/algebra/utils.js +3 -3
  38. package/output/api/advanced.d.ts +2 -1
  39. package/output/api/advanced.js +3 -3
  40. package/output/api/algebra.d.ts +21 -4
  41. package/output/api/algebra.js +22 -3
  42. package/output/api/assumptions.d.ts +1 -1
  43. package/output/api/assumptions.js +2 -1
  44. package/output/api/calculus.d.ts +2 -1
  45. package/output/api/calculus.js +2 -1
  46. package/output/api/core.d.ts +28 -7
  47. package/output/api/core.js +28 -2
  48. package/output/api/languages/deu.d.ts +3 -0
  49. package/output/api/languages/deu.js +266 -0
  50. package/output/api/languages/fra.d.ts +3 -0
  51. package/output/api/languages/fra.js +266 -0
  52. package/output/api/languages/ita.d.ts +3 -0
  53. package/output/api/languages/ita.js +266 -0
  54. package/output/api/languages/nld.d.ts +3 -0
  55. package/output/api/languages/nld.js +266 -0
  56. package/output/api/languages/por.d.ts +3 -0
  57. package/output/api/languages/por.js +266 -0
  58. package/output/api/languages/spa.d.ts +3 -0
  59. package/output/api/languages/spa.js +266 -0
  60. package/output/api/parser.d.ts +10 -2
  61. package/output/api/parser.js +2 -0
  62. package/output/api/solve.d.ts +1 -1
  63. package/output/api/solve.js +2 -1
  64. package/output/api/structures.d.ts +1 -1
  65. package/output/api/structures.js +2 -1
  66. package/output/calculus/adapters.d.ts +8 -0
  67. package/output/calculus/adapters.js +41 -0
  68. package/output/calculus/derivative/diff.js +6 -3
  69. package/output/calculus/dispatch.d.ts +1 -0
  70. package/output/calculus/dispatch.js +25 -0
  71. package/output/calculus/integrate/integrate.js +4 -4
  72. package/output/calculus/integrate/integrationTable.js +16 -16
  73. package/output/calculus/laplace/ilaplace.js +1 -1
  74. package/output/calculus/laplace/ilaplaceTable.js +18 -17
  75. package/output/calculus/laplace/laplaceTable.js +3 -2
  76. package/output/calculus/limit/limit.js +1 -1
  77. package/output/core/classes/assumption/Assumption.js +14 -10
  78. package/output/core/classes/assumption/assume.d.ts +6 -0
  79. package/output/core/classes/assumption/assume.js +9 -0
  80. package/output/core/classes/assumption/dispatch.d.ts +1 -0
  81. package/output/core/classes/assumption/dispatch.js +11 -0
  82. package/output/core/classes/collection/Collection.js +11 -2
  83. package/output/core/classes/complex/Complex.d.ts +10 -0
  84. package/output/core/classes/complex/Complex.js +19 -1
  85. package/output/core/classes/decimalSet/DecimalSet.js +5 -4
  86. package/output/core/classes/dictionary/Dictionary.js +4 -1
  87. package/output/core/classes/expression/CoeffObject.d.ts +1 -1
  88. package/output/core/classes/expression/CoeffObject.js +1 -2
  89. package/output/core/classes/expression/Expression.d.ts +35 -26
  90. package/output/core/classes/expression/Expression.js +77 -50
  91. package/output/core/classes/expression/analysis.d.ts +1 -1
  92. package/output/core/classes/expression/analysis.js +7 -7
  93. package/output/core/classes/expression/format.d.ts +9 -0
  94. package/output/core/classes/expression/format.js +130 -7
  95. package/output/core/classes/expression/utils.d.ts +9 -0
  96. package/output/core/classes/expression/utils.js +52 -6
  97. package/output/core/classes/matrix/Matrix.d.ts +2 -3
  98. package/output/core/classes/matrix/Matrix.js +26 -23
  99. package/output/core/classes/matrix/dispatch.d.ts +1 -0
  100. package/output/core/classes/matrix/dispatch.js +19 -0
  101. package/output/core/classes/matrix/functions.d.ts +2 -0
  102. package/output/core/classes/matrix/functions.js +5 -0
  103. package/output/core/classes/parser/Parser.d.ts +31 -5
  104. package/output/core/classes/parser/Parser.js +357 -444
  105. package/output/core/classes/parser/constants.d.ts +2 -0
  106. package/output/core/classes/parser/constants.js +4 -2
  107. package/output/core/classes/parser/controlFlowSignals.d.ts +38 -0
  108. package/output/core/classes/parser/controlFlowSignals.js +60 -0
  109. package/output/core/classes/parser/operations/add.js +14 -16
  110. package/output/core/classes/parser/operations/compare.js +13 -0
  111. package/output/core/classes/parser/operations/functions.d.ts +3 -4
  112. package/output/core/classes/parser/operations/functions.js +48 -102
  113. package/output/core/classes/parser/operations/multiply.js +22 -15
  114. package/output/core/classes/parser/operations/power.js +11 -11
  115. package/output/core/classes/parser/operations/subtract.js +2 -1
  116. package/output/core/classes/parser/preprocess.d.ts +0 -7
  117. package/output/core/classes/parser/preprocess.js +33 -39
  118. package/output/core/classes/parser/scripting/controlFlow.d.ts +4 -102
  119. package/output/core/classes/parser/scripting/controlFlow.js +134 -186
  120. package/output/core/classes/parser/scripting/deferred.d.ts +4 -0
  121. package/output/core/classes/parser/scripting/deferred.js +65 -0
  122. package/output/core/classes/parser/scripting/dispatch.d.ts +1 -0
  123. package/output/core/classes/parser/scripting/dispatch.js +62 -0
  124. package/output/core/classes/parser/scripting/evaluate.d.ts +13 -0
  125. package/output/core/classes/parser/scripting/evaluate.js +17 -1
  126. package/output/core/classes/parser/scripting/scope.d.ts +1 -28
  127. package/output/core/classes/parser/scripting/scope.js +36 -40
  128. package/output/core/classes/parser/types.d.ts +5 -5
  129. package/output/core/classes/parser/wrappers/IndexedReference.d.ts +4 -3
  130. package/output/core/classes/parser/wrappers/IndexedReference.js +8 -0
  131. package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +2 -2
  132. package/output/core/classes/polynomial/Polynomial.d.ts +5 -1
  133. package/output/core/classes/polynomial/Polynomial.js +53 -7
  134. package/output/core/classes/polynomial/SparsePolynomial.d.ts +221 -0
  135. package/output/core/classes/polynomial/SparsePolynomial.js +824 -0
  136. package/output/core/classes/polynomial/SparsePolynomialAdapter.d.ts +56 -0
  137. package/output/core/classes/polynomial/SparsePolynomialAdapter.js +241 -0
  138. package/output/core/classes/polynomial/Term.js +2 -2
  139. package/output/core/{adapters.d.ts → classes/polynomial/adapters.d.ts} +2 -2
  140. package/output/core/classes/polynomial/adapters.js +33 -0
  141. package/output/core/classes/polynomial/dispatch.d.ts +1 -0
  142. package/output/core/classes/polynomial/dispatch.js +14 -0
  143. package/output/core/classes/polynomial/functions.d.ts +8 -0
  144. package/output/core/classes/polynomial/functions.js +71 -8
  145. package/output/core/classes/polynomial/utils.js +2 -1
  146. package/output/core/classes/rational/Rational.d.ts +8 -11
  147. package/output/core/classes/rational/Rational.js +70 -20
  148. package/output/core/classes/seq/SEQ.js +4 -4
  149. package/output/core/classes/valuesSet/ValuesSet.d.ts +9 -1
  150. package/output/core/classes/valuesSet/ValuesSet.js +22 -4
  151. package/output/core/classes/vector/Vector.d.ts +2 -3
  152. package/output/core/classes/vector/Vector.js +11 -15
  153. package/output/core/classes/vector/dispatch.d.ts +1 -0
  154. package/output/core/classes/vector/dispatch.js +11 -0
  155. package/output/core/common/classes/MathematicalAggregate.js +11 -2
  156. package/output/core/common/classes/StructuredEntity.d.ts +0 -17
  157. package/output/core/common/classes/StructuredEntity.js +3 -64
  158. package/output/core/common/common.d.ts +0 -1
  159. package/output/core/common/common.js +29 -234
  160. package/output/core/converters/BaseConverter.js +3 -2
  161. package/output/core/converters/Converter.js +9 -5
  162. package/output/core/converters/Pattern.js +1 -1
  163. package/output/core/dispatch.d.ts +18 -0
  164. package/output/core/dispatch.js +3 -281
  165. package/output/core/errors.d.ts +259 -474
  166. package/output/core/errors.js +270 -542
  167. package/output/core/fullFunctions.d.ts +7 -0
  168. package/output/core/fullFunctions.js +31 -0
  169. package/output/core/functions/bigint/bigint.d.ts +13 -1
  170. package/output/core/functions/bigint/bigint.js +56 -4
  171. package/output/core/functions/bigint/primeFactor.d.ts +2 -0
  172. package/output/core/functions/bigint/primeFactor.js +13 -13
  173. package/output/core/functions/build/definitions.js +6 -0
  174. package/output/core/functions/complex.d.ts +2 -2
  175. package/output/core/functions/complex.dispatch.d.ts +1 -0
  176. package/output/core/functions/complex.dispatch.js +16 -0
  177. package/output/core/functions/complex.js +7 -7
  178. package/output/core/functions/decimal.js +2 -1
  179. package/output/core/functions/expand/expand.js +2 -2
  180. package/output/core/functions/numeric.d.ts +1 -1
  181. package/output/core/functions/string.js +2 -1
  182. package/output/core/functions/subst.js +21 -13
  183. package/output/core/parserFunctions.d.ts +7 -0
  184. package/output/core/parserFunctions.js +25 -0
  185. package/output/index.d.ts +50 -30
  186. package/output/index.js +147 -19
  187. package/output/math/defint/defint.d.ts +18 -0
  188. package/output/math/defint/defint.js +60 -0
  189. package/output/math/defint/defintDecimal.js +6 -5
  190. package/output/math/defint/defintNative.js +7 -18
  191. package/output/math/dispatch.d.ts +1 -0
  192. package/output/math/dispatch.js +101 -0
  193. package/output/math/geometry.d.ts +4 -0
  194. package/output/math/geometry.js +23 -0
  195. package/output/math/math.d.ts +59 -19
  196. package/output/math/math.js +244 -100
  197. package/output/math/trig.js +4 -4
  198. package/output/math/utils.d.ts +6 -0
  199. package/output/math/utils.js +39 -0
  200. package/output/solve/classes/PolynomialSolver.d.ts +33 -14
  201. package/output/solve/classes/PolynomialSolver.js +267 -67
  202. package/output/solve/classes/SolutionSet.d.ts +20 -1
  203. package/output/solve/classes/SolutionSet.js +82 -5
  204. package/output/solve/dispatch.d.ts +1 -0
  205. package/output/solve/dispatch.js +13 -0
  206. package/output/solve/linsolve.d.ts +2 -0
  207. package/output/solve/linsolve.js +13 -5
  208. package/output/solve/solve.d.ts +10 -0
  209. package/output/solve/solve.js +128 -20
  210. package/output/solve/solveSystem.d.ts +1 -1
  211. package/output/solve/solveSystem.js +8 -32
  212. package/output/solve/utils.d.ts +2 -1
  213. package/output/solve/utils.js +18 -22
  214. package/output/utils/array.d.ts +1 -1
  215. package/output/utils/debug.js +2 -1
  216. package/package.json +22 -38
  217. package/dist/parser.js +0 -2
  218. package/dist/parser.js.LICENSE.txt +0 -7
  219. package/docs-data/parser-functions.json +0 -1960
  220. package/output/algebra/algorithms/factor.d.ts +0 -3
  221. package/output/algebra/algorithms/factor.js +0 -5
  222. package/output/algebra/algorithms/factorMultivariate.d.ts +0 -23
  223. package/output/algebra/algorithms/factorMultivariate.js +0 -2393
  224. package/output/algebra/algorithms/factorUnivariate.d.ts +0 -72
  225. package/output/algebra/algorithms/factorUnivariate.js +0 -1072
  226. package/output/algebra/algorithms/gcd.d.ts +0 -22
  227. package/output/algebra/algorithms/gcd.js +0 -690
  228. package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +0 -137
  229. package/output/algebra/algorithms/multiPoly/MultiPoly.js +0 -346
  230. package/output/algebra/algorithms/poly.d.ts +0 -228
  231. package/output/algebra/algorithms/poly.js +0 -1299
  232. package/output/algebra/algorithms/rational.d.ts +0 -17
  233. package/output/algebra/algorithms/rational.js +0 -115
  234. package/output/core/adapters.js +0 -40
  235. package/output/core/classes/parser/operations/comma.d.ts +0 -7
  236. package/output/core/classes/parser/operations/comma.js +0 -11
@@ -17,234 +17,36 @@ function isNerdamerNativeType(obj, dataType) {
17
17
  return retval;
18
18
  }
19
19
  exports.brackets = {
20
- '(': {
21
- type: 'parenthesis',
22
- id: 1,
23
- isOpen: true,
24
- isClose: false,
25
- matches: ')',
26
- },
27
- ')': {
28
- type: 'parenthesis',
29
- id: 2,
30
- isOpen: false,
31
- isClose: true,
32
- matches: '(',
33
- },
34
- '[': {
35
- type: 'square',
36
- id: 3,
37
- isOpen: true,
38
- isClose: false,
39
- matches: ']',
40
- },
41
- ']': {
42
- type: 'square',
43
- id: 4,
44
- isOpen: false,
45
- isClose: true,
46
- matches: '[',
47
- },
48
- '{': {
49
- type: 'curly',
50
- id: 5,
51
- isOpen: true,
52
- isClose: false,
53
- matches: '}',
54
- },
55
- '}': {
56
- type: 'curly',
57
- id: 6,
58
- isOpen: false,
59
- isClose: true,
60
- matches: '{',
61
- },
62
- '|': {
63
- type: 'pipe',
64
- id: 7,
65
- isOpen: true,
66
- isClose: true,
67
- matches: '|',
68
- },
20
+ '(': { type: 'parenthesis', id: 1, isOpen: true, isClose: false, matches: ')' },
21
+ ')': { type: 'parenthesis', id: 2, isOpen: false, isClose: true, matches: '(' },
22
+ '[': { type: 'square', id: 3, isOpen: true, isClose: false, matches: ']' },
23
+ ']': { type: 'square', id: 4, isOpen: false, isClose: true, matches: '[' },
24
+ '{': { type: 'curly', id: 5, isOpen: true, isClose: false, matches: '}' },
25
+ '}': { type: 'curly', id: 6, isOpen: false, isClose: true, matches: '{' },
26
+ '|': { type: 'pipe', id: 7, isOpen: true, isClose: true, matches: '|' },
69
27
  };
70
28
  exports.operators = {
71
- '.': {
72
- precedence: 9,
73
- operator: '.',
74
- action: 'dot',
75
- isPrefix: false,
76
- isPostfix: false,
77
- leftAssoc: false,
78
- iterates: false,
79
- },
80
- '!!': {
81
- precedence: 7,
82
- operator: '!!',
83
- action: 'doubleFactorial',
84
- isPrefix: false,
85
- isPostfix: true,
86
- leftAssoc: false,
87
- iterates: true,
88
- },
89
- '!': {
90
- precedence: 7,
91
- operator: '!',
92
- action: 'factorial',
93
- isPrefix: false,
94
- isPostfix: true,
95
- leftAssoc: false,
96
- iterates: true,
97
- },
98
- '^': {
99
- precedence: 6,
100
- operator: '^',
101
- action: 'pow',
102
- isPrefix: false,
103
- isPostfix: false,
104
- leftAssoc: false,
105
- iterates: true,
106
- },
107
- '**': {
108
- precedence: 6,
109
- operator: '**',
110
- action: 'pow',
111
- isPrefix: false,
112
- isPostfix: false,
113
- leftAssoc: false,
114
- iterates: true,
115
- },
29
+ '.': { precedence: 9, operator: '.', action: 'dot', isPrefix: false, isPostfix: false, leftAssoc: false, iterates: false },
30
+ '!!': { precedence: 7, operator: '!!', action: 'doubleFactorial', isPrefix: false, isPostfix: true, leftAssoc: false, iterates: true },
31
+ '!': { precedence: 7, operator: '!', action: 'factorial', isPrefix: false, isPostfix: true, leftAssoc: false, iterates: true },
32
+ '^': { precedence: 6, operator: '^', action: 'pow', isPrefix: false, isPostfix: false, leftAssoc: false, iterates: true },
33
+ '**': { precedence: 6, operator: '**', action: 'pow', isPrefix: false, isPostfix: false, leftAssoc: false, iterates: true },
116
34
  '%': {
117
- precedence: 4,
118
- operator: '%',
119
- action: 'mod',
120
- isPrefix: false,
121
- isPostfix: false,
122
- leftAssoc: true,
123
- iterates: true,
124
- postfixVariant: {
125
- precedence: 7,
126
- operator: '%',
127
- action: 'percent',
128
- isPrefix: false,
129
- isPostfix: true,
130
- leftAssoc: false,
131
- iterates: true,
132
- },
133
- },
134
- '*': {
135
- precedence: 4,
136
- operator: '*',
137
- action: 'times',
138
- isPrefix: false,
139
- isPostfix: false,
140
- leftAssoc: true,
141
- iterates: true,
142
- },
143
- '/': {
144
- precedence: 4,
145
- operator: '/',
146
- action: 'div',
147
- isPrefix: false,
148
- isPostfix: false,
149
- leftAssoc: true,
150
- iterates: true,
151
- },
152
- '+': {
153
- precedence: 3,
154
- operator: '+',
155
- action: 'plus',
156
- isPrefix: true,
157
- isPostfix: false,
158
- leftAssoc: true,
159
- iterates: true,
160
- },
161
- '-': {
162
- precedence: 3,
163
- operator: '-',
164
- action: 'minus',
165
- isPrefix: true,
166
- isPostfix: false,
167
- leftAssoc: true,
168
- iterates: true,
169
- },
170
- '=': {
171
- precedence: 2,
172
- operator: '=',
173
- action: 'setEqual',
174
- assertiveAction: 'assertEQ',
175
- isPrefix: false,
176
- isPostfix: false,
177
- leftAssoc: true,
178
- iterates: false,
179
- },
180
- '==': {
181
- precedence: 1,
182
- operator: '==',
183
- action: 'eq',
184
- assertiveAction: 'assertEQ',
185
- isPrefix: false,
186
- isPostfix: false,
187
- leftAssoc: true,
188
- iterates: false,
189
- },
190
- '<': {
191
- precedence: 1,
192
- operator: '<',
193
- action: 'lt',
194
- assertiveAction: 'assertLT',
195
- isPrefix: false,
196
- isPostfix: false,
197
- leftAssoc: true,
198
- iterates: false,
199
- },
200
- '<=': {
201
- precedence: 1,
202
- operator: '<=',
203
- action: 'lte',
204
- assertiveAction: 'assertLTE',
205
- isPrefix: false,
206
- isPostfix: false,
207
- leftAssoc: true,
208
- iterates: false,
209
- },
210
- '>': {
211
- precedence: 1,
212
- operator: '>',
213
- action: 'gt',
214
- assertiveAction: 'assertGT',
215
- isPrefix: false,
216
- isPostfix: false,
217
- leftAssoc: true,
218
- iterates: false,
219
- },
220
- '>=': {
221
- precedence: 1,
222
- operator: '>=',
223
- action: 'gte',
224
- assertiveAction: 'assertGTE',
225
- isPrefix: false,
226
- isPostfix: false,
227
- leftAssoc: true,
228
- iterates: false,
229
- },
230
- '=>': {
231
- precedence: 0,
232
- operator: '=>',
233
- action: 'mapTo',
234
- isPrefix: false,
235
- isPostfix: false,
236
- leftAssoc: true,
237
- iterates: false,
238
- },
239
- ',': {
240
- precedence: 0,
241
- operator: ',',
242
- action: 'comma',
243
- isPrefix: false,
244
- isPostfix: false,
245
- leftAssoc: true,
246
- iterates: false,
247
- },
35
+ precedence: 4, operator: '%', action: 'mod', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: true,
36
+ postfixVariant: { precedence: 7, operator: '%', action: 'percent', isPrefix: false, isPostfix: true, leftAssoc: false, iterates: true },
37
+ },
38
+ '*': { precedence: 4, operator: '*', action: 'times', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: true },
39
+ '/': { precedence: 4, operator: '/', action: 'div', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: true },
40
+ '+': { precedence: 3, operator: '+', action: 'plus', isPrefix: true, isPostfix: false, leftAssoc: true, iterates: true },
41
+ '-': { precedence: 3, operator: '-', action: 'minus', isPrefix: true, isPostfix: false, leftAssoc: true, iterates: true },
42
+ '=': { precedence: 2, operator: '=', action: 'setEqual', assertiveAction: 'assertEQ', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
43
+ '==': { precedence: 1, operator: '==', action: 'eq', assertiveAction: 'assertEQ', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
44
+ '<': { precedence: 1, operator: '<', action: 'lt', assertiveAction: 'assertLT', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
45
+ '<=': { precedence: 1, operator: '<=', action: 'lte', assertiveAction: 'assertLTE', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
46
+ '>': { precedence: 1, operator: '>', action: 'gt', assertiveAction: 'assertGT', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
47
+ '>=': { precedence: 1, operator: '>=', action: 'gte', assertiveAction: 'assertGTE', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
48
+ '=>': { precedence: 0, operator: '=>', action: 'mapTo', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
49
+ ',': { precedence: 0, operator: ',', action: 'comma', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
248
50
  ':': {
249
51
  precedence: 0,
250
52
  operator: ':',
@@ -254,6 +56,7 @@ exports.operators = {
254
56
  leftAssoc: true,
255
57
  iterates: false,
256
58
  deferLHSResolution: true,
59
+ deferRHSResolution: true,
257
60
  },
258
61
  ':=': {
259
62
  precedence: 0,
@@ -266,14 +69,6 @@ exports.operators = {
266
69
  deferLHSResolution: true,
267
70
  deferRHSResolution: true,
268
71
  },
269
- in: {
270
- precedence: 0,
271
- operator: 'in',
272
- action: 'in',
273
- isPrefix: false,
274
- isPostfix: false,
275
- leftAssoc: true,
276
- iterates: false,
277
- },
72
+ in: { precedence: 0, operator: 'in', action: 'in', isPrefix: false, isPostfix: false, leftAssoc: true, iterates: false },
278
73
  };
279
74
  exports.ASSERTIVE_FUNCTIONS = ['assume'];
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseConverter = void 0;
4
4
  const Expression_1 = require("../classes/expression/Expression");
5
+ const shortcuts_1 = require("../classes/expression/shortcuts");
5
6
  const constants_1 = require("../classes/parser/constants");
6
7
  const errors_1 = require("../errors");
7
8
  const modes = {
@@ -85,7 +86,7 @@ class BaseConverter {
85
86
  return [a[0] + b[0], a[1] + b[1]];
86
87
  }
87
88
  static strip(input) {
88
- const arg = new Expression_1.Expression(input);
89
+ const arg = input.copy();
89
90
  delete arg.power;
90
91
  delete arg.multiplier;
91
92
  return arg;
@@ -247,7 +248,7 @@ class BaseConverter {
247
248
  // Preserve them verbatim instead of trying to move them into the denominator.
248
249
  const isComplexPower = pExpr.isComplex();
249
250
  const power = isComplexPower ? pExpr : pExpr.signFree();
250
- const isInverted = !isComplexPower && (pExpr.lt(0) || pExpr.sign() === -1);
251
+ const isInverted = !isComplexPower && (pExpr.lt((0, shortcuts_1.zero)()) || pExpr.sign() === -1);
251
252
  const isNegative = input.getMultiplier().isNegative();
252
253
  const m = input.getMultiplier().abs();
253
254
  const multiplierArray = ['', ''];
@@ -12,6 +12,7 @@ const ValuesSet_1 = require("../classes/valuesSet/ValuesSet");
12
12
  const Vector_1 = require("../classes/vector/Vector");
13
13
  const Scope_1 = require("../common/classes/Scope");
14
14
  const dispatch_1 = require("../dispatch");
15
+ const errors_1 = require("../errors");
15
16
  const BaseConverter_1 = require("./BaseConverter");
16
17
  const { TeX, TEXT } = BaseConverter_1.BaseConverter.modes;
17
18
  /**
@@ -203,7 +204,7 @@ class Converter extends BaseConverter_1.BaseConverter {
203
204
  else if (item.type === Token_1.Token.FUNCTION) {
204
205
  const argsScope = rpn[++i];
205
206
  if (!Scope_1.Scope.isScope(argsScope)) {
206
- throw new Error(`Missing argument scope for function ${item.value}`);
207
+ throw new Error((0, errors_1.message)('converterMissingArgumentScope', { function: item.value }));
207
208
  }
208
209
  let args = [];
209
210
  if (argsScope.length > 0) {
@@ -244,7 +245,7 @@ class Converter extends BaseConverter_1.BaseConverter {
244
245
  else if (item.type === Token_1.Token.PREFIX) {
245
246
  const operand = stack.pop();
246
247
  if (!operand) {
247
- throw new Error(`Missing operand for prefix operator ${item.value}`);
248
+ throw new Error((0, errors_1.message)('converterMissingPrefixOperand', { operator: item.value }));
248
249
  }
249
250
  stack.push({
250
251
  text: item.value + operand.text,
@@ -255,7 +256,7 @@ class Converter extends BaseConverter_1.BaseConverter {
255
256
  const operator = item.resolvedOperator ?? Parser_1.Parser.getOperator(item.value);
256
257
  const right = stack.pop();
257
258
  if (!operator || !right) {
258
- throw new Error(`Missing operand or metadata for operator ${item.value}`);
259
+ throw new Error((0, errors_1.message)('converterMissingOperandMetadata', { operator: item.value }));
259
260
  }
260
261
  if (operator.isPostfix) {
261
262
  const symbol = item.value === '%' ? '\\%' : item.value;
@@ -267,7 +268,7 @@ class Converter extends BaseConverter_1.BaseConverter {
267
268
  }
268
269
  const left = stack.pop();
269
270
  if (!left) {
270
- throw new Error(`Missing left operand for operator ${item.value}`);
271
+ throw new Error((0, errors_1.message)('converterMissingLeftOperand', { operator: item.value }));
271
272
  }
272
273
  if (operator.action === 'comma') {
273
274
  const args = [...(left.args ?? [left]), ...(right.args ?? [right])];
@@ -324,7 +325,7 @@ class Converter extends BaseConverter_1.BaseConverter {
324
325
  }
325
326
  }
326
327
  if (stack.length !== 1) {
327
- throw new Error('Unable to convert source expression to TeX');
328
+ throw new Error((0, errors_1.message)('converterTexConversionFailed'));
328
329
  }
329
330
  const retval = stack[0];
330
331
  return retval;
@@ -401,9 +402,12 @@ class Converter extends BaseConverter_1.BaseConverter {
401
402
  return `\\mathrm${this.inBraces(Expression_1.Expression.LOG)}${subscript}${this.inBrackets(output[0])}`;
402
403
  },
403
404
  [Expression_1.Expression.LOG10]: () => `\\mathrm${this.inBraces(Expression_1.Expression.LOG)}_${this.inBraces('10')}${this.inBrackets(output[0])}`,
405
+ log10: () => `\\mathrm${this.inBraces(Expression_1.Expression.LOG)}_${this.inBraces('10')}${this.inBrackets(output[0])}`,
404
406
  // Special functions
405
407
  exp: std,
406
408
  gamma: () => `\\Gamma${this.inBrackets(output[0])}`,
409
+ gamma_incomplete: () => `\\Gamma${this.inBrackets(output.join(','), 'parens')}`,
410
+ gamma_incomplete_lower: () => `\\gamma${this.inBrackets(output.join(','), 'parens')}`,
407
411
  erf: std,
408
412
  erfc: std,
409
413
  sinc: std,
@@ -121,7 +121,7 @@ class Pattern extends BaseConverter_1.BaseConverter {
121
121
  // return input.isSum() || input.isEXP();
122
122
  }
123
123
  setMultiplier(m, multiplierArray, _input, _options) {
124
- const ref = this.createConstantReference(new Expression_1.Expression(m));
124
+ const ref = this.createConstantReference(Expression_1.Expression.create(m));
125
125
  this.multiplier = ref;
126
126
  multiplierArray[0] = ref;
127
127
  }
@@ -29,6 +29,24 @@ export interface MathFunctionEntry {
29
29
  /** Whether this function was registered at the system or user level */
30
30
  level: ParserRegistrationLevel;
31
31
  }
32
+ /**
33
+ * Registers a system-level function in the dispatch table. Registered functions can use
34
+ * narrower parameter types, so `RegisteredMathFunction` does not define a common argument
35
+ * type. Dynamic invocation is handled by `callFunction`.
36
+ */
37
+ export declare function systemFunction(opts: {
38
+ fn: RegisteredMathFunction;
39
+ minArgs: number;
40
+ maxArgs: number;
41
+ maxPrecision?: number;
42
+ equationArgs?: number[];
43
+ distElWise: boolean;
44
+ deferArguments?: boolean;
45
+ normalizeDeferredArguments?: (argumentScopes: Scope[]) => Scope[];
46
+ bracketlessStatement?: boolean;
47
+ returnBoundary?: boolean;
48
+ usage?: ParserUsage;
49
+ }): MathFunctionEntry;
32
50
  export declare const mathFunctionRegistry: {
33
51
  [functionName: string]: MathFunctionEntry;
34
52
  };