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.
- package/BREAKING_CHANGES.md +244 -0
- package/README.md +168 -229
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.LICENSE.txt +6 -6
- package/output/algebra/adapters.d.ts +3 -33
- package/output/algebra/adapters.js +7 -105
- package/output/algebra/algorithms/arith.js +10 -9
- package/output/algebra/algorithms/groebnerBase.d.ts +24 -20
- package/output/algebra/algorithms/groebnerBase.js +486 -723
- package/output/algebra/dispatch.d.ts +1 -0
- package/output/algebra/dispatch.js +25 -0
- package/output/algebra/factor/factor.d.ts +15 -0
- package/output/algebra/factor/factor.js +99 -12
- package/output/algebra/gcd/gcd.d.ts +8 -7
- package/output/algebra/gcd/gcd.js +32 -78
- package/output/algebra/groebner.d.ts +2 -2
- package/output/algebra/groebner.js +6 -12
- package/output/algebra/partfrac.d.ts +3 -3
- package/output/algebra/partfrac.js +28 -61
- package/output/algebra/polynomial/ModularSparsePolynomial.d.ts +131 -0
- package/output/algebra/polynomial/ModularSparsePolynomial.js +378 -0
- package/output/algebra/polynomial/ModularSparsePolynomialFactor.d.ts +40 -0
- package/output/algebra/polynomial/ModularSparsePolynomialFactor.js +661 -0
- package/output/algebra/polynomial/SparsePolynomialFactor.d.ts +64 -0
- package/output/algebra/polynomial/SparsePolynomialFactor.js +492 -0
- package/output/algebra/polynomial/SparsePolynomialGcd.d.ts +29 -0
- package/output/algebra/polynomial/SparsePolynomialGcd.js +259 -0
- package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.d.ts +82 -0
- package/output/algebra/polynomial/SparsePolynomialMultivariateFactor.js +604 -0
- package/output/algebra/polynomial/modularGcd.d.ts +40 -0
- package/output/algebra/polynomial/modularGcd.js +365 -0
- package/output/algebra/polynomialize.js +4 -2
- package/output/algebra/simplify/funcsimp.js +1 -1
- package/output/algebra/simplify/ratsimp.js +1 -1
- package/output/algebra/simplify/simplify.js +11 -2
- package/output/algebra/utils.d.ts +1 -1
- package/output/algebra/utils.js +3 -3
- package/output/api/advanced.d.ts +2 -1
- package/output/api/advanced.js +3 -3
- package/output/api/algebra.d.ts +21 -4
- package/output/api/algebra.js +22 -3
- package/output/api/assumptions.d.ts +1 -1
- package/output/api/assumptions.js +2 -1
- package/output/api/calculus.d.ts +2 -1
- package/output/api/calculus.js +2 -1
- package/output/api/core.d.ts +28 -7
- package/output/api/core.js +28 -2
- package/output/api/languages/deu.d.ts +3 -0
- package/output/api/languages/deu.js +266 -0
- package/output/api/languages/fra.d.ts +3 -0
- package/output/api/languages/fra.js +266 -0
- package/output/api/languages/ita.d.ts +3 -0
- package/output/api/languages/ita.js +266 -0
- package/output/api/languages/nld.d.ts +3 -0
- package/output/api/languages/nld.js +266 -0
- package/output/api/languages/por.d.ts +3 -0
- package/output/api/languages/por.js +266 -0
- package/output/api/languages/spa.d.ts +3 -0
- package/output/api/languages/spa.js +266 -0
- package/output/api/parser.d.ts +10 -2
- package/output/api/parser.js +2 -0
- package/output/api/solve.d.ts +1 -1
- package/output/api/solve.js +2 -1
- package/output/api/structures.d.ts +1 -1
- package/output/api/structures.js +2 -1
- package/output/calculus/adapters.d.ts +8 -0
- package/output/calculus/adapters.js +41 -0
- package/output/calculus/derivative/diff.js +6 -3
- package/output/calculus/dispatch.d.ts +1 -0
- package/output/calculus/dispatch.js +25 -0
- package/output/calculus/integrate/integrate.js +4 -4
- package/output/calculus/integrate/integrationTable.js +16 -16
- package/output/calculus/laplace/ilaplace.js +1 -1
- package/output/calculus/laplace/ilaplaceTable.js +18 -17
- package/output/calculus/laplace/laplaceTable.js +3 -2
- package/output/calculus/limit/limit.js +1 -1
- package/output/core/classes/assumption/Assumption.js +14 -10
- package/output/core/classes/assumption/assume.d.ts +6 -0
- package/output/core/classes/assumption/assume.js +9 -0
- package/output/core/classes/assumption/dispatch.d.ts +1 -0
- package/output/core/classes/assumption/dispatch.js +11 -0
- package/output/core/classes/collection/Collection.js +11 -2
- package/output/core/classes/complex/Complex.d.ts +10 -0
- package/output/core/classes/complex/Complex.js +19 -1
- package/output/core/classes/decimalSet/DecimalSet.js +5 -4
- package/output/core/classes/dictionary/Dictionary.js +4 -1
- package/output/core/classes/expression/CoeffObject.d.ts +1 -1
- package/output/core/classes/expression/CoeffObject.js +1 -2
- package/output/core/classes/expression/Expression.d.ts +35 -26
- package/output/core/classes/expression/Expression.js +77 -50
- package/output/core/classes/expression/analysis.d.ts +1 -1
- package/output/core/classes/expression/analysis.js +7 -7
- package/output/core/classes/expression/format.d.ts +9 -0
- package/output/core/classes/expression/format.js +130 -7
- package/output/core/classes/expression/utils.d.ts +9 -0
- package/output/core/classes/expression/utils.js +52 -6
- package/output/core/classes/matrix/Matrix.d.ts +2 -3
- package/output/core/classes/matrix/Matrix.js +26 -23
- package/output/core/classes/matrix/dispatch.d.ts +1 -0
- package/output/core/classes/matrix/dispatch.js +19 -0
- package/output/core/classes/matrix/functions.d.ts +2 -0
- package/output/core/classes/matrix/functions.js +5 -0
- package/output/core/classes/parser/Parser.d.ts +31 -5
- package/output/core/classes/parser/Parser.js +357 -444
- package/output/core/classes/parser/constants.d.ts +2 -0
- package/output/core/classes/parser/constants.js +4 -2
- package/output/core/classes/parser/controlFlowSignals.d.ts +38 -0
- package/output/core/classes/parser/controlFlowSignals.js +60 -0
- package/output/core/classes/parser/operations/add.js +14 -16
- package/output/core/classes/parser/operations/compare.js +13 -0
- package/output/core/classes/parser/operations/functions.d.ts +3 -4
- package/output/core/classes/parser/operations/functions.js +48 -102
- package/output/core/classes/parser/operations/multiply.js +22 -15
- package/output/core/classes/parser/operations/power.js +11 -11
- package/output/core/classes/parser/operations/subtract.js +2 -1
- package/output/core/classes/parser/preprocess.d.ts +0 -7
- package/output/core/classes/parser/preprocess.js +33 -39
- package/output/core/classes/parser/scripting/controlFlow.d.ts +4 -102
- package/output/core/classes/parser/scripting/controlFlow.js +134 -186
- package/output/core/classes/parser/scripting/deferred.d.ts +4 -0
- package/output/core/classes/parser/scripting/deferred.js +65 -0
- package/output/core/classes/parser/scripting/dispatch.d.ts +1 -0
- package/output/core/classes/parser/scripting/dispatch.js +62 -0
- package/output/core/classes/parser/scripting/evaluate.d.ts +13 -0
- package/output/core/classes/parser/scripting/evaluate.js +17 -1
- package/output/core/classes/parser/scripting/scope.d.ts +1 -28
- package/output/core/classes/parser/scripting/scope.js +36 -40
- package/output/core/classes/parser/types.d.ts +5 -5
- package/output/core/classes/parser/wrappers/IndexedReference.d.ts +4 -3
- package/output/core/classes/parser/wrappers/IndexedReference.js +8 -0
- package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +2 -2
- package/output/core/classes/polynomial/Polynomial.d.ts +5 -1
- package/output/core/classes/polynomial/Polynomial.js +53 -7
- package/output/core/classes/polynomial/SparsePolynomial.d.ts +221 -0
- package/output/core/classes/polynomial/SparsePolynomial.js +824 -0
- package/output/core/classes/polynomial/SparsePolynomialAdapter.d.ts +56 -0
- package/output/core/classes/polynomial/SparsePolynomialAdapter.js +241 -0
- package/output/core/classes/polynomial/Term.js +2 -2
- package/output/core/{adapters.d.ts → classes/polynomial/adapters.d.ts} +2 -2
- package/output/core/classes/polynomial/adapters.js +33 -0
- package/output/core/classes/polynomial/dispatch.d.ts +1 -0
- package/output/core/classes/polynomial/dispatch.js +14 -0
- package/output/core/classes/polynomial/functions.d.ts +8 -0
- package/output/core/classes/polynomial/functions.js +71 -8
- package/output/core/classes/polynomial/utils.js +2 -1
- package/output/core/classes/rational/Rational.d.ts +8 -11
- package/output/core/classes/rational/Rational.js +70 -20
- package/output/core/classes/seq/SEQ.js +4 -4
- package/output/core/classes/valuesSet/ValuesSet.d.ts +9 -1
- package/output/core/classes/valuesSet/ValuesSet.js +22 -4
- package/output/core/classes/vector/Vector.d.ts +2 -3
- package/output/core/classes/vector/Vector.js +11 -15
- package/output/core/classes/vector/dispatch.d.ts +1 -0
- package/output/core/classes/vector/dispatch.js +11 -0
- package/output/core/common/classes/MathematicalAggregate.js +11 -2
- package/output/core/common/classes/StructuredEntity.d.ts +0 -17
- package/output/core/common/classes/StructuredEntity.js +3 -64
- package/output/core/common/common.d.ts +0 -1
- package/output/core/common/common.js +29 -234
- package/output/core/converters/BaseConverter.js +3 -2
- package/output/core/converters/Converter.js +9 -5
- package/output/core/converters/Pattern.js +1 -1
- package/output/core/dispatch.d.ts +18 -0
- package/output/core/dispatch.js +3 -281
- package/output/core/errors.d.ts +259 -474
- package/output/core/errors.js +270 -542
- package/output/core/fullFunctions.d.ts +7 -0
- package/output/core/fullFunctions.js +31 -0
- package/output/core/functions/bigint/bigint.d.ts +13 -1
- package/output/core/functions/bigint/bigint.js +56 -4
- package/output/core/functions/bigint/primeFactor.d.ts +2 -0
- package/output/core/functions/bigint/primeFactor.js +13 -13
- package/output/core/functions/build/definitions.js +6 -0
- package/output/core/functions/complex.d.ts +2 -2
- package/output/core/functions/complex.dispatch.d.ts +1 -0
- package/output/core/functions/complex.dispatch.js +16 -0
- package/output/core/functions/complex.js +7 -7
- package/output/core/functions/decimal.js +2 -1
- package/output/core/functions/expand/expand.js +2 -2
- package/output/core/functions/numeric.d.ts +1 -1
- package/output/core/functions/string.js +2 -1
- package/output/core/functions/subst.js +21 -13
- package/output/core/parserFunctions.d.ts +7 -0
- package/output/core/parserFunctions.js +25 -0
- package/output/index.d.ts +50 -30
- package/output/index.js +147 -19
- package/output/math/defint/defint.d.ts +18 -0
- package/output/math/defint/defint.js +60 -0
- package/output/math/defint/defintDecimal.js +6 -5
- package/output/math/defint/defintNative.js +7 -18
- package/output/math/dispatch.d.ts +1 -0
- package/output/math/dispatch.js +101 -0
- package/output/math/geometry.d.ts +4 -0
- package/output/math/geometry.js +23 -0
- package/output/math/math.d.ts +59 -19
- package/output/math/math.js +244 -100
- package/output/math/trig.js +4 -4
- package/output/math/utils.d.ts +6 -0
- package/output/math/utils.js +39 -0
- package/output/solve/classes/PolynomialSolver.d.ts +33 -14
- package/output/solve/classes/PolynomialSolver.js +267 -67
- package/output/solve/classes/SolutionSet.d.ts +20 -1
- package/output/solve/classes/SolutionSet.js +82 -5
- package/output/solve/dispatch.d.ts +1 -0
- package/output/solve/dispatch.js +13 -0
- package/output/solve/linsolve.d.ts +2 -0
- package/output/solve/linsolve.js +13 -5
- package/output/solve/solve.d.ts +10 -0
- package/output/solve/solve.js +128 -20
- package/output/solve/solveSystem.d.ts +1 -1
- package/output/solve/solveSystem.js +8 -32
- package/output/solve/utils.d.ts +2 -1
- package/output/solve/utils.js +18 -22
- package/output/utils/array.d.ts +1 -1
- package/output/utils/debug.js +2 -1
- package/package.json +22 -38
- package/dist/parser.js +0 -2
- package/dist/parser.js.LICENSE.txt +0 -7
- package/docs-data/parser-functions.json +0 -1960
- package/output/algebra/algorithms/factor.d.ts +0 -3
- package/output/algebra/algorithms/factor.js +0 -5
- package/output/algebra/algorithms/factorMultivariate.d.ts +0 -23
- package/output/algebra/algorithms/factorMultivariate.js +0 -2393
- package/output/algebra/algorithms/factorUnivariate.d.ts +0 -72
- package/output/algebra/algorithms/factorUnivariate.js +0 -1072
- package/output/algebra/algorithms/gcd.d.ts +0 -22
- package/output/algebra/algorithms/gcd.js +0 -690
- package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +0 -137
- package/output/algebra/algorithms/multiPoly/MultiPoly.js +0 -346
- package/output/algebra/algorithms/poly.d.ts +0 -228
- package/output/algebra/algorithms/poly.js +0 -1299
- package/output/algebra/algorithms/rational.d.ts +0 -17
- package/output/algebra/algorithms/rational.js +0 -115
- package/output/core/adapters.js +0 -40
- package/output/core/classes/parser/operations/comma.d.ts +0 -7
- package/output/core/classes/parser/operations/comma.js +0 -11
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Breaking changes in Nerdamer 2.0
|
|
2
|
+
|
|
3
|
+
Nerdamer 2.0 is a TypeScript rewrite of Nerdamer. Normal expression-oriented usage remains intentionally familiar, but 2.0 is not a drop-in replacement for code that depends on Nerdamer 1.x internals, stored-expression state, add-on loading, or legacy JavaScript result shapes.
|
|
4
|
+
|
|
5
|
+
This document lists the compatibility changes that application authors should review when moving from Nerdamer 1.x to 2.0.
|
|
6
|
+
|
|
7
|
+
## Runtime and package layout
|
|
8
|
+
|
|
9
|
+
- Node.js 18 or newer is required.
|
|
10
|
+
- TypeScript declarations ship with the package.
|
|
11
|
+
- The old side-effect add-on loading model (`Algebra`, `Calculus`, `Solve`, and `Extra`) is not used in 2.0.
|
|
12
|
+
- The normal `nerdamer` entry point assembles the complete CAS.
|
|
13
|
+
- Supported direct package entry points include `nerdamer/core`, `nerdamer/algebra`, `nerdamer/calculus`, `nerdamer/solve`, `nerdamer/structures`, `nerdamer/assumptions`, `nerdamer/parser`, `nerdamer/advanced`, and `nerdamer/debug`.
|
|
14
|
+
- Browser builds are split into the complete `dist/bundle.js` target and the smaller `dist/parser.js` target.
|
|
15
|
+
|
|
16
|
+
The parser entry point is intentionally not the complete CAS. It registers the parser/core, scripting, assumptions, structures, polynomial, complex, and general math domains without importing the higher-level algebra, calculus, and solver domains.
|
|
17
|
+
|
|
18
|
+
## The main `nerdamer(...)` call
|
|
19
|
+
|
|
20
|
+
Nerdamer 1.x accepted additional arguments for post-parse behavior and stored-expression history:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
nerdamer(expression, substitutions?, option?, location?)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Nerdamer 2.0 uses:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
nerdamer(input, values?)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use methods on the returned entity instead of the old third argument:
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
// 1.x
|
|
36
|
+
nerdamer('(x+1)^3', undefined, 'expand');
|
|
37
|
+
|
|
38
|
+
// 2.0
|
|
39
|
+
nerdamer('(x+1)^3').expand();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The old location argument is gone because 2.0 does not maintain the 1.x global expression history.
|
|
43
|
+
|
|
44
|
+
## Stored expression history was removed
|
|
45
|
+
|
|
46
|
+
The following history-oriented 1.x APIs are not part of 2.0:
|
|
47
|
+
|
|
48
|
+
- `expressions()`
|
|
49
|
+
- `getExpression()`
|
|
50
|
+
- `getEquation()`
|
|
51
|
+
- `clear()`
|
|
52
|
+
- `flush()`
|
|
53
|
+
- `numExpressions()`
|
|
54
|
+
- `numEquations()`
|
|
55
|
+
|
|
56
|
+
Store parsed entities in normal JavaScript variables instead.
|
|
57
|
+
|
|
58
|
+
## Parser return types
|
|
59
|
+
|
|
60
|
+
Nerdamer 2.0 returns the Nerdamer entity represented by the input rather than wrapping every parser result as an `Expression`.
|
|
61
|
+
|
|
62
|
+
Scalar symbolic input normally returns `Expression`. Structured input can return `Equation`, `Vector`, `Matrix`, `Collection`, `ValuesSet`, or `Dictionary`. The TypeScript return type of the callable API is therefore `ParserEntity`.
|
|
63
|
+
|
|
64
|
+
Code that assumes every call returns an `Expression` must narrow the result when it accepts structured notation.
|
|
65
|
+
|
|
66
|
+
## Root API is explicit
|
|
67
|
+
|
|
68
|
+
Nerdamer 1.x exposed many registered parser/add-on functions automatically on the root `nerdamer` object. Nerdamer 2.0 has an explicit, tested root API instead.
|
|
69
|
+
|
|
70
|
+
Many compatibility names have been deliberately restored, including:
|
|
71
|
+
|
|
72
|
+
- algebra/calculus names such as `expand`, `factor`, `simplify`, `gcd`, `lcm`, `partfrac`, `diff`, `integrate`, `limit`, `laplace`, and `ilt`;
|
|
73
|
+
- trigonometric aliases such as `arccos`, `arcsin`, and `arctan`;
|
|
74
|
+
- `factorial`, `dfactorial`, `atan2`, `nthroot`, `min`, `max`, and `sinc`;
|
|
75
|
+
- `radians`, `degrees`, `log10`, `step`, `rect`, `tri`, `continued_fraction`, `gamma_incomplete`, and `gamma_incomplete_lower`;
|
|
76
|
+
- `scientific`, `pfactor`, `pfactord`, `parens`, `invert`, `roots`, `coeffs`, and `line`;
|
|
77
|
+
- `sqcomp`, `polyFactors`, `uSub`, `uUnSub`, `conjugate`, `csgn`, `isPrime`, and `nullspace`;
|
|
78
|
+
- `isReserved(name)` for the supported live reserved-name check.
|
|
79
|
+
|
|
80
|
+
Compatibility names are backed by the 2.0 implementations; they are not copies of the 1.x internals.
|
|
81
|
+
|
|
82
|
+
The statistics functions from the old `Extra` add-on were not recreated merely to preserve their names:
|
|
83
|
+
|
|
84
|
+
- `mean`
|
|
85
|
+
- `median`
|
|
86
|
+
- `mode`
|
|
87
|
+
- `smpvar`
|
|
88
|
+
- `variance`
|
|
89
|
+
- `smpstdev`
|
|
90
|
+
- `stdev`
|
|
91
|
+
- `zscore`
|
|
92
|
+
|
|
93
|
+
## Lower-level extension and inspection APIs
|
|
94
|
+
|
|
95
|
+
The following 1.x internal/extension hooks are not restored as public 2.0 APIs:
|
|
96
|
+
|
|
97
|
+
- `getCore()`
|
|
98
|
+
- `register()`
|
|
99
|
+
- `replaceFunction()`
|
|
100
|
+
- `tree()`
|
|
101
|
+
- `htmlTree()`
|
|
102
|
+
- `addPeeker()`
|
|
103
|
+
- `removePeeker()`
|
|
104
|
+
- `rpn()`
|
|
105
|
+
|
|
106
|
+
Use the supported package entry points and exported TypeScript classes for direct access to the 2.0 implementation. `setFunction()` remains available for user-defined symbolic functions.
|
|
107
|
+
|
|
108
|
+
`updateAPI()` still exists, but its role is narrower than in 1.x. The complete package uses it to connect a selected set of higher-level operations to parsed entities; it does not expose every registered parser function as a root method.
|
|
109
|
+
|
|
110
|
+
## Parser access changed
|
|
111
|
+
|
|
112
|
+
The old root helpers `parse()`, `reserved()`, `supported()`, `validateName()`, and `validVarName()` are not exposed in the same form.
|
|
113
|
+
|
|
114
|
+
`nerdamer.isReserved(name)` is supported, and parser APIs are available from `nerdamer/parser` instead of through the old `getCore().PARSER` object.
|
|
115
|
+
|
|
116
|
+
## Solver results
|
|
117
|
+
|
|
118
|
+
Single-variable solving returns a `SolutionSet`.
|
|
119
|
+
|
|
120
|
+
System solving returns a `Vector` containing a `Dictionary` for each solution rather than the nested JavaScript arrays used by older code.
|
|
121
|
+
|
|
122
|
+
The legacy `solveeqs` name remains as the compatibility alias for `solveSystem()`. `solveEquations` is not retained as a public 2.0 name.
|
|
123
|
+
|
|
124
|
+
Code that consumes solver results by indexing native arrays must be updated for the Nerdamer structures.
|
|
125
|
+
|
|
126
|
+
## Prime factorization return types
|
|
127
|
+
|
|
128
|
+
`pfactor(n)` returns a `Vector` containing repeated prime factors in ascending order.
|
|
129
|
+
|
|
130
|
+
For example:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
pfactor(100) -> [2,2,5,5]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`pfactord(n)` returns a `Dictionary` mapping each prime to its multiplicity:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
pfactord(100) -> {2=>2,5=>2}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Code expecting the older prime-factor representation should choose the form it actually needs.
|
|
143
|
+
|
|
144
|
+
## Expression and chaining behavior
|
|
145
|
+
|
|
146
|
+
The complete package adds selected operations to parser entities without making the core classes import the higher-level CAS modules. Chainable operations include differentiation, expansion, factorization, integration, numeric evaluation, simplification, and substitution where appropriate.
|
|
147
|
+
|
|
148
|
+
Operations on structured entities are applied according to the entity's supported semantics; scalar-only operations such as `buildFunction()` reject structured results.
|
|
149
|
+
|
|
150
|
+
Several familiar `Expression` conveniences are retained, including `latex()`, `isInfinity()`, `isFraction()`, `hasIntegral()`, `equals()`, and `solveFor()`.
|
|
151
|
+
|
|
152
|
+
`equals()` and `eq()` are not synonyms in 2.0: `equals()` constructs an `Equation`; `eq()` tests equality.
|
|
153
|
+
|
|
154
|
+
The following older methods were not restored automatically because the closest 2.0 operation is not semantically identical in every case:
|
|
155
|
+
|
|
156
|
+
- `isPolynomial()`
|
|
157
|
+
- `contains()`
|
|
158
|
+
- `operation()`
|
|
159
|
+
|
|
160
|
+
## Text output and formatting
|
|
161
|
+
|
|
162
|
+
The default symbolic `text()` representation preserves Nerdamer's normal canonical ordering. Presentation-oriented ordering is opt-in per call:
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
nerdamer('x^2+2*x+1').text();
|
|
166
|
+
// 1+2*x+x^2
|
|
167
|
+
|
|
168
|
+
nerdamer('x^2+2*x+1').text({ sort: true });
|
|
169
|
+
// x^2+2*x+1
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`TextOptions` is exported from the root package and `nerdamer/core`. Per-call sorting does not mutate the expression or change the process-wide `SORT_TERMS` setting.
|
|
173
|
+
|
|
174
|
+
Scientific formatting is also available per call. It preserves mathematical exactness rather than rounding a symbolic exponent into a different value.
|
|
175
|
+
|
|
176
|
+
## Assumptions
|
|
177
|
+
|
|
178
|
+
Assumption handling was rewritten around numeric interval assumptions. Assumptions are process-wide and participate in comparisons and sign-sensitive simplifications.
|
|
179
|
+
|
|
180
|
+
Repeated assumptions for a symbol are intersected. Contradictory assumptions are rejected rather than silently replacing the previous interval.
|
|
181
|
+
|
|
182
|
+
Use the public APIs from `nerdamer/assumptions` when assumptions need to be inspected, removed, or cleared.
|
|
183
|
+
|
|
184
|
+
## Scripting and no-result semantics
|
|
185
|
+
|
|
186
|
+
The scripting implementation has been rewritten. Assignments, local bindings, conditionals, loops, blocks, `return`, `break`, `continue`, and error-handling helpers operate on the 2.0 parser entity model.
|
|
187
|
+
|
|
188
|
+
A control-flow operation that intentionally produces no mathematical result is represented internally by a null signal. It is not represented by an empty `Vector`, and it is not a legitimate mathematical value that can be assigned accidentally. If an internal no-result signal escapes to a parser boundary where a value is required, it is converted to the corresponding localized error.
|
|
189
|
+
|
|
190
|
+
Code that depended on undocumented 1.x scripting internals should be revalidated rather than assuming identical control-flow behavior.
|
|
191
|
+
|
|
192
|
+
## Deferred simplification
|
|
193
|
+
|
|
194
|
+
The parser has a `DEFER_SIMPLIFICATION` mode intended for workflows that need to preserve an unevaluated parse structure, such as instructional tooling. It is not equivalent to the normal simplifying parser and has documented limitations. Code should not assume that deferred and normal parsing produce interchangeable internal trees.
|
|
195
|
+
|
|
196
|
+
## Numeric implementation
|
|
197
|
+
|
|
198
|
+
The numeric implementation has changed substantially. Nerdamer 2.0 uses native `BigInt` for large integers, Decimal.js for decimal arithmetic, exact rational arithmetic where possible, and rewritten complex-number handling.
|
|
199
|
+
|
|
200
|
+
Code that reached into undocumented 1.x numeric representations should use the public numeric classes and APIs instead.
|
|
201
|
+
|
|
202
|
+
## Polynomial, factorization, and Groebner internals
|
|
203
|
+
|
|
204
|
+
Polynomial representation, GCD, factorization, polynomial solving, and Groebner machinery have been substantially rewritten. These changes are implementation details for normal Nerdamer notation, but they are breaking for applications that imported or depended on undocumented 1.x algorithm internals.
|
|
205
|
+
|
|
206
|
+
Use the supported `nerdamer/algebra`, `nerdamer/solve`, and `nerdamer/advanced` entry points for direct algorithm access.
|
|
207
|
+
|
|
208
|
+
## Browser builds and localization
|
|
209
|
+
|
|
210
|
+
The browser build now has explicit complete and parser targets. Build-time language selection supports:
|
|
211
|
+
|
|
212
|
+
- `eng`
|
|
213
|
+
- `spa`
|
|
214
|
+
- `fra`
|
|
215
|
+
- `deu`
|
|
216
|
+
- `por`
|
|
217
|
+
- `ita`
|
|
218
|
+
- `nld`
|
|
219
|
+
- `all`
|
|
220
|
+
|
|
221
|
+
English is the default. The selected language set affects bundled localized error messages.
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
Nerdamer 2.0 is licensed under the Apache License 2.0. Nerdamer 1.x releases used the MIT License.
|
|
226
|
+
|
|
227
|
+
## Migration checklist
|
|
228
|
+
|
|
229
|
+
For an existing Nerdamer 1.x application:
|
|
230
|
+
|
|
231
|
+
1. Remove side-effect imports of `Algebra`, `Calculus`, `Solve`, and `Extra`.
|
|
232
|
+
2. Remove use of the third and fourth `nerdamer(...)` arguments.
|
|
233
|
+
3. Replace stored-expression-history APIs with normal application state.
|
|
234
|
+
4. Account for `ParserEntity` return types when input can produce structured values.
|
|
235
|
+
5. Update system-solver consumers for `Vector`/`Dictionary` results.
|
|
236
|
+
6. Replace direct use of 1.x internals with supported package entry points.
|
|
237
|
+
7. Check any old root helper against the documented 2.0 root API rather than assuming every registered parser function is exported.
|
|
238
|
+
8. Revalidate code that depends on numeric, polynomial, parser, assumptions, set, or scripting internals.
|
|
239
|
+
9. Choose the complete package or parser entry point/build according to the functionality actually required.
|
|
240
|
+
10. Run the application's own behavioral tests against 2.0 before upgrading production code.
|
|
241
|
+
|
|
242
|
+
For a more detailed side-by-side migration guide, see [`docs/MIGRATING_FROM_1X.md`](docs/MIGRATING_FROM_1X.md). Current documentation and examples are available at https://nerdamer.com/.
|
|
243
|
+
|
|
244
|
+
Source and issue tracking for the release are at https://github.com/jiggzson/nerdamer.
|