nerdamer 1.1.13 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +244 -5
- package/LICENSE.md +184 -0
- package/README.md +232 -318
- 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 +2248 -0
- package/index.d.ts +10 -426
- package/output/algebra/adapters.d.ts +3 -0
- package/output/algebra/adapters.js +11 -0
- package/output/algebra/algorithms/arith.d.ts +84 -0
- package/output/algebra/algorithms/arith.js +324 -0
- package/output/algebra/algorithms/groebnerBase.d.ts +161 -0
- package/output/algebra/algorithms/groebnerBase.js +929 -0
- package/output/algebra/dispatch.d.ts +1 -0
- package/output/algebra/dispatch.js +25 -0
- package/output/algebra/factor/factor.d.ts +77 -0
- package/output/algebra/factor/factor.js +245 -0
- package/output/algebra/gcd/gcd.d.ts +30 -0
- package/output/algebra/gcd/gcd.js +95 -0
- package/output/algebra/groebner.d.ts +21 -0
- package/output/algebra/groebner.js +36 -0
- package/output/algebra/partfrac.d.ts +19 -0
- package/output/algebra/partfrac.js +365 -0
- 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.d.ts +20 -0
- package/output/algebra/polynomialize.js +26 -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 +237 -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 +8 -0
- package/output/api/advanced.js +18 -0
- package/output/api/algebra.d.ts +17 -0
- package/output/api/algebra.js +35 -0
- package/output/api/assumptions.d.ts +4 -0
- package/output/api/assumptions.js +11 -0
- package/output/api/calculus.d.ts +10 -0
- package/output/api/calculus.js +22 -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/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 +93 -0
- package/output/api/parser.js +18 -0
- package/output/api/solve.d.ts +10 -0
- package/output/api/solve.js +17 -0
- package/output/api/structures.d.ts +10 -0
- package/output/api/structures.js +23 -0
- package/output/calculus/adapters.d.ts +8 -0
- package/output/calculus/adapters.js +41 -0
- package/output/calculus/derivative/diff.d.ts +30 -0
- package/output/calculus/derivative/diff.js +241 -0
- package/output/calculus/dispatch.d.ts +1 -0
- package/output/calculus/dispatch.js +25 -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/classes/assumption/Assumption.d.ts +218 -0
- package/output/core/classes/assumption/Assumption.js +609 -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/assumption/dispatch.d.ts +1 -0
- package/output/core/classes/assumption/dispatch.js +11 -0
- package/output/core/classes/collection/Collection.d.ts +107 -0
- package/output/core/classes/collection/Collection.js +240 -0
- package/output/core/classes/complex/Complex.d.ts +109 -0
- package/output/core/classes/complex/Complex.js +153 -0
- package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
- package/output/core/classes/decimalSet/DecimalSet.js +454 -0
- package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
- package/output/core/classes/dictionary/Dictionary.js +216 -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 +197 -0
- package/output/core/classes/expression/Expression.d.ts +1691 -0
- package/output/core/classes/expression/Expression.js +2381 -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 +54 -0
- package/output/core/classes/expression/format.js +340 -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 +61 -0
- package/output/core/classes/expression/utils.js +235 -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 +901 -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/dispatch.d.ts +1 -0
- package/output/core/classes/matrix/dispatch.js +19 -0
- package/output/core/classes/matrix/functions.d.ts +28 -0
- package/output/core/classes/matrix/functions.js +57 -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 +493 -0
- package/output/core/classes/parser/Parser.js +1863 -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 +162 -0
- package/output/core/classes/parser/constants.js +229 -0
- package/output/core/classes/parser/controlFlowSignals.d.ts +38 -0
- package/output/core/classes/parser/controlFlowSignals.js +60 -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 +236 -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 +474 -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 +438 -0
- package/output/core/classes/parser/operations/multiply.d.ts +11 -0
- package/output/core/classes/parser/operations/multiply.js +328 -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 +36 -0
- package/output/core/classes/parser/preprocess.d.ts +7 -0
- package/output/core/classes/parser/preprocess.js +246 -0
- package/output/core/classes/parser/scripting/controlFlow.d.ts +23 -0
- package/output/core/classes/parser/scripting/controlFlow.js +279 -0
- 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 +23 -0
- package/output/core/classes/parser/scripting/evaluate.js +128 -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 +8 -0
- package/output/core/classes/parser/scripting/scope.js +132 -0
- package/output/core/classes/parser/types.d.ts +130 -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 +504 -0
- package/output/core/classes/polynomial/Polynomial.js +1195 -0
- 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.d.ts +222 -0
- package/output/core/classes/polynomial/Term.js +430 -0
- package/output/core/classes/polynomial/adapters.d.ts +18 -0
- 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 +77 -0
- package/output/core/classes/polynomial/functions.js +189 -0
- package/output/core/classes/polynomial/utils.d.ts +62 -0
- package/output/core/classes/polynomial/utils.js +207 -0
- package/output/core/classes/rational/Rational.d.ts +501 -0
- package/output/core/classes/rational/Rational.js +829 -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 +187 -0
- package/output/core/classes/valuesSet/ValuesSet.js +399 -0
- package/output/core/classes/vector/Vector.d.ts +222 -0
- package/output/core/classes/vector/Vector.js +501 -0
- package/output/core/classes/vector/dispatch.d.ts +1 -0
- package/output/core/classes/vector/dispatch.js +11 -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 +149 -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 +62 -0
- package/output/core/common/common.js +74 -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 +806 -0
- package/output/core/converters/Pattern.d.ts +71 -0
- package/output/core/converters/Pattern.js +302 -0
- package/output/core/dispatch.d.ts +52 -0
- package/output/core/dispatch.js +26 -0
- package/output/core/errors.d.ts +316 -0
- package/output/core/errors.js +349 -0
- package/output/core/fullFunctions.d.ts +7 -0
- package/output/core/fullFunctions.js +31 -0
- package/output/core/functions/bigint/bigint.d.ts +133 -0
- package/output/core/functions/bigint/bigint.js +444 -0
- package/output/core/functions/bigint/primeFactor.d.ts +51 -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 +139 -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.dispatch.d.ts +1 -0
- package/output/core/functions/complex.dispatch.js +16 -0
- package/output/core/functions/complex.js +482 -0
- package/output/core/functions/decimal.d.ts +24 -0
- package/output/core/functions/decimal.js +665 -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 +102 -0
- package/output/core/functions/subst.d.ts +90 -0
- package/output/core/functions/subst.js +506 -0
- package/output/core/functions/utils.d.ts +24 -0
- package/output/core/functions/utils.js +51 -0
- package/output/core/parserFunctions.d.ts +7 -0
- package/output/core/parserFunctions.js +25 -0
- package/output/core/types.d.ts +48 -0
- package/output/core/types.js +2 -0
- package/output/index.d.ts +359 -0
- package/output/index.js +739 -0
- package/output/math/defint/defint.d.ts +18 -0
- package/output/math/defint/defint.js +60 -0
- package/output/math/defint/defintDecimal.d.ts +37 -0
- package/output/math/defint/defintDecimal.js +321 -0
- package/output/math/defint/defintNative.d.ts +57 -0
- package/output/math/defint/defintNative.js +281 -0
- package/output/math/dispatch.d.ts +1 -0
- package/output/math/dispatch.js +101 -0
- package/output/math/geometry.d.ts +12 -0
- package/output/math/geometry.js +55 -0
- package/output/math/math.d.ts +695 -0
- package/output/math/math.js +1955 -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 +66 -0
- package/output/math/utils.js +219 -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 +104 -0
- package/output/solve/classes/PolynomialSolver.js +492 -0
- package/output/solve/classes/SolutionSet.d.ts +172 -0
- package/output/solve/classes/SolutionSet.js +434 -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/dispatch.d.ts +1 -0
- package/output/solve/dispatch.js +13 -0
- package/output/solve/linsolve.d.ts +53 -0
- package/output/solve/linsolve.js +233 -0
- package/output/solve/solve.d.ts +44 -0
- package/output/solve/solve.js +368 -0
- package/output/solve/solveSystem.d.ts +31 -0
- package/output/solve/solveSystem.js +266 -0
- package/output/solve/utils.d.ts +10 -0
- package/output/solve/utils.js +58 -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 +296 -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 +178 -57
- package/.travis.yml +0 -3
- package/Algebra.js +0 -4568
- 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,11 @@
|
|
|
1
|
+
import { Expression } from '../expression/Expression';
|
|
2
|
+
/**
|
|
3
|
+
* Constructs a Sylvester matrix from the coefficient of two polynomials
|
|
4
|
+
* Ideals, Varieties, and Algorithms 4th edition p. 163
|
|
5
|
+
*/
|
|
6
|
+
export declare class Syl {
|
|
7
|
+
private M;
|
|
8
|
+
constructor(f: Expression, g: Expression, variable: string);
|
|
9
|
+
Res(): Expression;
|
|
10
|
+
text(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Syl = void 0;
|
|
4
|
+
const expand_1 = require("../../functions/expand/expand");
|
|
5
|
+
const Expression_1 = require("../expression/Expression");
|
|
6
|
+
const Matrix_1 = require("./Matrix");
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a Sylvester matrix from the coefficient of two polynomials
|
|
9
|
+
* Ideals, Varieties, and Algorithms 4th edition p. 163
|
|
10
|
+
*/
|
|
11
|
+
class Syl {
|
|
12
|
+
M;
|
|
13
|
+
constructor(f, g, variable) {
|
|
14
|
+
const M = (this.M = new Matrix_1.Matrix([]));
|
|
15
|
+
function addCoefficients(coeffs, d, m) {
|
|
16
|
+
const cols = M.cols();
|
|
17
|
+
let c = 0;
|
|
18
|
+
// Populate the rows first with the coefficients of f and then g
|
|
19
|
+
for (let col = cols; col < m + cols; col++) {
|
|
20
|
+
for (let row = 0; row < d; row++) {
|
|
21
|
+
const max = coeffs.length - 1 + c;
|
|
22
|
+
const outOfRange = row < c || row > max;
|
|
23
|
+
const value = outOfRange ? Expression_1.Expression.Number('0') : coeffs[row - c];
|
|
24
|
+
// const i = m + c;
|
|
25
|
+
// const value = i < c || i > row? Expression.Number('0') : fCoeffs[row];
|
|
26
|
+
M.elements[row][col] = value;
|
|
27
|
+
// console.log('i: '+i, 'max: '+max, 'row: '+row, 'col: '+col, 'value: '+value.toString())
|
|
28
|
+
}
|
|
29
|
+
c++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Get the coefficients wrt the variable
|
|
33
|
+
const fCoeffs = f.coeffs(variable).toArray().reverse();
|
|
34
|
+
const gCoeffs = g.coeffs(variable).toArray().reverse();
|
|
35
|
+
// The columns for the matrix
|
|
36
|
+
const l = fCoeffs.length - 1;
|
|
37
|
+
const m = gCoeffs.length - 1;
|
|
38
|
+
// The matrix will be an (l+m) x (l+m) matrix so we store the dimension in d
|
|
39
|
+
const d = l + m;
|
|
40
|
+
// Create the rows
|
|
41
|
+
for (let i = 0; i < d; i++) {
|
|
42
|
+
M.elements.push([]);
|
|
43
|
+
}
|
|
44
|
+
addCoefficients(fCoeffs, d, m);
|
|
45
|
+
addCoefficients(gCoeffs, d, l);
|
|
46
|
+
}
|
|
47
|
+
Res() {
|
|
48
|
+
return (0, expand_1.expand)(this.M.determinant());
|
|
49
|
+
}
|
|
50
|
+
text() {
|
|
51
|
+
return this.M.text();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.Syl = Syl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadMatrixFunctions(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadMatrixFunctions = loadMatrixFunctions;
|
|
4
|
+
const dispatch_1 = require("../../dispatch");
|
|
5
|
+
const functions_1 = require("./functions");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const math_1 = require("../../../math/math");
|
|
8
|
+
function loadMatrixFunctions() {
|
|
9
|
+
Object.assign(dispatch_1.mathFunctionRegistry, {
|
|
10
|
+
matrix: (0, dispatch_1.systemFunction)({ fn: math_1.matrix, minArgs: 1, maxArgs: -1, distElWise: false }),
|
|
11
|
+
imatrix: (0, dispatch_1.systemFunction)({ fn: utils_1.imatrix, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
12
|
+
determinant: (0, dispatch_1.systemFunction)({ fn: functions_1.determinant, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
13
|
+
invert: (0, dispatch_1.systemFunction)({ fn: functions_1.invert, minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
14
|
+
transpose: (0, dispatch_1.systemFunction)({ fn: (M) => M.transpose(), minArgs: 1, maxArgs: 1, distElWise: false }),
|
|
15
|
+
augment: (0, dispatch_1.systemFunction)({ fn: (M, N) => M.augment(N), minArgs: 2, maxArgs: 2, distElWise: false }),
|
|
16
|
+
rref: (0, dispatch_1.systemFunction)({ fn: (M, prime) => M.rref(prime), minArgs: 1, maxArgs: 2, distElWise: false }),
|
|
17
|
+
nullspace: (0, dispatch_1.systemFunction)({ fn: functions_1.nullspace, minArgs: 1, maxArgs: 2, distElWise: false }),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Expression } from '../expression/Expression';
|
|
2
|
+
import { Polynomial } from '../polynomial/Polynomial';
|
|
3
|
+
import { Vector } from '../vector/Vector';
|
|
4
|
+
import { Matrix } from './Matrix';
|
|
5
|
+
/**
|
|
6
|
+
* Computes the determinant without mutating the supplied Matrix.
|
|
7
|
+
* @throws {@link core!UnsupportedOperationError} If `M` is not square.
|
|
8
|
+
*/
|
|
9
|
+
export declare function determinant(M: Matrix): Expression;
|
|
10
|
+
/** Returns the inverse without modifying the supplied Matrix. */
|
|
11
|
+
export declare function invert(M: Matrix): Matrix;
|
|
12
|
+
/** Returns the nullspace basis as a Vector of basis vectors. */
|
|
13
|
+
export declare function nullspace(M: Matrix, prime?: string | number | Expression): Vector;
|
|
14
|
+
/**
|
|
15
|
+
* Computes the monic characteristic polynomial `det(variable*I - M)`.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* The spectral variable is explicit so callers can choose a name that does not collide with
|
|
19
|
+
* symbols already present in a symbolic matrix. The Faddeev-LeVerrier recurrence reuses exact
|
|
20
|
+
* Matrix multiplication, trace, scalar arithmetic, and identity construction without introducing
|
|
21
|
+
* symbolic pivot denominators from Gaussian determinant elimination.
|
|
22
|
+
*
|
|
23
|
+
* @param M - Square matrix whose characteristic polynomial is requested.
|
|
24
|
+
* @param variable - Variable name used for the polynomial indeterminate.
|
|
25
|
+
* @returns The exact characteristic polynomial in `variable`.
|
|
26
|
+
* @throws {@link core!UnsupportedOperationError} If `M` is not square.
|
|
27
|
+
*/
|
|
28
|
+
export declare function characteristicPolynomial(M: Matrix, variable: string): Polynomial;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.determinant = determinant;
|
|
4
|
+
exports.invert = invert;
|
|
5
|
+
exports.nullspace = nullspace;
|
|
6
|
+
exports.characteristicPolynomial = characteristicPolynomial;
|
|
7
|
+
const errors_1 = require("../../errors");
|
|
8
|
+
const Expression_1 = require("../expression/Expression");
|
|
9
|
+
const Polynomial_1 = require("../polynomial/Polynomial");
|
|
10
|
+
const Vector_1 = require("../vector/Vector");
|
|
11
|
+
const Matrix_1 = require("./Matrix");
|
|
12
|
+
/**
|
|
13
|
+
* Computes the determinant without mutating the supplied Matrix.
|
|
14
|
+
* @throws {@link core!UnsupportedOperationError} If `M` is not square.
|
|
15
|
+
*/
|
|
16
|
+
function determinant(M) {
|
|
17
|
+
return M.copy().determinant();
|
|
18
|
+
}
|
|
19
|
+
/** Returns the inverse without modifying the supplied Matrix. */
|
|
20
|
+
function invert(M) {
|
|
21
|
+
return M.inverse();
|
|
22
|
+
}
|
|
23
|
+
/** Returns the nullspace basis as a Vector of basis vectors. */
|
|
24
|
+
function nullspace(M, prime) {
|
|
25
|
+
return new Vector_1.Vector(M.nullspace(prime).map(vector => new Vector_1.Vector(vector)));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Computes the monic characteristic polynomial `det(variable*I - M)`.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* The spectral variable is explicit so callers can choose a name that does not collide with
|
|
32
|
+
* symbols already present in a symbolic matrix. The Faddeev-LeVerrier recurrence reuses exact
|
|
33
|
+
* Matrix multiplication, trace, scalar arithmetic, and identity construction without introducing
|
|
34
|
+
* symbolic pivot denominators from Gaussian determinant elimination.
|
|
35
|
+
*
|
|
36
|
+
* @param M - Square matrix whose characteristic polynomial is requested.
|
|
37
|
+
* @param variable - Variable name used for the polynomial indeterminate.
|
|
38
|
+
* @returns The exact characteristic polynomial in `variable`.
|
|
39
|
+
* @throws {@link core!UnsupportedOperationError} If `M` is not square.
|
|
40
|
+
*/
|
|
41
|
+
function characteristicPolynomial(M, variable) {
|
|
42
|
+
if (!M.isSquare()) {
|
|
43
|
+
throw new errors_1.UnsupportedOperationError((0, errors_1.message)('squareMatrixRequired'));
|
|
44
|
+
}
|
|
45
|
+
const n = M.rows();
|
|
46
|
+
const spectralParameter = Expression_1.Expression.Variable(variable);
|
|
47
|
+
const identity = Matrix_1.Matrix.identity(n);
|
|
48
|
+
let recurrenceMatrix = identity;
|
|
49
|
+
let characteristicExpression = spectralParameter.pow(n);
|
|
50
|
+
for (let k = 1; k <= n; k++) {
|
|
51
|
+
const product = M.times(recurrenceMatrix);
|
|
52
|
+
const coefficient = product.trace().neg().div(k);
|
|
53
|
+
characteristicExpression = characteristicExpression.plus(coefficient.times(spectralParameter.pow(n - k)));
|
|
54
|
+
recurrenceMatrix = product.plus(identity.times(coefficient));
|
|
55
|
+
}
|
|
56
|
+
return new Polynomial_1.Polynomial(characteristicExpression, [variable]);
|
|
57
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Expression } from '../expression/Expression';
|
|
2
|
+
import { Matrix } from './Matrix';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an identity matrix of integer size.
|
|
5
|
+
*
|
|
6
|
+
* @returns A Matrix for an integer argument, or an unevaluated `imatrix(x)`
|
|
7
|
+
* Expression when the size is not an integer.
|
|
8
|
+
*/
|
|
9
|
+
export declare function imatrix(x: Expression): Expression | Matrix;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.imatrix = imatrix;
|
|
4
|
+
const Expression_1 = require("../expression/Expression");
|
|
5
|
+
const constants_1 = require("../parser/constants");
|
|
6
|
+
const Matrix_1 = require("./Matrix");
|
|
7
|
+
/**
|
|
8
|
+
* Creates an identity matrix of integer size.
|
|
9
|
+
*
|
|
10
|
+
* @returns A Matrix for an integer argument, or an unevaluated `imatrix(x)`
|
|
11
|
+
* Expression when the size is not an integer.
|
|
12
|
+
*/
|
|
13
|
+
function imatrix(x) {
|
|
14
|
+
let retval;
|
|
15
|
+
if (!x.isInteger()) {
|
|
16
|
+
retval = Expression_1.Expression.toFunction(constants_1.IMATRIX, [x]);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
retval = Matrix_1.Matrix.identity(Number(x));
|
|
20
|
+
}
|
|
21
|
+
return retval;
|
|
22
|
+
}
|