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,655 @@
|
|
|
1
|
+
import { Expression } from '../core/classes/expression/Expression';
|
|
2
|
+
import { Matrix } from '../core/classes/matrix/Matrix';
|
|
3
|
+
import type { Dictionary } from '../core/classes/dictionary/Dictionary';
|
|
4
|
+
import type { ValuesSet } from '../core/classes/valuesSet/ValuesSet';
|
|
5
|
+
import type { Vector } from '../core/classes/vector/Vector';
|
|
6
|
+
import type { ExpressionInput, NerdamerInput } from '../core/types';
|
|
7
|
+
import type { SolutionSet } from '../solve/classes/SolutionSet';
|
|
8
|
+
/**
|
|
9
|
+
* Computes the square root of an expression. Equivalent to raising to the power of 1/2.
|
|
10
|
+
* Nested square roots are automatically simplified (e.g. `sqrt(sqrt(x))` becomes `x^(1/4)`).
|
|
11
|
+
*
|
|
12
|
+
* @param x - The expression to take the square root of.
|
|
13
|
+
* @returns The square root of `x`.
|
|
14
|
+
* @throws {@link core!UndefinedError} If `x` is `-∞`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Numeric
|
|
19
|
+
* sqrt(4).text() // "2"
|
|
20
|
+
* sqrt('1/4').text() // "1/2"
|
|
21
|
+
*
|
|
22
|
+
* // Symbolic
|
|
23
|
+
* sqrt('x^2').text() // "x"
|
|
24
|
+
* sqrt('x').text() // "sqrt(x)"
|
|
25
|
+
* sqrt(0).text() // "0"
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function sqrt(x: ExpressionInput): Expression;
|
|
29
|
+
/**
|
|
30
|
+
* Computes the nth root of an expression as its principal power.
|
|
31
|
+
*
|
|
32
|
+
* @param x - The expression whose root is requested.
|
|
33
|
+
* @param n - The root degree.
|
|
34
|
+
* @returns `x^(1/n)`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function nthroot(x: ExpressionInput, n: ExpressionInput): Expression;
|
|
37
|
+
/**
|
|
38
|
+
* Computes the cube root of an expression.
|
|
39
|
+
*
|
|
40
|
+
* For real numeric constants, the *real* cube root is returned (so negative reals stay real).
|
|
41
|
+
* For complex constants, the principal cube root is used.
|
|
42
|
+
* Nested cube roots are simplified (e.g. `cbrt(cbrt(x))` becomes `x^(1/9)`).
|
|
43
|
+
*
|
|
44
|
+
* Unlike {@link sqrt}, `cbrt` is preserved as a function node rather than rewritten to
|
|
45
|
+
* `x^(1/3)` to avoid principal-branch issues during symbolic manipulation.
|
|
46
|
+
*
|
|
47
|
+
* @param x - The expression to take the cube root of.
|
|
48
|
+
* @returns The cube root of `x`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* cbrt(8).text() // "2"
|
|
53
|
+
* cbrt(-27).text() // "-3"
|
|
54
|
+
* cbrt('x').text() // "cbrt(x)"
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function cbrt(x: ExpressionInput): Expression;
|
|
58
|
+
/**
|
|
59
|
+
* Wraps an expression in parentheses. Returns a function node whose only purpose
|
|
60
|
+
* is to visually group `x` with surrounding parentheses in output.
|
|
61
|
+
*
|
|
62
|
+
* @param x - The expression to wrap.
|
|
63
|
+
* @returns A parenthesised form of `x`.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* parens(Expression.create('x+1')).text() // "(x+1)"
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function parens(x: Expression): Expression;
|
|
71
|
+
/**
|
|
72
|
+
* Computes the Fibonacci number for an integer index.
|
|
73
|
+
*
|
|
74
|
+
* Integer inputs are evaluated exactly, including negative indices through the
|
|
75
|
+
* negafibonacci identity. Symbolic and non-integer inputs remain unevaluated.
|
|
76
|
+
*
|
|
77
|
+
* @param x - Fibonacci index.
|
|
78
|
+
* @returns The exact Fibonacci number for an integer input, or symbolic `fib(x)`.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* fibonacci(10).text() // "55"
|
|
83
|
+
* fibonacci(-4).text() // "-3"
|
|
84
|
+
* fibonacci('x').text() // "fib(x)"
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function fibonacci(x: ExpressionInput): Expression;
|
|
88
|
+
/**
|
|
89
|
+
* Computes the factorial of an expression.
|
|
90
|
+
*
|
|
91
|
+
* For non-negative integers, returns the exact integer factorial.
|
|
92
|
+
* For half-integer arguments (e.g. `1/2`, `3/2`, `-1/2`), returns a closed-form
|
|
93
|
+
* expression involving `sqrt(π)`.
|
|
94
|
+
* When `Settings.EVALUATE` is `true` and the input is not an integer, falls back
|
|
95
|
+
* to the {@link gamma} function via Γ(x + 1).
|
|
96
|
+
*
|
|
97
|
+
* @param x - The expression to compute the factorial of.
|
|
98
|
+
* @returns The factorial of `x`.
|
|
99
|
+
* @throws {@link core!UndefinedError} If `x` is `-∞`.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* factorial(Expression.create(5)).text() // "120"
|
|
104
|
+
* factorial(Expression.create(0)).text() // "1"
|
|
105
|
+
* factorial(Expression.create('1/2')).text() // "1/2*sqrt(pi)"
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function factorial(x: Expression): Expression;
|
|
109
|
+
/**
|
|
110
|
+
* Computes the double factorial of an expression.
|
|
111
|
+
*
|
|
112
|
+
* For a non-negative integer n, the double factorial is the product of all positive
|
|
113
|
+
* integers up to n that share its parity:
|
|
114
|
+
* - Even: `n!! = 2 · 4 · 6 · … · n`
|
|
115
|
+
* - Odd: `n!! = 1 · 3 · 5 · … · n`
|
|
116
|
+
*
|
|
117
|
+
* For non-integer arguments when `Settings.EVALUATE` is `true`, a generalised
|
|
118
|
+
* formula using the {@link gamma} function is applied.
|
|
119
|
+
*
|
|
120
|
+
* @param x - The expression to compute the double factorial of.
|
|
121
|
+
* @returns The double factorial of `x`.
|
|
122
|
+
* @throws {@link core!UndefinedError} If `x` is `-∞`.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* doubleFactorial(Expression.create(6)).text() // "48"
|
|
127
|
+
* doubleFactorial(Expression.create(7)).text() // "105"
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function doubleFactorial(x: Expression): Expression;
|
|
131
|
+
/**
|
|
132
|
+
* Computes the Heaviside step function (unit step function).
|
|
133
|
+
*
|
|
134
|
+
* Uses the half-maximum convention at the origin:
|
|
135
|
+
* - `heaviside(x) = 0` for `x < 0`
|
|
136
|
+
* - `heaviside(0) = 1/2`
|
|
137
|
+
* - `heaviside(x) = 1` for `x > 0`
|
|
138
|
+
*
|
|
139
|
+
* For symbolic inputs, returns an unevaluated `heaviside(x)` node.
|
|
140
|
+
*
|
|
141
|
+
* @param x - The input expression.
|
|
142
|
+
* @returns The Heaviside step value.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* heaviside(Expression.create(3)).text() // "1"
|
|
147
|
+
* heaviside(Expression.create(-2)).text() // "0"
|
|
148
|
+
* heaviside(Expression.create(0)).text() // "1/2"
|
|
149
|
+
* heaviside(Expression.create('t')).text() // "heaviside(t)"
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare function heaviside(x: Expression): Expression;
|
|
153
|
+
/**
|
|
154
|
+
* Computes the Dirac delta function (distribution).
|
|
155
|
+
*
|
|
156
|
+
* For non-zero numeric inputs, returns `0`. At `x = 0` the symbolic form
|
|
157
|
+
* `dirac(0)` is returned (the Dirac delta is only meaningful under an
|
|
158
|
+
* integral or Laplace transform). For symbolic inputs, returns an
|
|
159
|
+
* unevaluated `dirac(x)` node.
|
|
160
|
+
*
|
|
161
|
+
* @param x - The input expression.
|
|
162
|
+
* @returns The Dirac delta value or symbolic node.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* dirac(Expression.create(5)).text() // "0"
|
|
167
|
+
* dirac(Expression.create(0)).text() // "dirac(0)"
|
|
168
|
+
* dirac(Expression.create('t')).text() // "dirac(t)"
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function dirac(x: Expression): Expression;
|
|
172
|
+
/**
|
|
173
|
+
* Evaluates a numeric expression to a finite number of significant decimal digits.
|
|
174
|
+
*
|
|
175
|
+
* Exact rational results are converted to decimal-origin values so subsequent numerical
|
|
176
|
+
* arithmetic does not keep expanding their numerators and denominators. Symbolic results
|
|
177
|
+
* remain symbolic after evaluation.
|
|
178
|
+
*
|
|
179
|
+
* @param x - Expression to evaluate numerically.
|
|
180
|
+
* @param precision - Significant digits to retain. Defaults to the active Nerdamer precision.
|
|
181
|
+
* @returns The evaluated numeric value at the requested precision, or the evaluated symbolic result.
|
|
182
|
+
*/
|
|
183
|
+
export declare function numeric(x: ExpressionInput, precision?: ExpressionInput): Expression;
|
|
184
|
+
/**
|
|
185
|
+
* Rounds a number to the nth decimal place. If no precision is provided, rounds to
|
|
186
|
+
* the nearest integer.
|
|
187
|
+
*
|
|
188
|
+
* @param x - The expression to round.
|
|
189
|
+
* @param n - The number of decimal places to round. Defaults to `0`.
|
|
190
|
+
* @returns The rounded value of `x`.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* round('3.7').text() // "4"
|
|
195
|
+
* round('2.555', 2).text() // "2.56"
|
|
196
|
+
* round('1/3', 4).text() // "0.3333"
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
export declare function round(x: ExpressionInput, n?: ExpressionInput): Expression;
|
|
200
|
+
/**
|
|
201
|
+
* Returns the sign of a number as `1`, `-1`, or `0`.
|
|
202
|
+
*
|
|
203
|
+
* For constant expressions that are not plain numerics, the expression is
|
|
204
|
+
* evaluated first to determine its sign.
|
|
205
|
+
*
|
|
206
|
+
* @param x - The expression whose sign to determine.
|
|
207
|
+
* @returns `1`, `-1`, or `0` as an Expression, or a symbolic `sign(x)` node.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* sign(5).text() // "1"
|
|
212
|
+
* sign(-3).text() // "-1"
|
|
213
|
+
* sign(0).text() // "0"
|
|
214
|
+
* sign('x').text() // "sign(x)"
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
export declare function sign(x: ExpressionInput): Expression;
|
|
218
|
+
/**
|
|
219
|
+
* Rounds a number down to the nearest integer (floor function).
|
|
220
|
+
*
|
|
221
|
+
* @param x - The expression to round down.
|
|
222
|
+
* @returns The greatest integer less than or equal to `x`.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* floor('3.7').text() // "3"
|
|
227
|
+
* floor('-2.3').text() // "-3"
|
|
228
|
+
* floor(5).text() // "5"
|
|
229
|
+
* floor('x').text() // "floor(x)"
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export declare function floor(x: ExpressionInput): Expression;
|
|
233
|
+
/**
|
|
234
|
+
* Rounds a number up to the nearest integer (ceiling function).
|
|
235
|
+
*
|
|
236
|
+
* @param x - The expression to round up.
|
|
237
|
+
* @returns The least integer greater than or equal to `x`.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* ceiling('3.2').text() // "4"
|
|
242
|
+
* ceiling('-2.7').text() // "-2"
|
|
243
|
+
* ceiling(5).text() // "5"
|
|
244
|
+
* ceiling('x').text() // "ceil(x)"
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
export declare function ceiling(x: ExpressionInput): Expression;
|
|
248
|
+
/**
|
|
249
|
+
* Computes the absolute value of an expression.
|
|
250
|
+
*
|
|
251
|
+
* Applies symbolic simplifications where possible:
|
|
252
|
+
* - Even powers are recognised as non-negative (e.g. `abs(x^2)` returns `x^2`).
|
|
253
|
+
* - Complex inputs use the modulus: `abs(a + bi) = sqrt(a² + b²)`.
|
|
254
|
+
* - Fully negative sums are negated (e.g. `abs(-x - y)` becomes `x + y`).
|
|
255
|
+
*
|
|
256
|
+
* @param x - The expression to take the absolute value of.
|
|
257
|
+
* @returns The absolute value of `x`.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* abs(-5).text() // "5"
|
|
262
|
+
* abs('3/4').text() // "3/4"
|
|
263
|
+
* abs('x^2').text() // "x^2"
|
|
264
|
+
* abs('x').text() // "abs(x)"
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export declare function abs(x: ExpressionInput): Expression;
|
|
268
|
+
/**
|
|
269
|
+
* Computes the modular multiplicative inverse of `a` modulo `p` using the
|
|
270
|
+
* extended Euclidean algorithm. That is, finds `t` such that `a * t ≡ 1 (mod p)`.
|
|
271
|
+
*
|
|
272
|
+
* @param a - The number whose modular inverse is to be calculated.
|
|
273
|
+
* @param p - The modulus (typically prime).
|
|
274
|
+
* @returns The modular inverse of `a` mod `p`.
|
|
275
|
+
* @throws {@link core!MathError} If the inverse does not exist (i.e. `gcd(a, p) ≠ 1`).
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* modInv(Expression.create(3), Expression.create(7)).text() // "5"
|
|
280
|
+
* modInv(Expression.create(10), Expression.create(17)).text() // "12"
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export declare function modInv(a: Expression, p: Expression): Expression;
|
|
284
|
+
/**
|
|
285
|
+
* Computes the modulo (remainder) of `x` divided by `y`.
|
|
286
|
+
*
|
|
287
|
+
* @param x - The dividend.
|
|
288
|
+
* @param y - The divisor.
|
|
289
|
+
* @returns The remainder of `x / y`.
|
|
290
|
+
* @throws {@link core!UndefinedError} If either `x` or `y` is `±∞`.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* mod(Expression.create(10), Expression.create(3)).text() // "1"
|
|
295
|
+
* mod(Expression.create(7), Expression.create(2)).text() // "1"
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export declare function mod(x: Expression, y: Expression): Expression;
|
|
299
|
+
/**
|
|
300
|
+
* Computes the gamma function Γ(x).
|
|
301
|
+
*
|
|
302
|
+
* - For positive integers: `Γ(n) = (n − 1)!`
|
|
303
|
+
* - For half-integers (e.g. `1/2`, `3/2`, `-3/2`): returns a closed-form
|
|
304
|
+
* expression involving `sqrt(π)`.
|
|
305
|
+
* - For other numeric values: uses a high-precision decimal approximation.
|
|
306
|
+
* - For symbolic inputs: returns an unevaluated `gamma(x)` node.
|
|
307
|
+
*
|
|
308
|
+
* @param x - The input expression.
|
|
309
|
+
* @returns The gamma function value Γ(x).
|
|
310
|
+
* @throws {@link core!UndefinedError} If `x` is `-∞`.
|
|
311
|
+
*
|
|
312
|
+
* @see https://en.wikipedia.org/wiki/Gamma_function
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```ts
|
|
316
|
+
* gamma(Expression.create(5)).text() // "24"
|
|
317
|
+
* gamma(Expression.create('1/2')).text() // "sqrt(pi)"
|
|
318
|
+
* gamma(Expression.create('x')).text() // "gamma(x)"
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
export declare function gamma(x: Expression): Expression;
|
|
322
|
+
/**
|
|
323
|
+
* Computes the complementary error function: `erfc(x) = 1 − erf(x)`.
|
|
324
|
+
*
|
|
325
|
+
* @param x - The input expression.
|
|
326
|
+
* @returns The complementary error function value.
|
|
327
|
+
*
|
|
328
|
+
* @see {@link erf}
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* erfc(Expression.create(0)).text() // "0"
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
export declare function erfc(x: Expression): Expression;
|
|
336
|
+
/**
|
|
337
|
+
* Computes the error function erf(x).
|
|
338
|
+
*
|
|
339
|
+
* - `erf(+∞) = 1`, `erf(−∞) = −1`
|
|
340
|
+
* - For numeric inputs, returns a high-precision decimal approximation.
|
|
341
|
+
* - For symbolic inputs, returns an unevaluated `erf(x)` node.
|
|
342
|
+
*
|
|
343
|
+
* @param x - The input expression.
|
|
344
|
+
* @returns The error function value.
|
|
345
|
+
*
|
|
346
|
+
* @see https://en.wikipedia.org/wiki/Error_function
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* erf(Expression.create(0)).text() // "0"
|
|
351
|
+
* erf(Expression.create('x')).text() // "erf(x)"
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
export declare function erf(x: Expression): Expression;
|
|
355
|
+
/**
|
|
356
|
+
* Computes the normalized sinc function: `sinc(x) = sin(x) / x`.
|
|
357
|
+
*
|
|
358
|
+
* By convention, `sinc(0) = 1` (the removable singularity).
|
|
359
|
+
* The function is even: `sinc(-x) = sinc(x)`.
|
|
360
|
+
*
|
|
361
|
+
* @param x - The input expression.
|
|
362
|
+
* @returns The sinc function value.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* sinc(Expression.create(0)).text() // "1"
|
|
367
|
+
* sinc(Expression.create('x')).text() // "sinc(x)"
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
export declare function sinc(x: Expression): Expression;
|
|
371
|
+
/**
|
|
372
|
+
* Computes the sine integral: `Si(x) = ∫₀ˣ sin(t)/t dt`.
|
|
373
|
+
*
|
|
374
|
+
* - `Si(+∞) = π/2`, `Si(−∞) = −π/2`
|
|
375
|
+
* - `Si(0) = 0`
|
|
376
|
+
* - The function is odd: `Si(-x) = -Si(x)`.
|
|
377
|
+
*
|
|
378
|
+
* @param x - The input expression.
|
|
379
|
+
* @returns The sine integral value.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```ts
|
|
383
|
+
* Si(Expression.create(0)).text() // "0"
|
|
384
|
+
* Si(Expression.create('x')).text() // "Si(x)"
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
export declare function Si(x: Expression): Expression;
|
|
388
|
+
/**
|
|
389
|
+
* Computes the hyperbolic sine integral: `Shi(x) = ∫₀ˣ sinh(t)/t dt`.
|
|
390
|
+
*
|
|
391
|
+
* - `Shi(+∞) = +∞`, `Shi(−∞) = −∞`
|
|
392
|
+
* - `Shi(0) = 0`
|
|
393
|
+
* - The function is odd: `Shi(-x) = -Shi(x)`.
|
|
394
|
+
*
|
|
395
|
+
* @param x - The input expression.
|
|
396
|
+
* @returns The hyperbolic sine integral value.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* Shi(Expression.create(0)).text() // "0"
|
|
401
|
+
* Shi(Expression.create('x')).text() // "Shi(x)"
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
export declare function Shi(x: Expression): Expression;
|
|
405
|
+
/**
|
|
406
|
+
* Computes the cosine integral: `Ci(x) = γ + ln(x) + ∫₀ˣ (cos(t)−1)/t dt`,
|
|
407
|
+
* where γ is the Euler–Mascheroni constant.
|
|
408
|
+
*
|
|
409
|
+
* - `Ci(+∞) = 0`, `Ci(−∞) = 0`
|
|
410
|
+
* - `Ci(0) = −∞`
|
|
411
|
+
* - The function is even for the principal branch: `Ci(-x) = Ci(x)`.
|
|
412
|
+
*
|
|
413
|
+
* @param x - The input expression.
|
|
414
|
+
* @returns The cosine integral value.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* Ci(Expression.create('x')).text() // "Ci(x)"
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
export declare function Ci(x: Expression): Expression;
|
|
422
|
+
/**
|
|
423
|
+
* Computes the hyperbolic cosine integral: `Chi(x) = γ + ln(x) + ∫₀ˣ (cosh(t)−1)/t dt`,
|
|
424
|
+
* where γ is the Euler–Mascheroni constant.
|
|
425
|
+
*
|
|
426
|
+
* - `Chi(±∞) = +∞`
|
|
427
|
+
* - `Chi(0) = −∞`
|
|
428
|
+
* - The function is even for the principal branch: `Chi(-x) = Chi(x)`.
|
|
429
|
+
*
|
|
430
|
+
* @param x - The input expression.
|
|
431
|
+
* @returns The hyperbolic cosine integral value.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* Chi(Expression.create('x')).text() // "Chi(x)"
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
export declare function Chi(x: Expression): Expression;
|
|
439
|
+
/**
|
|
440
|
+
* Computes the exponential integral: `Ei(x) = −∫₋ₓ^∞ e^(−t)/t dt` (Cauchy principal value).
|
|
441
|
+
*
|
|
442
|
+
* - `Ei(+∞) = +∞`, `Ei(−∞) = 0`
|
|
443
|
+
* - `Ei(0) = −∞`
|
|
444
|
+
*
|
|
445
|
+
* @param x - The input expression.
|
|
446
|
+
* @returns The exponential integral value.
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```ts
|
|
450
|
+
* Ei(Expression.create(0)).text() // "-Infinity"
|
|
451
|
+
* Ei(Expression.create('x')).text() // "Ei(x)"
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
export declare function Ei(x: Expression): Expression;
|
|
455
|
+
/**
|
|
456
|
+
* Computes the logarithmic integral: `Li(x) = ∫₀ˣ 1/ln(t) dt`.
|
|
457
|
+
*
|
|
458
|
+
* - `Li(+∞) = +∞`
|
|
459
|
+
* - `Li(1) = −∞` (the function has a logarithmic singularity at 1)
|
|
460
|
+
* - For negative numeric inputs, returns the symbolic form.
|
|
461
|
+
*
|
|
462
|
+
* @param x - The input expression.
|
|
463
|
+
* @returns The logarithmic integral value.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```ts
|
|
467
|
+
* Li(Expression.create('x')).text() // "Li(x)"
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export declare function Li(x: Expression): Expression;
|
|
471
|
+
/**
|
|
472
|
+
* Computes the natural (base-e) logarithm, or optionally a logarithm with a specified base.
|
|
473
|
+
*
|
|
474
|
+
* When `Settings.EVALUATE` is `false`, real-domain logarithm identities are
|
|
475
|
+
* applied only when their arguments are provably positive real values. This
|
|
476
|
+
* keeps product, quotient, and power rewrites from crossing principal complex
|
|
477
|
+
* branches when a symbolic sign is unknown.
|
|
478
|
+
*
|
|
479
|
+
* For known negative real inputs, returns `log(|x|) + iπ`. Complex inputs use the
|
|
480
|
+
* principal branch: `log(z) = log|z| + i·arg(z)`.
|
|
481
|
+
*
|
|
482
|
+
* @param x - The expression to take the logarithm of.
|
|
483
|
+
* @param base - Optional logarithm base. Defaults to `e` (natural log).
|
|
484
|
+
* @param expandPrimes - When `true`, decomposes integer arguments into prime factors
|
|
485
|
+
* (e.g. `log(8)` becomes `3·log(2)`). Defaults to `false`.
|
|
486
|
+
* @returns The logarithm of `x`.
|
|
487
|
+
* @throws {@link core!UndefinedError} If `x` is `-∞`.
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* log('e').text() // "1"
|
|
492
|
+
* log(1).text() // "0"
|
|
493
|
+
* log('e^x').text() // "x"
|
|
494
|
+
*
|
|
495
|
+
* // With base
|
|
496
|
+
* log(8, 2).text() // "3"
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
export declare function log(x: ExpressionInput, base?: ExpressionInput, expandPrimes?: boolean): Expression;
|
|
500
|
+
/**
|
|
501
|
+
* Returns the maximum value from a set of expressions.
|
|
502
|
+
*
|
|
503
|
+
* If all arguments can be compared numerically (or have assumed numeric values),
|
|
504
|
+
* returns the largest. Otherwise returns a symbolic `max(...)` node.
|
|
505
|
+
*
|
|
506
|
+
* @param args - Two or more expressions to compare.
|
|
507
|
+
* @returns The maximum value, or a symbolic `max(...)` node.
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```ts
|
|
511
|
+
* max(1, 3, 2).text() // "3"
|
|
512
|
+
* max(-5, 0).text() // "0"
|
|
513
|
+
* max('x', 'y').text() // "max(x, y)"
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
export declare function max(...args: ExpressionInput[]): Expression;
|
|
517
|
+
/**
|
|
518
|
+
* Returns the minimum value from a set of expressions.
|
|
519
|
+
*
|
|
520
|
+
* If all arguments can be compared numerically (or have assumed numeric values),
|
|
521
|
+
* returns the smallest. Otherwise returns a symbolic `min(...)` node.
|
|
522
|
+
*
|
|
523
|
+
* @param args - Two or more expressions to compare.
|
|
524
|
+
* @returns The minimum value, or a symbolic `min(...)` node.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```ts
|
|
528
|
+
* min(1, 3, 2).text() // "1"
|
|
529
|
+
* min(-5, 0).text() // "-5"
|
|
530
|
+
* min('x', 'y').text() // "min(x, y)"
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
export declare function min(...args: ExpressionInput[]): Expression;
|
|
534
|
+
/**
|
|
535
|
+
* Computes the exponential function e^x.
|
|
536
|
+
*
|
|
537
|
+
* - `exp(0) = 1`
|
|
538
|
+
* - `exp(+∞) = +∞`, `exp(−∞) = 0`
|
|
539
|
+
* - For complex inputs `a + bi` where both parts are numeric, applies Euler's formula:
|
|
540
|
+
* `exp(a + bi) = exp(a) · (cos(b) + i·sin(b))`.
|
|
541
|
+
* - For symbolic inputs, returns `e^(x)`.
|
|
542
|
+
*
|
|
543
|
+
* @param x - The exponent expression.
|
|
544
|
+
* @returns The value of e raised to the power `x`.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```ts
|
|
548
|
+
* exp(0).text() // "1"
|
|
549
|
+
* exp(1).text() // "2.71828182845904..."
|
|
550
|
+
* exp('x').text() // "e^(x)"
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
export declare function exp(x: ExpressionInput): Expression;
|
|
554
|
+
/**
|
|
555
|
+
* Constructs a {@link Matrix} from the provided rows.
|
|
556
|
+
*
|
|
557
|
+
* Each argument is an array representing one row of the matrix. All rows must
|
|
558
|
+
* have the same length; elements are converted to {@link Expression} instances.
|
|
559
|
+
*
|
|
560
|
+
* @param args - One or more arrays, each representing one row of the matrix.
|
|
561
|
+
* @returns A new {@link Matrix} instance.
|
|
562
|
+
* @throws {@link core!MathError} If rows have inconsistent lengths.
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* ```ts
|
|
566
|
+
* // 2×2 identity matrix
|
|
567
|
+
* matrix([1, 0], [0, 1]).text() // "matrix([1, 0], [0, 1])"
|
|
568
|
+
*
|
|
569
|
+
* // 2×3 matrix
|
|
570
|
+
* matrix([1, 2, 3], [4, 5, 6]).text()
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
export declare function matrix(...args: (NerdamerInput[] | Vector)[]): Matrix;
|
|
574
|
+
/**
|
|
575
|
+
* Computes a finite summation: `sum(expr, k, a, b) = Σ_{k=a}^{b} expr`.
|
|
576
|
+
*
|
|
577
|
+
* - If bounds are integers and the number of terms ≤ `Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION`,
|
|
578
|
+
* evaluates by accumulating each term.
|
|
579
|
+
* - If `lower > upper`, returns `0` (empty range).
|
|
580
|
+
* - If `expr` does not depend on the index variable, simplifies to `expr · (b − a + 1)`.
|
|
581
|
+
* - Otherwise returns a symbolic `sum(expr, k, a, b)` node.
|
|
582
|
+
*
|
|
583
|
+
* @param expr - The expression to be summed.
|
|
584
|
+
* @param index - The index variable (must be a plain symbol).
|
|
585
|
+
* @param lower - The lower bound (integer required for evaluation).
|
|
586
|
+
* @param upper - The upper bound (integer required for evaluation).
|
|
587
|
+
* @returns The summation result or a symbolic `sum` node.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```ts
|
|
591
|
+
* // Σ_{k=1}^{5} k = 15
|
|
592
|
+
* sum('k', 'k', 1, 5).text() // "15"
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
export declare function sum(expr: Expression, index: Expression, lower: Expression, upper: Expression): Expression;
|
|
596
|
+
/**
|
|
597
|
+
* Computes a finite product: `product(expr, k, a, b) = Π_{k=a}^{b} expr`.
|
|
598
|
+
*
|
|
599
|
+
* - If bounds are integers and the number of terms ≤ `Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION`,
|
|
600
|
+
* evaluates by multiplying each term.
|
|
601
|
+
* - If `lower > upper`, returns `1` (empty product).
|
|
602
|
+
* - If `expr` does not depend on the index variable, simplifies to `expr^(b − a + 1)`.
|
|
603
|
+
* - Otherwise returns a symbolic `product(expr, k, a, b)` node.
|
|
604
|
+
*
|
|
605
|
+
* @param expr - The expression to be multiplied.
|
|
606
|
+
* @param index - The index variable (must be a plain symbol).
|
|
607
|
+
* @param lower - The lower bound (integer required for evaluation).
|
|
608
|
+
* @param upper - The upper bound (integer required for evaluation).
|
|
609
|
+
* @returns The product result or a symbolic `product` node.
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```ts
|
|
613
|
+
* // Π_{k=1}^{5} k = 120 (same as 5!)
|
|
614
|
+
* product('k', 'k', 1, 5).text() // "120"
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
export declare function product(expr: Expression, index: Expression, lower: Expression, upper: Expression): Expression;
|
|
618
|
+
/**
|
|
619
|
+
* Calculates the definite integral using Adaptive Simpson. Note that this function uses
|
|
620
|
+
* native JS number due to severe computational overhead when implemented with Decimal.js.
|
|
621
|
+
*
|
|
622
|
+
* @param f The function being integrated
|
|
623
|
+
* @param dx The variable of integration
|
|
624
|
+
* @param from The lower limit of the integral
|
|
625
|
+
* @param to The upper limit of the integral
|
|
626
|
+
* @returns The numeric value if possible else a symbolic function
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* defint('cos(x)-x^2+6', 'x', 1, 6); // -42.787553149673464
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
export declare function defint(f: ExpressionInput, dx: ExpressionInput, from: ExpressionInput, to: ExpressionInput): Expression;
|
|
634
|
+
/**
|
|
635
|
+
* Tests whether a value is present in a supported finite container.
|
|
636
|
+
*
|
|
637
|
+
* @remarks
|
|
638
|
+
* `Vector` membership uses the vector's element equality, while `ValuesSet` and
|
|
639
|
+
* `SolutionSet` delegate to their semantic set membership. `Dictionary` membership checks
|
|
640
|
+
* keys rather than stored values. Unsupported container types remain symbolic.
|
|
641
|
+
*
|
|
642
|
+
* @param x - Vector, finite set, solution set, or dictionary to search.
|
|
643
|
+
* @param value - Value to look up, or dictionary key when `x` is a Dictionary.
|
|
644
|
+
* @returns `1` when the value is found and `0` otherwise.
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* ```ts
|
|
648
|
+
* const d = Parser.parse('{x=>1, y=>a}') as Dictionary;
|
|
649
|
+
* contains(d, 'x').text(); // 1
|
|
650
|
+
*
|
|
651
|
+
* const v = new Vector(['x', 1, 2]);
|
|
652
|
+
* contains(v, 10).text(); // 0
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
export declare function contains(x: Expression | Vector | ValuesSet | SolutionSet | Dictionary, value: ExpressionInput): Expression;
|