nerdamer 1.1.13 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +184 -0
- package/README.md +293 -312
- package/dist/bundle.js +2 -0
- package/dist/bundle.js.LICENSE.txt +7 -0
- package/dist/parser.js +2 -0
- package/dist/parser.js.LICENSE.txt +7 -0
- package/docs-data/parser-functions.json +1960 -0
- package/index.d.ts +10 -426
- package/output/algebra/adapters.d.ts +33 -0
- package/output/algebra/adapters.js +109 -0
- package/output/algebra/algorithms/arith.d.ts +84 -0
- package/output/algebra/algorithms/arith.js +323 -0
- package/output/algebra/algorithms/factor.d.ts +3 -0
- package/output/algebra/algorithms/factor.js +5 -0
- package/output/algebra/algorithms/factorMultivariate.d.ts +23 -0
- package/output/algebra/algorithms/factorMultivariate.js +2393 -0
- package/output/algebra/algorithms/factorUnivariate.d.ts +72 -0
- package/output/algebra/algorithms/factorUnivariate.js +1072 -0
- package/output/algebra/algorithms/gcd.d.ts +22 -0
- package/output/algebra/algorithms/gcd.js +690 -0
- package/output/algebra/algorithms/groebnerBase.d.ts +157 -0
- package/output/algebra/algorithms/groebnerBase.js +1166 -0
- package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +137 -0
- package/output/algebra/algorithms/multiPoly/MultiPoly.js +346 -0
- package/output/algebra/algorithms/poly.d.ts +228 -0
- package/output/algebra/algorithms/poly.js +1299 -0
- package/output/algebra/algorithms/rational.d.ts +17 -0
- package/output/algebra/algorithms/rational.js +115 -0
- package/output/algebra/factor/factor.d.ts +62 -0
- package/output/algebra/factor/factor.js +158 -0
- package/output/algebra/gcd/gcd.d.ts +29 -0
- package/output/algebra/gcd/gcd.js +141 -0
- package/output/algebra/groebner.d.ts +21 -0
- package/output/algebra/groebner.js +42 -0
- package/output/algebra/partfrac.d.ts +19 -0
- package/output/algebra/partfrac.js +398 -0
- package/output/algebra/polynomialize.d.ts +20 -0
- package/output/algebra/polynomialize.js +24 -0
- package/output/algebra/simplify/complexsimp.d.ts +7 -0
- package/output/algebra/simplify/complexsimp.js +24 -0
- package/output/algebra/simplify/factorCommon.d.ts +13 -0
- package/output/algebra/simplify/factorCommon.js +136 -0
- package/output/algebra/simplify/funcsimp.d.ts +26 -0
- package/output/algebra/simplify/funcsimp.js +633 -0
- package/output/algebra/simplify/invtrigrewrite.d.ts +10 -0
- package/output/algebra/simplify/invtrigrewrite.js +96 -0
- package/output/algebra/simplify/ratsimp.d.ts +21 -0
- package/output/algebra/simplify/ratsimp.js +140 -0
- package/output/algebra/simplify/simplify.d.ts +25 -0
- package/output/algebra/simplify/simplify.js +228 -0
- package/output/algebra/simplify/trigreduce.d.ts +38 -0
- package/output/algebra/simplify/trigreduce.js +424 -0
- package/output/algebra/simplify/trigrewrite.d.ts +17 -0
- package/output/algebra/simplify/trigrewrite.js +156 -0
- package/output/algebra/simplify/trigsimp.d.ts +11 -0
- package/output/algebra/simplify/trigsimp.js +369 -0
- package/output/algebra/simplify/utils.d.ts +32 -0
- package/output/algebra/simplify/utils.js +56 -0
- package/output/algebra/utils.d.ts +32 -0
- package/output/algebra/utils.js +48 -0
- package/output/api/advanced.d.ts +7 -0
- package/output/api/advanced.js +18 -0
- package/output/api/algebra.d.ts +17 -0
- package/output/api/algebra.js +32 -0
- package/output/api/assumptions.d.ts +4 -0
- package/output/api/assumptions.js +11 -0
- package/output/api/calculus.d.ts +9 -0
- package/output/api/calculus.js +21 -0
- package/output/api/core.d.ts +17 -0
- package/output/api/core.js +41 -0
- package/output/api/debug.d.ts +16 -0
- package/output/api/debug.js +23 -0
- package/output/api/parser.d.ts +85 -0
- package/output/api/parser.js +16 -0
- package/output/api/solve.d.ts +10 -0
- package/output/api/solve.js +16 -0
- package/output/api/structures.d.ts +10 -0
- package/output/api/structures.js +22 -0
- package/output/calculus/derivative/diff.d.ts +30 -0
- package/output/calculus/derivative/diff.js +238 -0
- package/output/calculus/fresnel.d.ts +16 -0
- package/output/calculus/fresnel.js +39 -0
- package/output/calculus/integrate/byParts.d.ts +18 -0
- package/output/calculus/integrate/byParts.js +339 -0
- package/output/calculus/integrate/bySubstitution.d.ts +135 -0
- package/output/calculus/integrate/bySubstitution.js +411 -0
- package/output/calculus/integrate/integrate.d.ts +38 -0
- package/output/calculus/integrate/integrate.js +652 -0
- package/output/calculus/integrate/integrationTable.d.ts +2 -0
- package/output/calculus/integrate/integrationTable.js +914 -0
- package/output/calculus/integrate/utils.d.ts +28 -0
- package/output/calculus/integrate/utils.js +96 -0
- package/output/calculus/laplace/ilaplace.d.ts +31 -0
- package/output/calculus/laplace/ilaplace.js +192 -0
- package/output/calculus/laplace/ilaplaceTable.d.ts +2 -0
- package/output/calculus/laplace/ilaplaceTable.js +200 -0
- package/output/calculus/laplace/laplace.d.ts +22 -0
- package/output/calculus/laplace/laplace.js +109 -0
- package/output/calculus/laplace/laplaceTable.d.ts +2 -0
- package/output/calculus/laplace/laplaceTable.js +187 -0
- package/output/calculus/limit/limit.d.ts +35 -0
- package/output/calculus/limit/limit.js +1183 -0
- package/output/calculus/limit/limitsTable.d.ts +2 -0
- package/output/calculus/limit/limitsTable.js +7 -0
- package/output/core/Settings.d.ts +32 -0
- package/output/core/Settings.js +68 -0
- package/output/core/adapters.d.ts +18 -0
- package/output/core/adapters.js +40 -0
- package/output/core/classes/assumption/Assumption.d.ts +218 -0
- package/output/core/classes/assumption/Assumption.js +605 -0
- package/output/core/classes/assumption/assertiveFunctions.d.ts +6 -0
- package/output/core/classes/assumption/assertiveFunctions.js +64 -0
- package/output/core/classes/assumption/assume.d.ts +90 -0
- package/output/core/classes/assumption/assume.js +145 -0
- package/output/core/classes/collection/Collection.d.ts +107 -0
- package/output/core/classes/collection/Collection.js +231 -0
- package/output/core/classes/complex/Complex.d.ts +99 -0
- package/output/core/classes/complex/Complex.js +135 -0
- package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
- package/output/core/classes/decimalSet/DecimalSet.js +453 -0
- package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
- package/output/core/classes/dictionary/Dictionary.js +213 -0
- package/output/core/classes/equation/Equation.d.ts +256 -0
- package/output/core/classes/equation/Equation.js +350 -0
- package/output/core/classes/expression/CoeffObject.d.ts +100 -0
- package/output/core/classes/expression/CoeffObject.js +198 -0
- package/output/core/classes/expression/Expression.d.ts +1674 -0
- package/output/core/classes/expression/Expression.js +2332 -0
- package/output/core/classes/expression/analysis.d.ts +25 -0
- package/output/core/classes/expression/analysis.js +218 -0
- package/output/core/classes/expression/collect.d.ts +9 -0
- package/output/core/classes/expression/collect.js +49 -0
- package/output/core/classes/expression/format.d.ts +45 -0
- package/output/core/classes/expression/format.js +217 -0
- package/output/core/classes/expression/products.d.ts +23 -0
- package/output/core/classes/expression/products.js +115 -0
- package/output/core/classes/expression/shortcuts.d.ts +35 -0
- package/output/core/classes/expression/shortcuts.js +129 -0
- package/output/core/classes/expression/traversal.d.ts +31 -0
- package/output/core/classes/expression/traversal.js +216 -0
- package/output/core/classes/expression/trig.d.ts +25 -0
- package/output/core/classes/expression/trig.js +40 -0
- package/output/core/classes/expression/utils.d.ts +52 -0
- package/output/core/classes/expression/utils.js +189 -0
- package/output/core/classes/lookupTable/LookupTable.d.ts +12 -0
- package/output/core/classes/lookupTable/LookupTable.js +55 -0
- package/output/core/classes/matrix/Matrix.d.ts +227 -0
- package/output/core/classes/matrix/Matrix.js +889 -0
- package/output/core/classes/matrix/Sylvester.d.ts +11 -0
- package/output/core/classes/matrix/Sylvester.js +54 -0
- package/output/core/classes/matrix/functions.d.ts +26 -0
- package/output/core/classes/matrix/functions.js +52 -0
- package/output/core/classes/matrix/utils.d.ts +9 -0
- package/output/core/classes/matrix/utils.js +22 -0
- package/output/core/classes/parser/Parser.d.ts +480 -0
- package/output/core/classes/parser/Parser.js +1812 -0
- package/output/core/classes/parser/Token.d.ts +58 -0
- package/output/core/classes/parser/Token.js +137 -0
- package/output/core/classes/parser/constants.d.ts +160 -0
- package/output/core/classes/parser/constants.js +227 -0
- package/output/core/classes/parser/helpers.d.ts +21 -0
- package/output/core/classes/parser/helpers.js +42 -0
- package/output/core/classes/parser/operations/add.d.ts +15 -0
- package/output/core/classes/parser/operations/add.js +238 -0
- package/output/core/classes/parser/operations/comma.d.ts +7 -0
- package/output/core/classes/parser/operations/comma.js +11 -0
- package/output/core/classes/parser/operations/compare.d.ts +21 -0
- package/output/core/classes/parser/operations/compare.js +461 -0
- package/output/core/classes/parser/operations/divide.d.ts +2 -0
- package/output/core/classes/parser/operations/divide.js +72 -0
- package/output/core/classes/parser/operations/functions.d.ts +46 -0
- package/output/core/classes/parser/operations/functions.js +430 -0
- package/output/core/classes/parser/operations/multiply.d.ts +11 -0
- package/output/core/classes/parser/operations/multiply.js +321 -0
- package/output/core/classes/parser/operations/power.d.ts +48 -0
- package/output/core/classes/parser/operations/power.js +673 -0
- package/output/core/classes/parser/operations/subtract.d.ts +3 -0
- package/output/core/classes/parser/operations/subtract.js +35 -0
- package/output/core/classes/parser/preprocess.d.ts +14 -0
- package/output/core/classes/parser/preprocess.js +259 -0
- package/output/core/classes/parser/scripting/controlFlow.d.ts +121 -0
- package/output/core/classes/parser/scripting/controlFlow.js +355 -0
- package/output/core/classes/parser/scripting/evaluate.d.ts +10 -0
- package/output/core/classes/parser/scripting/evaluate.js +112 -0
- package/output/core/classes/parser/scripting/functions.d.ts +14 -0
- package/output/core/classes/parser/scripting/functions.js +59 -0
- package/output/core/classes/parser/scripting/scope.d.ts +35 -0
- package/output/core/classes/parser/scripting/scope.js +155 -0
- package/output/core/classes/parser/types.d.ts +125 -0
- package/output/core/classes/parser/types.js +2 -0
- package/output/core/classes/parser/wrappers/IndexedReference.d.ts +31 -0
- package/output/core/classes/parser/wrappers/IndexedReference.js +68 -0
- package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +24 -0
- package/output/core/classes/parser/wrappers/KeyValuePair.js +51 -0
- package/output/core/classes/polynomial/Polynomial.d.ts +500 -0
- package/output/core/classes/polynomial/Polynomial.js +1149 -0
- package/output/core/classes/polynomial/Term.d.ts +222 -0
- package/output/core/classes/polynomial/Term.js +430 -0
- package/output/core/classes/polynomial/functions.d.ts +69 -0
- package/output/core/classes/polynomial/functions.js +126 -0
- package/output/core/classes/polynomial/utils.d.ts +62 -0
- package/output/core/classes/polynomial/utils.js +206 -0
- package/output/core/classes/rational/Rational.d.ts +504 -0
- package/output/core/classes/rational/Rational.js +779 -0
- package/output/core/classes/seq/SEQ.d.ts +13 -0
- package/output/core/classes/seq/SEQ.js +137 -0
- package/output/core/classes/valuesSet/ValuesSet.d.ts +179 -0
- package/output/core/classes/valuesSet/ValuesSet.js +381 -0
- package/output/core/classes/vector/Vector.d.ts +222 -0
- package/output/core/classes/vector/Vector.js +497 -0
- package/output/core/classes/vector/functions.d.ts +28 -0
- package/output/core/classes/vector/functions.js +47 -0
- package/output/core/common/classes/MathematicalAggregate.d.ts +53 -0
- package/output/core/common/classes/MathematicalAggregate.js +140 -0
- package/output/core/common/classes/Scope.d.ts +62 -0
- package/output/core/common/classes/Scope.js +122 -0
- package/output/core/common/classes/StructuredEntity.d.ts +55 -0
- package/output/core/common/classes/StructuredEntity.js +151 -0
- package/output/core/common/common.d.ts +63 -0
- package/output/core/common/common.js +279 -0
- package/output/core/common/functions/functions.d.ts +14 -0
- package/output/core/common/functions/functions.js +33 -0
- package/output/core/common/functions/structuredEntityUtils.d.ts +27 -0
- package/output/core/common/functions/structuredEntityUtils.js +40 -0
- package/output/core/converters/BaseConverter.d.ts +97 -0
- package/output/core/converters/BaseConverter.js +405 -0
- package/output/core/converters/Converter.d.ts +111 -0
- package/output/core/converters/Converter.js +802 -0
- package/output/core/converters/Pattern.d.ts +71 -0
- package/output/core/converters/Pattern.js +302 -0
- package/output/core/dispatch.d.ts +34 -0
- package/output/core/dispatch.js +304 -0
- package/output/core/errors.d.ts +531 -0
- package/output/core/errors.js +621 -0
- package/output/core/functions/bigint/bigint.d.ts +121 -0
- package/output/core/functions/bigint/bigint.js +392 -0
- package/output/core/functions/bigint/primeFactor.d.ts +49 -0
- package/output/core/functions/bigint/primeFactor.js +267 -0
- package/output/core/functions/bigint/primes.d.ts +1 -0
- package/output/core/functions/bigint/primes.js +11 -0
- package/output/core/functions/build/definitions.d.ts +12 -0
- package/output/core/functions/build/definitions.js +133 -0
- package/output/core/functions/build/index.d.ts +32 -0
- package/output/core/functions/build/index.js +136 -0
- package/output/core/functions/complex.d.ts +90 -0
- package/output/core/functions/complex.js +482 -0
- package/output/core/functions/decimal.d.ts +24 -0
- package/output/core/functions/decimal.js +664 -0
- package/output/core/functions/expand/expand.d.ts +42 -0
- package/output/core/functions/expand/expand.js +376 -0
- package/output/core/functions/fresnelNumeric.d.ts +12 -0
- package/output/core/functions/fresnelNumeric.js +123 -0
- package/output/core/functions/numeric.d.ts +140 -0
- package/output/core/functions/numeric.js +790 -0
- package/output/core/functions/rationalNormalization.d.ts +11 -0
- package/output/core/functions/rationalNormalization.js +117 -0
- package/output/core/functions/setFunction.d.ts +19 -0
- package/output/core/functions/setFunction.js +75 -0
- package/output/core/functions/string.d.ts +26 -0
- package/output/core/functions/string.js +101 -0
- package/output/core/functions/subst.d.ts +90 -0
- package/output/core/functions/subst.js +498 -0
- package/output/core/functions/utils.d.ts +24 -0
- package/output/core/functions/utils.js +51 -0
- package/output/core/types.d.ts +48 -0
- package/output/core/types.js +2 -0
- package/output/index.d.ts +339 -0
- package/output/index.js +715 -0
- package/output/math/defint/defintDecimal.d.ts +37 -0
- package/output/math/defint/defintDecimal.js +320 -0
- package/output/math/defint/defintNative.d.ts +57 -0
- package/output/math/defint/defintNative.js +292 -0
- package/output/math/geometry.d.ts +8 -0
- package/output/math/geometry.js +32 -0
- package/output/math/math.d.ts +655 -0
- package/output/math/math.js +1811 -0
- package/output/math/trig.d.ts +518 -0
- package/output/math/trig.js +1444 -0
- package/output/math/trunc.d.ts +19 -0
- package/output/math/trunc.js +36 -0
- package/output/math/utils.d.ts +60 -0
- package/output/math/utils.js +180 -0
- package/output/solve/classes/DecimalMatrix.d.ts +17 -0
- package/output/solve/classes/DecimalMatrix.js +86 -0
- package/output/solve/classes/FunctionSolver.d.ts +135 -0
- package/output/solve/classes/FunctionSolver.js +433 -0
- package/output/solve/classes/MultivariateSolver.d.ts +84 -0
- package/output/solve/classes/MultivariateSolver.js +240 -0
- package/output/solve/classes/PolynomialSolver.d.ts +85 -0
- package/output/solve/classes/PolynomialSolver.js +292 -0
- package/output/solve/classes/SolutionSet.d.ts +153 -0
- package/output/solve/classes/SolutionSet.js +357 -0
- package/output/solve/classes/Solver.d.ts +17 -0
- package/output/solve/classes/Solver.js +132 -0
- package/output/solve/classes/SymbolicSolver.d.ts +74 -0
- package/output/solve/classes/SymbolicSolver.js +601 -0
- package/output/solve/linsolve.d.ts +51 -0
- package/output/solve/linsolve.js +225 -0
- package/output/solve/solve.d.ts +34 -0
- package/output/solve/solve.js +260 -0
- package/output/solve/solveSystem.d.ts +31 -0
- package/output/solve/solveSystem.js +290 -0
- package/output/solve/utils.d.ts +9 -0
- package/output/solve/utils.js +62 -0
- package/output/utils/array.d.ts +42 -0
- package/output/utils/array.js +98 -0
- package/output/utils/debug.d.ts +131 -0
- package/output/utils/debug.js +295 -0
- package/output/utils/decimal.d.ts +3 -0
- package/output/utils/decimal.js +16 -0
- package/output/utils/numeric.d.ts +14 -0
- package/output/utils/numeric.js +51 -0
- package/output/utils/object.d.ts +26 -0
- package/output/utils/object.js +56 -0
- package/package.json +213 -57
- package/.travis.yml +0 -3
- package/Algebra.js +0 -4568
- package/BREAKING_CHANGES.md +0 -5
- package/CODE_OF_CONDUCT.md +0 -46
- package/CONTRIBUTING.md +0 -14
- package/Calculus.js +0 -2675
- package/Extra.js +0 -622
- package/Solve.js +0 -1783
- package/all.js +0 -16
- package/all.min.js +0 -1
- package/gulpfile.js +0 -16
- package/index.html +0 -158
- package/license.txt +0 -19
- package/nerdamer.core.js +0 -12510
- package/spec/LaTeX.spec.js +0 -302
- package/spec/TeXConvert.spec.js +0 -8
- package/spec/algebra.spec.js +0 -287
- package/spec/basic_parser.spec.js +0 -134
- package/spec/build.spec.js +0 -131
- package/spec/calculus.spec.js +0 -183
- package/spec/core.spec.js +0 -2970
- package/spec/extra.spec.js +0 -54
- package/spec/solve.spec.js +0 -126
- package/spec/support/jasmine.json +0 -11
- package/spec/support/utils.js +0 -42
- package/spec/text.spec.js +0 -132
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mathFunctionRegistry = void 0;
|
|
4
|
+
const factor_1 = require("../algebra/factor/factor");
|
|
5
|
+
const gcd_1 = require("../algebra/gcd/gcd");
|
|
6
|
+
const groebner_1 = require("../algebra/groebner");
|
|
7
|
+
const partfrac_1 = require("../algebra/partfrac");
|
|
8
|
+
const simplify_1 = require("../algebra/simplify/simplify");
|
|
9
|
+
const utils_1 = require("../algebra/utils");
|
|
10
|
+
const diff_1 = require("../calculus/derivative/diff");
|
|
11
|
+
const fresnel_1 = require("../calculus/fresnel");
|
|
12
|
+
const integrate_1 = require("../calculus/integrate/integrate");
|
|
13
|
+
const ilaplace_1 = require("../calculus/laplace/ilaplace");
|
|
14
|
+
const laplace_1 = require("../calculus/laplace/laplace");
|
|
15
|
+
const limit_1 = require("../calculus/limit/limit");
|
|
16
|
+
const geometry_1 = require("../math/geometry");
|
|
17
|
+
const math_1 = require("../math/math");
|
|
18
|
+
const trig_1 = require("../math/trig");
|
|
19
|
+
const trunc_1 = require("../math/trunc");
|
|
20
|
+
const utils_2 = require("../math/utils");
|
|
21
|
+
const solve_1 = require("../solve/solve");
|
|
22
|
+
const solveSystem_1 = require("../solve/solveSystem");
|
|
23
|
+
const assume_1 = require("./classes/assumption/assume");
|
|
24
|
+
const Collection_1 = require("./classes/collection/Collection");
|
|
25
|
+
const Dictionary_1 = require("./classes/dictionary/Dictionary");
|
|
26
|
+
const Equation_1 = require("./classes/equation/Equation");
|
|
27
|
+
const shortcuts_1 = require("./classes/expression/shortcuts");
|
|
28
|
+
const utils_3 = require("./classes/expression/utils");
|
|
29
|
+
const functions_1 = require("./classes/matrix/functions");
|
|
30
|
+
const Matrix_1 = require("./classes/matrix/Matrix");
|
|
31
|
+
const utils_4 = require("./classes/matrix/utils");
|
|
32
|
+
const constants_1 = require("./classes/parser/constants");
|
|
33
|
+
const controlFlow_1 = require("./classes/parser/scripting/controlFlow");
|
|
34
|
+
const evaluate_1 = require("./classes/parser/scripting/evaluate");
|
|
35
|
+
const scope_1 = require("./classes/parser/scripting/scope");
|
|
36
|
+
const functions_2 = require("./classes/polynomial/functions");
|
|
37
|
+
const ValuesSet_1 = require("./classes/valuesSet/ValuesSet");
|
|
38
|
+
const functions_3 = require("./classes/vector/functions");
|
|
39
|
+
const Vector_1 = require("./classes/vector/Vector");
|
|
40
|
+
const errors_1 = require("./errors");
|
|
41
|
+
const complex_1 = require("./functions/complex");
|
|
42
|
+
const expand_1 = require("./functions/expand/expand");
|
|
43
|
+
const subst_1 = require("./functions/subst");
|
|
44
|
+
/**
|
|
45
|
+
* Registers a system-level function in the dispatch table. Registered functions can use
|
|
46
|
+
* narrower parameter types, so `RegisteredMathFunction` does not define a common argument
|
|
47
|
+
* type. Dynamic invocation is handled by `callFunction`.
|
|
48
|
+
*/
|
|
49
|
+
function entry(opts) {
|
|
50
|
+
return {
|
|
51
|
+
fn: opts.fn,
|
|
52
|
+
minArgs: opts.minArgs,
|
|
53
|
+
maxArgs: opts.maxArgs,
|
|
54
|
+
maxPrecision: opts.maxPrecision,
|
|
55
|
+
equationArgs: opts.equationArgs,
|
|
56
|
+
distElWise: opts.distElWise,
|
|
57
|
+
deferArguments: opts.deferArguments,
|
|
58
|
+
normalizeDeferredArguments: opts.normalizeDeferredArguments,
|
|
59
|
+
bracketlessStatement: opts.bracketlessStatement,
|
|
60
|
+
returnBoundary: opts.returnBoundary,
|
|
61
|
+
usage: opts.usage ?? 'notation',
|
|
62
|
+
level: 'system',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Applies parser differentiation to both sides when the input is an Equation. */
|
|
66
|
+
function parserDiff(expr, variable, n) {
|
|
67
|
+
let retval;
|
|
68
|
+
if (Equation_1.Equation.isEquation(expr)) {
|
|
69
|
+
retval = expr.each(e => parserDiff(e, variable, n));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
retval = (0, diff_1.diff)(expr, variable, n);
|
|
73
|
+
}
|
|
74
|
+
return retval;
|
|
75
|
+
}
|
|
76
|
+
/** Applies parser integration to both sides when the input is an Equation. */
|
|
77
|
+
function parserIntegrate(expr, variable) {
|
|
78
|
+
let retval;
|
|
79
|
+
if (Equation_1.Equation.isEquation(expr)) {
|
|
80
|
+
retval = expr.each(e => parserIntegrate(e, variable));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
retval = (0, integrate_1.integrate)(expr, variable);
|
|
84
|
+
}
|
|
85
|
+
return retval;
|
|
86
|
+
}
|
|
87
|
+
/** Maps the parser's symbolic direction token to the public limit direction representation. */
|
|
88
|
+
function parserLimit(expr, x, val, dir) {
|
|
89
|
+
let direction = 'both';
|
|
90
|
+
if (dir) {
|
|
91
|
+
direction = (0, utils_3.assertPlainVariableAndGetString)(dir);
|
|
92
|
+
}
|
|
93
|
+
const retval = (0, limit_1.limit)(expr, x, val, direction);
|
|
94
|
+
return retval;
|
|
95
|
+
}
|
|
96
|
+
/** Completes the square while returning the parser-facing expression result. */
|
|
97
|
+
function parserSqcomp(expr, variable) {
|
|
98
|
+
const variableName = variable === undefined ? undefined : (0, utils_3.assertPlainVariableAndGetString)(variable);
|
|
99
|
+
const retval = (0, utils_1.sqcomp)(expr, variableName).expression;
|
|
100
|
+
return retval;
|
|
101
|
+
}
|
|
102
|
+
/** Iterates parser containers while keeping the iteration variable local to each body call. */
|
|
103
|
+
function parserEach(collection, variable, body) {
|
|
104
|
+
const target = collection();
|
|
105
|
+
const values = [];
|
|
106
|
+
if (Vector_1.Vector.isVector(target) ||
|
|
107
|
+
Collection_1.Collection.isCollection(target) ||
|
|
108
|
+
ValuesSet_1.ValuesSet.isValuesSet(target)) {
|
|
109
|
+
target.forEach(value => values.push(value.copy()));
|
|
110
|
+
}
|
|
111
|
+
else if (Matrix_1.Matrix.isMatrix(target)) {
|
|
112
|
+
target.forEach(value => values.push(value.copy()));
|
|
113
|
+
}
|
|
114
|
+
else if (Dictionary_1.Dictionary.isDictionary(target)) {
|
|
115
|
+
target.forEach(value => values.push(value.copy()));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
throw new errors_1.UnexpectedDataType((0, errors_1.message)('unsupportedType', { type: constants_1.dataTypes[target.dataType] }));
|
|
119
|
+
}
|
|
120
|
+
let index = 0;
|
|
121
|
+
const retval = (0, controlFlow_1.FOR)(() => (0, shortcuts_1.zero)(), () => (index < values.length ? (0, shortcuts_1.one)() : (0, shortcuts_1.zero)()), () => {
|
|
122
|
+
index++;
|
|
123
|
+
return (0, shortcuts_1.zero)();
|
|
124
|
+
}, () => (0, scope_1.LET)(variable, () => values[index], body));
|
|
125
|
+
return retval;
|
|
126
|
+
}
|
|
127
|
+
exports.mathFunctionRegistry = {
|
|
128
|
+
// Trigonometric
|
|
129
|
+
cos: entry({ fn: trig_1.cos, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
130
|
+
sin: entry({ fn: trig_1.sin, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
131
|
+
tan: entry({ fn: trig_1.tan, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
132
|
+
sec: entry({ fn: trig_1.sec, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
133
|
+
csc: entry({ fn: trig_1.csc, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
134
|
+
cot: entry({ fn: trig_1.cot, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
135
|
+
acos: entry({ fn: trig_1.acos, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
136
|
+
asin: entry({ fn: trig_1.asin, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
137
|
+
atan: entry({ fn: trig_1.atan, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
138
|
+
asec: entry({ fn: trig_1.asec, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
139
|
+
acsc: entry({ fn: trig_1.acsc, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
140
|
+
acot: entry({ fn: trig_1.acot, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
141
|
+
atan2: entry({ fn: trig_1.atan2, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
142
|
+
cosh: entry({ fn: trig_1.cosh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
143
|
+
sinh: entry({ fn: trig_1.sinh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
144
|
+
tanh: entry({ fn: trig_1.tanh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
145
|
+
sech: entry({ fn: trig_1.sech, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
146
|
+
csch: entry({ fn: trig_1.csch, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
147
|
+
coth: entry({ fn: trig_1.coth, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
148
|
+
acosh: entry({ fn: trig_1.acosh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
149
|
+
asinh: entry({ fn: trig_1.asinh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
150
|
+
atanh: entry({ fn: trig_1.atanh, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
151
|
+
asech: entry({ fn: trig_1.asech, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
152
|
+
acsch: entry({ fn: trig_1.acsch, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
153
|
+
acoth: entry({ fn: trig_1.acoth, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
154
|
+
// Math
|
|
155
|
+
abs: entry({ fn: math_1.abs, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
156
|
+
sqrt: entry({ fn: math_1.sqrt, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
157
|
+
nthroot: entry({ fn: math_1.nthroot, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
158
|
+
cbrt: entry({ fn: math_1.cbrt, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
159
|
+
subst: entry({ fn: subst_1.subst, minArgs: 3, maxArgs: 3, distElWise: true }),
|
|
160
|
+
log: entry({ fn: math_1.log, minArgs: 1, maxArgs: 2, distElWise: true }),
|
|
161
|
+
exp: entry({ fn: math_1.exp, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
162
|
+
erf: entry({ fn: math_1.erf, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
163
|
+
erfc: entry({ fn: math_1.erfc, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
164
|
+
gamma: entry({ fn: math_1.gamma, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
165
|
+
[constants_1.DIRAC]: entry({ fn: math_1.dirac, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
166
|
+
[constants_1.HEAVISIDE]: entry({ fn: math_1.heaviside, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
167
|
+
hypot: entry({ fn: geometry_1.hypot, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
168
|
+
[constants_1.FACTORIAL]: entry({ fn: math_1.factorial, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
169
|
+
factorial: entry({ fn: math_1.factorial, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
170
|
+
[constants_1.DOUBLE_FACTORIAL]: entry({ fn: math_1.doubleFactorial, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
171
|
+
expand: entry({ fn: expand_1.expand, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
172
|
+
numeric: entry({
|
|
173
|
+
fn: evaluate_1.numeric,
|
|
174
|
+
minArgs: 1,
|
|
175
|
+
maxArgs: 2,
|
|
176
|
+
equationArgs: [0],
|
|
177
|
+
distElWise: false,
|
|
178
|
+
deferArguments: true,
|
|
179
|
+
}),
|
|
180
|
+
round: entry({ fn: math_1.round, minArgs: 1, maxArgs: 2, distElWise: true }),
|
|
181
|
+
sign: entry({ fn: math_1.sign, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
182
|
+
floor: entry({ fn: math_1.floor, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
183
|
+
ceil: entry({ fn: math_1.ceiling, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
184
|
+
ceiling: entry({ fn: math_1.ceiling, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
185
|
+
trunc: entry({ fn: trunc_1.trunc, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
186
|
+
mod: entry({ fn: math_1.mod, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
187
|
+
modinv: entry({ fn: math_1.modInv, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
188
|
+
parens: entry({ fn: math_1.parens, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
189
|
+
count: entry({ fn: utils_2.count, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
190
|
+
size: entry({ fn: utils_2.size, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
191
|
+
contains: entry({ fn: math_1.contains, minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
192
|
+
max: entry({ fn: math_1.max, minArgs: 2, maxArgs: -1, distElWise: true }),
|
|
193
|
+
min: entry({ fn: math_1.min, minArgs: 2, maxArgs: -1, distElWise: true }),
|
|
194
|
+
// Complex
|
|
195
|
+
imagpart: entry({ fn: complex_1.imagPart, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
196
|
+
realpart: entry({ fn: complex_1.realPart, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
197
|
+
polarform: entry({ fn: complex_1.polarForm, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
198
|
+
rectform: entry({ fn: complex_1.rectForm, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
199
|
+
arg: entry({ fn: complex_1.arg, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
200
|
+
csgn: entry({ fn: complex_1.csgn, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
201
|
+
conjugate: entry({ fn: complex_1.conjugate, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
202
|
+
// Matrices and Vector
|
|
203
|
+
matrix: entry({ fn: math_1.matrix, minArgs: 1, maxArgs: -1, distElWise: false }),
|
|
204
|
+
imatrix: entry({ fn: utils_4.imatrix, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
205
|
+
determinant: entry({ fn: functions_1.determinant, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
206
|
+
transpose: entry({ fn: (M) => M.transpose(), minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
207
|
+
augment: entry({ fn: (M, N) => M.augment(N), minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
208
|
+
rref: entry({ fn: (M, prime) => M.rref(prime), minArgs: 1, maxArgs: 2, distElWise: false }),
|
|
209
|
+
nullspace: entry({ fn: functions_1.nullspace, minArgs: 1, maxArgs: 2, distElWise: false }),
|
|
210
|
+
dot: entry({ fn: functions_3.dot, minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
211
|
+
cross: entry({ fn: functions_3.cross, minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
212
|
+
// Polynomials
|
|
213
|
+
deg: entry({ fn: functions_2.deg, minArgs: 1, maxArgs: 2, distElWise: true }),
|
|
214
|
+
content: entry({ fn: functions_2.content, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
215
|
+
div: entry({ fn: functions_2.div, minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
216
|
+
divide: entry({ fn: functions_2.divide, minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
217
|
+
// Calculus
|
|
218
|
+
diff: entry({ fn: parserDiff, minArgs: 1, maxArgs: 3, equationArgs: [0], distElWise: true }),
|
|
219
|
+
integrate: entry({ fn: parserIntegrate, minArgs: 1, maxArgs: 2, equationArgs: [0], distElWise: true }),
|
|
220
|
+
limit: entry({ fn: parserLimit, minArgs: 3, maxArgs: 4, distElWise: true }),
|
|
221
|
+
laplace: entry({ fn: laplace_1.laplace, minArgs: 3, maxArgs: 3, distElWise: true }),
|
|
222
|
+
ilaplace: entry({ fn: ilaplace_1.ilaplace, minArgs: 3, maxArgs: 3, distElWise: true }),
|
|
223
|
+
sum: entry({ fn: math_1.sum, minArgs: 4, maxArgs: 4, distElWise: true }),
|
|
224
|
+
product: entry({ fn: math_1.product, minArgs: 4, maxArgs: 4, distElWise: true }),
|
|
225
|
+
defint: entry({ fn: math_1.defint, minArgs: 4, maxArgs: 4, distElWise: true }),
|
|
226
|
+
[constants_1.FRESNEL_S]: entry({ fn: fresnel_1.S, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
227
|
+
[constants_1.FRESNEL_C]: entry({ fn: fresnel_1.C, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
228
|
+
// Algebra
|
|
229
|
+
polyfactors: entry({ fn: factor_1.polyFactors, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
230
|
+
factor: entry({ fn: factor_1.factor, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
231
|
+
simplify: entry({ fn: simplify_1.simplify, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
232
|
+
partfrac: entry({ fn: partfrac_1.partfrac, minArgs: 1, maxArgs: 2, distElWise: true }),
|
|
233
|
+
gcd: entry({ fn: gcd_1.gcd, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
234
|
+
lcm: entry({ fn: gcd_1.lcm, minArgs: 2, maxArgs: 2, distElWise: true }),
|
|
235
|
+
groebner: entry({ fn: groebner_1.groebner, minArgs: 1, maxArgs: 2, distElWise: false }),
|
|
236
|
+
sqcomp: entry({ fn: parserSqcomp, minArgs: 1, maxArgs: 2, distElWise: true }),
|
|
237
|
+
// Solver
|
|
238
|
+
solve: entry({ fn: solve_1.solve, minArgs: 2, maxArgs: 2, equationArgs: [0], distElWise: false }),
|
|
239
|
+
solveeqs: entry({ fn: solveSystem_1.solveSystem, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
240
|
+
// Assumptions and Sets
|
|
241
|
+
assume: entry({ fn: assume_1.assuming, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
242
|
+
forget: entry({ fn: assume_1.forget, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
243
|
+
unassign: entry({ fn: scope_1.unassign, minArgs: 1, maxArgs: 1, distElWise: false, deferArguments: true }),
|
|
244
|
+
// Parser scripting
|
|
245
|
+
evaluate: entry({
|
|
246
|
+
fn: evaluate_1.evaluate,
|
|
247
|
+
minArgs: 1,
|
|
248
|
+
maxArgs: 3,
|
|
249
|
+
equationArgs: [0],
|
|
250
|
+
distElWise: false,
|
|
251
|
+
deferArguments: true,
|
|
252
|
+
usage: 'scripting',
|
|
253
|
+
}),
|
|
254
|
+
return: entry({
|
|
255
|
+
fn: controlFlow_1.RETURN,
|
|
256
|
+
minArgs: 1,
|
|
257
|
+
maxArgs: 1,
|
|
258
|
+
equationArgs: [0],
|
|
259
|
+
distElWise: false,
|
|
260
|
+
bracketlessStatement: true,
|
|
261
|
+
usage: 'scripting',
|
|
262
|
+
}),
|
|
263
|
+
break: entry({ fn: controlFlow_1.BREAK, minArgs: 0, maxArgs: 0, distElWise: false, usage: 'scripting' }),
|
|
264
|
+
continue: entry({ fn: controlFlow_1.CONTINUE, minArgs: 0, maxArgs: 0, distElWise: false, usage: 'scripting' }),
|
|
265
|
+
and: entry({ fn: controlFlow_1.AND, minArgs: 2, maxArgs: -1, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
266
|
+
or: entry({ fn: controlFlow_1.OR, minArgs: 2, maxArgs: -1, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
267
|
+
not: entry({ fn: controlFlow_1.NOT, minArgs: 1, maxArgs: 1, distElWise: false, usage: 'scripting' }),
|
|
268
|
+
xor: entry({ fn: controlFlow_1.XOR, minArgs: 2, maxArgs: -1, distElWise: false, usage: 'scripting' }),
|
|
269
|
+
iferror: entry({ fn: controlFlow_1.IFERROR, minArgs: 2, maxArgs: 2, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
270
|
+
iserror: entry({ fn: controlFlow_1.ISERROR, minArgs: 1, maxArgs: 1, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
271
|
+
if: entry({ fn: controlFlow_1.IF, minArgs: 2, maxArgs: 3, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
272
|
+
while: entry({ fn: controlFlow_1.WHILE, minArgs: 2, maxArgs: 2, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
273
|
+
for: entry({ fn: controlFlow_1.FOR, minArgs: 4, maxArgs: 4, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
274
|
+
each: entry({ fn: parserEach, minArgs: 3, maxArgs: 3, distElWise: false, deferArguments: true, usage: 'scripting' }),
|
|
275
|
+
let: entry({
|
|
276
|
+
fn: scope_1.LET,
|
|
277
|
+
minArgs: 3,
|
|
278
|
+
maxArgs: -1,
|
|
279
|
+
distElWise: false,
|
|
280
|
+
deferArguments: true,
|
|
281
|
+
normalizeDeferredArguments: scope_1.normalizeLetArguments,
|
|
282
|
+
returnBoundary: true,
|
|
283
|
+
usage: 'scripting',
|
|
284
|
+
}),
|
|
285
|
+
block: entry({
|
|
286
|
+
fn: controlFlow_1.BLOCK,
|
|
287
|
+
minArgs: -1,
|
|
288
|
+
maxArgs: -1,
|
|
289
|
+
distElWise: false,
|
|
290
|
+
deferArguments: true,
|
|
291
|
+
returnBoundary: true,
|
|
292
|
+
usage: 'scripting',
|
|
293
|
+
}),
|
|
294
|
+
// Special
|
|
295
|
+
isprime: entry({ fn: utils_2.isprime, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
296
|
+
fib: entry({ fn: math_1.fibonacci, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
297
|
+
sinc: entry({ fn: math_1.sinc, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
298
|
+
Shi: entry({ fn: math_1.Shi, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
299
|
+
Si: entry({ fn: math_1.Si, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
300
|
+
Chi: entry({ fn: math_1.Chi, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
301
|
+
Ci: entry({ fn: math_1.Ci, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
302
|
+
Ei: entry({ fn: math_1.Ei, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
303
|
+
[constants_1.LI]: entry({ fn: math_1.Li, minArgs: 1, maxArgs: 1, distElWise: true }),
|
|
304
|
+
};
|