JavaScript / TypeScript API

nerdamer API

The default import is both a function and an object with additional public functions and properties attached to it. This page presents those members using the syntax you write in JavaScript or TypeScript.

Call Nerdamer

nerdamer(e: ExpressionInput, values?: ParserValuesObject): ParserEntity

Parses Nerdamer notation into a supported parser entity. The returned runtime type depends on the notation and can be an Expression, equation, or structured parser value. Use the corresponding class type guard before calling type-specific methods.

remarks

Entries in

`values`

are substituted while parsing and take precedence over known parser values, including otherwise restricted names. Parser and registration settings are shared by this module-level Nerdamer instance.

Examples

nerdamer('x+2*x+1').text(); 						// '1+3*x'
nerdamer('2*[a, b, 3]').text(); 					// '[2*a, 2*b, 6]'
nerdamer('x+6*y+a', {x: 1, y: 2, a:'t'}).text(); // '13+t'

// Evaluation allows even restricted variables to be overridden
nerdamer('e+pi', {π: 1, e: 2}).text(); // '2+pi'
Attached functions are JavaScript calls. nerdamer.pretty(...) and nerdamer.factor(...) call functions attached to the imported nerdamer value. They are different from writing pretty(...) or factor(...) inside a Nerdamer expression string.

Functions

nerdamer.abs(x: ExpressionInput): ExpressionFunction

Computes the absolute value of an expression. Applies symbolic simplifications where possible: - Even powers are recognised as non-negative (e.g. `abs(x^2)` returns `x^2`). - Complex inputs use the modulus: `abs(a + bi) = sqrt(a² + b²)`. - Fully negative sums are negated (e.g. `abs(-x - y)` becomes `x + y`).

nerdamer.acos(x: ExpressionInput): ExpressionFunction

Computes the arccosine (inverse cosine) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → π/2`, `1/2 → π/3`, `1/√2 → π/4`, `√3/2 → π/6`, `1 → 0`. Uses the identity `acos(-x) = π − acos(x)` for negative arguments. For numeric inputs outside `[-1, 1]`, returns a complex result via `π/2 + asin(|x|)` with the appropriate sign adjustment.

nerdamer.acosh(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic cosine of an expression. - `acosh(1) = 0` - `acosh(0) = iπ/2` - `acosh(+∞) = +∞` - For inputs less than 1, returns a complex result via `log(x + sqrt(x²−1))`.

nerdamer.acot(x: ExpressionInput): ExpressionFunction

Computes the arccotangent (inverse cotangent) of an expression: `acot(x) = atan(1/x)`. At infinity: `acot(+∞) = 0`, `acot(−∞) = π`.

nerdamer.acoth(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic cotangent of an expression: `acoth(x) = atanh(1/x)`. - `acoth(±∞) = 0` - For real evaluation, uses the identity `acoth(x) = (1/2)·ln((x + 1)/(x − 1))`.

nerdamer.acsc(x: ExpressionInput): ExpressionFunction

Computes the arccosecant (inverse cosecant) of an expression: `acsc(x) = asin(1/x)`. At infinity: `acsc(±∞) = 0`.

nerdamer.acsch(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic cosecant of an expression: `acsch(x) = asinh(1/x)`. - `acsch(±∞) = 0` - For real evaluation, uses the identity `acsch(x) = ln((1 + sqrt(1/x² + 1))/x)`.

nerdamer.aliasOperator(symbol: string, alias: string): typeof nerdamerFunction

Aliases an existing parser operator and returns the root API for chaining.

nerdamer.arccos(x: ExpressionInput): ExpressionFunction

Computes the arccosine (inverse cosine) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → π/2`, `1/2 → π/3`, `1/√2 → π/4`, `√3/2 → π/6`, `1 → 0`. Uses the identity `acos(-x) = π − acos(x)` for negative arguments. For numeric inputs outside `[-1, 1]`, returns a complex result via `π/2 + asin(|x|)` with the appropriate sign adjustment.

nerdamer.arcsin(x: ExpressionInput): ExpressionFunction

Computes the arcsine (inverse sine) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → 0`, `1/2 → π/6`, `1/√2 → π/4`, `√3/2 → π/3`, `1 → π/2`. Uses the identity `asin(-x) = -asin(x)` for negative arguments. For numeric inputs outside `[-1, 1]`, returns a complex result.

nerdamer.arctan(x: ExpressionInput): ExpressionFunction

Computes the arctangent (inverse tangent) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → 0`, `1/√3 → π/6`, `1 → π/4`, `√3 → π/3`. Uses the identity `atan(-x) = -atan(x)` for negative arguments. At infinity: `atan(+∞) = π/2`, `atan(−∞) = −π/2`.

nerdamer.arg(x: ExpressionInput): ExpressionFunction

Returns the argument of an expression

nerdamer.asec(x: ExpressionInput): ExpressionFunction

Computes the arcsecant (inverse secant) of an expression: `asec(x) = acos(1/x)`. At infinity: `asec(±∞) = π/2`.

nerdamer.asech(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic secant of an expression: `asech(x) = acosh(1/x)`. For real evaluation, uses the identity `asech(x) = ln((1 + sqrt(1/x² − 1))/x)`.

nerdamer.asin(x: ExpressionInput): ExpressionFunction

Computes the arcsine (inverse sine) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → 0`, `1/2 → π/6`, `1/√2 → π/4`, `√3/2 → π/3`, `1 → π/2`. Uses the identity `asin(-x) = -asin(x)` for negative arguments. For numeric inputs outside `[-1, 1]`, returns a complex result.

nerdamer.asinh(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic sine of an expression. - `asinh(0) = 0` - `asinh(+∞) = +∞`, `asinh(−∞) = −∞` - For complex inputs, uses `log(x + sqrt(x² + 1))`.

nerdamer.assume(expr: string): AssumptionFunction

Registers a process-wide numeric interval assumption.

nerdamer.atan(x: ExpressionInput): ExpressionFunction

Computes the arctangent (inverse tangent) of an expression. Returns exact symbolic values involving π for well-known inputs: `0 → 0`, `1/√3 → π/6`, `1 → π/4`, `√3 → π/3`. Uses the identity `atan(-x) = -atan(x)` for negative arguments. At infinity: `atan(+∞) = π/2`, `atan(−∞) = −π/2`.

nerdamer.atan2(y: ExpressionInput, x: ExpressionInput): ExpressionFunction

Computes the two-argument arctangent `atan2(y, x)`, which returns the angle in radians between the positive x-axis and the point `(x, y)`. Unlike atan, `atan2` correctly handles all four quadrants and returns values in the range `(−π, π]`. Returns exact multiples of π where possible.

nerdamer.atanh(x: ExpressionInput): ExpressionFunction

Computes the inverse hyperbolic tangent of an expression. - `atanh(0) = 0` - For inputs outside `(-1, 1)` or complex inputs, uses the identity `atanh(z) = (1/2)·ln((1 + z)/(1 − z))`.

nerdamer.buildFunction(x: ExpressionInput, argsArray?: string[]): (...args: number[]): numberFunction

Compiles an expression into a native JavaScript-number function.

nerdamer.cbrt(x: ExpressionInput): ExpressionFunction

Computes the cube root of an expression. For real numeric constants, the *real* cube root is returned (so negative reals stay real). For complex constants, the principal cube root is used. Nested cube roots are simplified (e.g. `cbrt(cbrt(x))` becomes `x^(1/9)`). Unlike sqrt, `cbrt` is preserved as a function node rather than rewritten to `x^(1/3)` to avoid principal-branch issues during symbolic manipulation.

nerdamer.ceil(x: ExpressionInput): ExpressionFunction

Rounds a number up to the nearest integer (ceiling function).

nerdamer.Chi(x: Expression): ExpressionFunction

Computes the hyperbolic cosine integral: `Chi(x) = γ + ln(x) + ∫₀ˣ (cosh(t)−1)/t dt`, where γ is the Euler–Mascheroni constant. - `Chi(±∞) = +∞` - `Chi(0) = −∞` - The function is even for the principal branch: `Chi(-x) = Chi(x)`.

nerdamer.Ci(x: Expression): ExpressionFunction

Computes the cosine integral: `Ci(x) = γ + ln(x) + ∫₀ˣ (cos(t)−1)/t dt`, where γ is the Euler–Mascheroni constant. - `Ci(+∞) = 0`, `Ci(−∞) = 0` - `Ci(0) = −∞` - The function is even for the principal branch: `Ci(-x) = Ci(x)`.

nerdamer.clearVars(): typeof nerdamerFunction

Clears all known parser values.

nerdamer.contains(x: Expression | Vector | ValuesSet | Dictionary | SolutionSet, value: ExpressionInput): ExpressionFunction

Tests whether a value is present in a supported finite container.

nerdamer.content(x: ExpressionInput | Polynomial): ExpressionFunction

Returns the exact rational content of polynomial expression input.

nerdamer.convertFromLaTeX(TeX: string): ParserEntityFunction

Parses the supported TeX subset into a Nerdamer parser entity.

nerdamer.convertToLaTeX(expression: string | ParserEntity, options?: TeXOptions): stringFunction

Converts an expression to TeX without requiring the caller to construct a converter. String input follows the legacy source-preserving path before symbolic normalization; entity input keeps ordinary structured Converter behavior.

nerdamer.cos(x: ExpressionInput): ExpressionFunction

Computes the cosine of an expression. Returns exact symbolic values for well-known multiples of π (π/6, π/4, π/3, π/2, π, etc.). Cosine is an even function: `cos(-x)` automatically simplifies to `cos(x)`. Inverse trig compositions are resolved: - `cos(acos(x))` returns `x` - `cos(asin(x))` returns `sqrt(1 − x²)` - `cos(atan(x))` returns `1/sqrt(1 + x²)`

nerdamer.cosh(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic cosine of an expression. - `cosh(0) = 1` - `cosh(±∞) = +∞` - For complex inputs: `cosh(a + bi) = cosh(a)·cos(b) + i·sinh(a)·sin(b)`

nerdamer.cot(x: ExpressionInput): ExpressionFunction

Computes the cotangent of an expression: `cot(x) = cos(x)/sin(x)`. Returns exact values at well-known angles by dividing cos by sin.

nerdamer.coth(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic cotangent of an expression: `coth(x) = 1/tanh(x)`. - `coth(+∞) = 1`, `coth(−∞) = −1` - `coth(0)` is undefined.

nerdamer.cross(a: ParserEntity, b: ParserEntity): Expression | VectorFunction

Computes a three-dimensional cross product or preserves symbolic operands.

nerdamer.csc(x: ExpressionInput): ExpressionFunction

Computes the cosecant of an expression: `csc(x) = 1/sin(x)`. Returns exact values at well-known angles by inverting the result of sin.

nerdamer.csch(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic cosecant of an expression: `csch(x) = 1/sinh(x)`. - `csch(±∞) = 0` - `csch(0)` is undefined.

nerdamer.defint(f: ExpressionInput, dx: ExpressionInput, from: ExpressionInput, to: ExpressionInput): ExpressionFunction

Calculates the definite integral using Adaptive Simpson. Note that this function uses native JS number due to severe computational overhead when implemented with Decimal.js.

nerdamer.deg(x: ExpressionInput | Polynomial): ExpressionFunction

Returns the total degree of polynomial expression input.

nerdamer.delta(x: Expression): ExpressionFunction

Computes the Dirac delta function (distribution). For non-zero numeric inputs, returns `0`. At `x = 0` the symbolic form `dirac(0)` is returned (the Dirac delta is only meaningful under an integral or Laplace transform). For symbolic inputs, returns an unevaluated `dirac(x)` node.

nerdamer.determinant(M: Matrix): ExpressionFunction

Computes the determinant without mutating the supplied Matrix.

nerdamer.dfact(x: Expression): ExpressionFunction

Computes the double factorial of an expression. For a non-negative integer n, the double factorial is the product of all positive integers up to n that share its parity: - Even: `n!! = 2 · 4 · 6 · … · n` - Odd: `n!! = 1 · 3 · 5 · … · n` For non-integer arguments when `Settings.EVALUATE` is `true`, a generalised formula using the gamma function is applied.

nerdamer.dfactorial(x: Expression): ExpressionFunction

Computes the double factorial of an expression. For a non-negative integer n, the double factorial is the product of all positive integers up to n that share its parity: - Even: `n!! = 2 · 4 · 6 · … · n` - Odd: `n!! = 1 · 3 · 5 · … · n` For non-integer arguments when `Settings.EVALUATE` is `true`, a generalised formula using the gamma function is applied.

nerdamer.diff(x: ExpressionInput, variable?: ExpressionInput, n?: number | Expression): ExpressionFunction

Differentiates an expression symbolically. The chain, product, sum, and power rules are applied recursively, together with the built-in derivative table for recognized functions. An omitted variable is inferred as the first variable in the expression. Existing Expression input is reused during normalization.

nerdamer.div(dividend: ExpressionInput, divisor: ExpressionInput): VectorFunction

Returns the quotient and remainder of polynomial division.

nerdamer.divide(dividend: ExpressionInput, divisor: ExpressionInput): ExpressionFunction

Divides two expressions using polynomial quotient/remainder reconstruction when possible.

nerdamer.dot(a: ParserEntity, b: ParserEntity): ExpressionFunction

Computes the dot product of two Vectors or preserves two symbolic operands.

nerdamer.Ei(x: Expression): ExpressionFunction

Computes the exponential integral: `Ei(x) = −∫₋ₓ^∞ e^(−t)/t dt` (Cauchy principal value). - `Ei(+∞) = +∞`, `Ei(−∞) = 0` - `Ei(0) = −∞`

nerdamer.erf(x: Expression): ExpressionFunction

Computes the error function erf(x). - `erf(+∞) = 1`, `erf(−∞) = −1` - For numeric inputs, returns a high-precision decimal approximation. - For symbolic inputs, returns an unevaluated `erf(x)` node.

nerdamer.erfc(x: Expression): ExpressionFunction

Computes the complementary error function: `erfc(x) = 1 − erf(x)`.

nerdamer.exp(x: ExpressionInput): ExpressionFunction

Computes the exponential function e^x. - `exp(0) = 1` - `exp(+∞) = +∞`, `exp(−∞) = 0` - For complex inputs `a + bi` where both parts are numeric, applies Euler's formula: `exp(a + bi) = exp(a) · (cos(b) + i·sin(b))`. - For symbolic inputs, returns `e^(x)`.

nerdamer.expand(x: Expression): ExpressionFunction

Expands the function by distributing the power and the multiplier whenever possible

nerdamer.fact(x: Expression): ExpressionFunction

Computes the factorial of an expression. For non-negative integers, returns the exact integer factorial. For half-integer arguments (e.g. `1/2`, `3/2`, `-1/2`), returns a closed-form expression involving `sqrt(π)`. When `Settings.EVALUATE` is `true` and the input is not an integer, falls back to the gamma function via Γ(x + 1).

nerdamer.factor(x: ExpressionInput): ExpressionFunction

Factors polynomial-like numerator and denominator components of an expression.

nerdamer.factorial(x: Expression): ExpressionFunction

Computes the factorial of an expression. For non-negative integers, returns the exact integer factorial. For half-integer arguments (e.g. `1/2`, `3/2`, `-1/2`), returns a closed-form expression involving `sqrt(π)`. When `Settings.EVALUATE` is `true` and the input is not an integer, falls back to the gamma function via Γ(x + 1).

nerdamer.fib(x: ExpressionInput): ExpressionFunction

Computes the Fibonacci number for an integer index. Integer inputs are evaluated exactly, including negative indices through the negafibonacci identity. Symbolic and non-integer inputs remain unevaluated.

nerdamer.floor(x: ExpressionInput): ExpressionFunction

Rounds a number down to the nearest integer (floor function).

nerdamer.functions(): { … }Function

Lists currently registered parser functions by registration level.

nerdamer.gamma(x: Expression): ExpressionFunction

Computes the gamma function Γ(x). - For positive integers: `Γ(n) = (n − 1)!` - For half-integers (e.g. `1/2`, `3/2`, `-3/2`): returns a closed-form expression involving `sqrt(π)`. - For other numeric values: uses a high-precision decimal approximation. - For symbolic inputs: returns an unevaluated `gamma(x)` node.

nerdamer.gcd(x: ExpressionInput, y: ExpressionInput): ExpressionFunction

Computes a symbolic greatest common divisor over rational polynomial structure.

nerdamer.get(setting: keyof SettingsType | "PRECISION"): number | bigint | boolean | "eng" | "spa"Function

Reads the current value of a shared parser setting. `PRECISION` mirrors the root setter's special handling and is read from the shared Rational/Decimal precision. Other settings delegate to the parser.

nerdamer.getConstant(name: string): stringFunction

Returns the current text registered for a parser constant. Built-in constants are generated at the active precision before being returned. As in the legacy API, an unknown constant is reported as the string `'undefined'`.

nerdamer.getOperator(symbol: string): Operator | undefinedFunction

Returns a detached snapshot of a registered parser operator.

nerdamer.getVars(option: "text" | "LaTeX"): Record<string, string>Function

Returns a snapshot of all known parser values in text or TeX form.

nerdamer.groebner(expressionArray: ExpressionInput[], vars?: string[]): VectorFunction

Computes an expression-facing Groebner basis for polynomial generators.

nerdamer.heaviside(x: Expression): ExpressionFunction

Computes the Heaviside step function (unit step function). Uses the half-maximum convention at the origin: - `heaviside(x) = 0` for `x < 0` - `heaviside(0) = 1/2` - `heaviside(x) = 1` for `x > 0` For symbolic inputs, returns an unevaluated `heaviside(x)` node.

nerdamer.hypot(a: Expression, b: Expression): ExpressionFunction

Returns the symbolic hypotenuse of two expressions. Matching linear sine and cosine terms collapse through the Pythagorean identity; otherwise the result is the principal square root of the sum of squares.

nerdamer.ilaplace(expr: ExpressionInput, s: ExpressionInput, t: ExpressionInput): ExpressionFunction

Computes a symbolic inverse Laplace transform from a transform variable to a time variable. The strategy applies linearity, extracts constants, consults the inverse transform table, normalizes supported shifted quadratics and exponential delays, and finally tries partial-fraction decomposition.

nerdamer.ilt(expr: ExpressionInput, s: ExpressionInput, t: ExpressionInput): ExpressionFunction

Computes a symbolic inverse Laplace transform from a transform variable to a time variable. The strategy applies linearity, extracts constants, consults the inverse transform table, normalizes supported shifted quadratics and exponential delays, and finally tries partial-fraction decomposition.

nerdamer.imagpart(a: Expression): ExpressionFunction

Retrieves the imaginary part of a complex number

nerdamer.imatrix(x: Expression): Expression | MatrixFunction

Creates an identity matrix of integer size.

nerdamer.integrate(expr: ExpressionInput, dx: ExpressionInput, depth: number): ExpressionFunction

Finds a symbolic indefinite integral with respect to a plain variable. Constants and linear sums are separated first. The remaining integrand is tried against the integral table and bounded strategies for radical and algebraic substitution, quadratic radicals, integration by parts, derivative-pattern substitution, rational decomposition, and the Weierstrass tangent half-angle substitution.

nerdamer.laplace(expr: ExpressionInput, t: ExpressionInput, s: ExpressionInput): ExpressionFunction

Computes a symbolic Laplace transform from a time variable to a transform variable. The expression is expanded, linear sums are transformed term by term, constants independent of the time variable are extracted, and the remaining expression is matched against the transform table.

nerdamer.lcm(x: ExpressionInput, y: ExpressionInput): ExpressionFunction

Returns the least common multiple of two expressions. Numeric inputs reuse exact `Rational` arithmetic. Polynomial expressions use the existing GCD normalization so shared symbolic factors are retained.

nerdamer.Li(x: Expression): ExpressionFunction

Computes the logarithmic integral: `Li(x) = ∫₀ˣ 1/ln(t) dt`. - `Li(+∞) = +∞` - `Li(1) = −∞` (the function has a logarithmic singularity at 1) - For negative numeric inputs, returns the symbolic form.

nerdamer.limit(expr: ExpressionInput, x: ExpressionInput, val: ExpressionInput, dir: LimitDir, depth: number): ExpressionFunction

Computes a symbolic finite or infinite limit. The implementation combines direct substitution, side-aware pole analysis, simplification, bounded L'Hopital recursion, indeterminate-form rewrites, composition rules, dominant-growth analysis at infinity, and a table of known limits.

nerdamer.log(x: ExpressionInput, base?: ExpressionInput, expandPrimes: boolean): ExpressionFunction

Computes the natural (base-e) logarithm, or optionally a logarithm with a specified base. When `Settings.EVALUATE` is `false`, real-domain logarithm identities are applied only when their arguments are provably positive real values. This keeps product, quotient, and power rewrites from crossing principal complex branches when a symbolic sign is unknown. For known negative real inputs, returns `log(|x|) + iπ`. Complex inputs use the principal branch: `log(z) = log|z| + i·arg(z)`.

nerdamer.matrix(...args: Vector | NerdamerInput[][]): MatrixFunction

Constructs a Matrix from the provided rows. Each argument is an array representing one row of the matrix. All rows must have the same length; elements are converted to Expression instances.

nerdamer.max(...args: ExpressionInput[]): ExpressionFunction

Returns the maximum value from a set of expressions. If all arguments can be compared numerically (or have assumed numeric values), returns the largest. Otherwise returns a symbolic `max(...)` node.

nerdamer.min(...args: ExpressionInput[]): ExpressionFunction

Returns the minimum value from a set of expressions. If all arguments can be compared numerically (or have assumed numeric values), returns the smallest. Otherwise returns a symbolic `min(...)` node.

nerdamer.mod(x: Expression, y: Expression): ExpressionFunction

Computes the modulo (remainder) of `x` divided by `y`.

nerdamer.modInv(a: Expression, p: Expression): ExpressionFunction

Computes the modular multiplicative inverse of `a` modulo `p` using the extended Euclidean algorithm. That is, finds `t` such that `a * t ≡ 1 (mod p)`.

nerdamer.nthroot(x: ExpressionInput, n: ExpressionInput): ExpressionFunction

Computes the nth root of an expression as its principal power.

nerdamer.partfrac(x: ExpressionInput, variable?: ExpressionInput): ExpressionFunction

Decomposes a rational expression P(x)/Q(x) into partial fractions.

nerdamer.polarform(x: Expression): ExpressionFunction

Calculates the polar from of a complex number //IMPROVE: Potential speed boost by just returning i.

nerdamer.pretty(e: string | ParserEntity, type: "text" | "TeX"): stringFunction

Formats a parser entity or notation string as TeX or normalized text.

nerdamer.product(expr: Expression, index: Expression, lower: Expression, upper: Expression): ExpressionFunction

Computes a finite product: `product(expr, k, a, b) = Π_{k=a}^{b} expr`. - If bounds are integers and the number of terms ≤ `Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION`, evaluates by multiplying each term. - If `lower > upper`, returns `1` (empty product). - If `expr` does not depend on the index variable, simplifies to `expr^(b − a + 1)`. - Otherwise returns a symbolic `product(expr, k, a, b)` node.

nerdamer.realpart(a: Expression): ExpressionFunction

Retrieves the real part of a complex number

nerdamer.rectform(x: ExpressionInput): ExpressionFunction

Attempts to convert a polar form complex to rectangular form. If no exact identity is found, the decimal representation in rectangular form is returned.

nerdamer.round(x: ExpressionInput, n?: ExpressionInput): ExpressionFunction

Rounds a number to the nth decimal place. If no precision is provided, rounds to the nearest integer.

nerdamer.sec(x: ExpressionInput): ExpressionFunction

Computes the secant of an expression: `sec(x) = 1/cos(x)`. Returns exact values at well-known angles by inverting the result of cos.

nerdamer.sech(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic secant of an expression: `sech(x) = 1/cosh(x)`. - `sech(0) = 1` - `sech(±∞) = 0`

nerdamer.set(setting: string | OptionsObject, value?: string | number | bigint | boolean): typeof nerdamerFunction

Changes one or more shared parser settings. The legacy `PRECISION` setting is routed through Parser.setPrecision so Decimal-backed calculations and the finite-precision `pi` and `e` constants remain synchronized.

nerdamer.setConstant(name: string, value: string | number): typeof nerdamerFunction

Registers or removes a parser constant using the legacy public entry point. Numeric values are converted to exact rational text before registration so they do not introduce decimal-formatting intent. The string `'delete'` removes the constant. Registration changes shared parser state.

nerdamer.setFunction(name: string, args: string[], body: string): typeof nerdamerFunction

Registers a symbolic function using the legacy public signature. Calls subsequently parsed with `name` substitute their arguments into `body` in the supplied order. Registration changes shared parser state.

nerdamer.setOperator(operator: OperatorInput, action?: OperatorFunction): typeof nerdamerFunction

Registers or updates a parser operator and returns the root API for chaining.

nerdamer.setVar(name: string, value: string | number): voidFunction

Sets a known parser value. Unlike a constant, a known value can be overridden by the values object supplied to a parse call.

nerdamer.Shi(x: Expression): ExpressionFunction

Computes the hyperbolic sine integral: `Shi(x) = ∫₀ˣ sinh(t)/t dt`. - `Shi(+∞) = +∞`, `Shi(−∞) = −∞` - `Shi(0) = 0` - The function is odd: `Shi(-x) = -Shi(x)`.

nerdamer.Si(x: Expression): ExpressionFunction

Computes the sine integral: `Si(x) = ∫₀ˣ sin(t)/t dt`. - `Si(+∞) = π/2`, `Si(−∞) = −π/2` - `Si(0) = 0` - The function is odd: `Si(-x) = -Si(x)`.

nerdamer.sign(x: ExpressionInput): ExpressionFunction

Returns the sign of a number as `1`, `-1`, or `0`. For constant expressions that are not plain numerics, the expression is evaluated first to determine its sign.

nerdamer.simplify(x: string | Expression, modifiers: { … }): ExpressionFunction

Applies Nerdamer's finite symbolic simplification strategy to an expression.

nerdamer.sin(x: ExpressionInput): ExpressionFunction

Computes the sine of an expression. Returns exact symbolic values for well-known multiples of π (π/6, π/4, π/3, π/2, π, etc.). Sine is an odd function: `sin(-x)` automatically simplifies to `-sin(x)`. Inverse trig compositions are resolved: - `sin(asin(x))` returns `x` - `sin(acos(x))` returns `sqrt(1 − x²)` - `sin(atan(x))` returns `x/sqrt(1 + x²)`

nerdamer.sinc(x: Expression): ExpressionFunction

Computes the normalized sinc function: `sinc(x) = sin(x) / x`. By convention, `sinc(0) = 1` (the removable singularity). The function is even: `sinc(-x) = sinc(x)`.

nerdamer.sinh(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic sine of an expression. - `sinh(0) = 0` - `sinh(+∞) = +∞`, `sinh(−∞) = −∞` - For complex inputs: `sinh(a + bi) = sinh(a)·cos(b) + i·cosh(a)·sin(b)`

nerdamer.solve(input: ExpressionInput | Equation, variable?: ExpressionInput, _options?: FunctionSolverOptions): SolutionSetFunction

Solves an equation or finds the zeros of an expression in one variable. The solver normalizes the input to `expression = 0`, tries direct symbolic transformations, factors numerator and denominator, and then applies symbolic, polynomial-numeric, and bounded function-numeric strategies to the factors. Zeros of denominator factors are excluded from the result.

nerdamer.solveeqs(equations: Vector | ExpressionInput | Equation[], variables?: string[]): VectorFunction

Solves a system of expressions or equations for an ordered set of variables. Expressions are interpreted as equal to zero. The solver first tries exact linear reduction, then a lexicographic Groebner basis with symbolic back substitution for polynomial systems, and finally bounded multivariate Newton-Raphson. Rational polynomial systems may have denominators cleared for symbolic work; candidates are checked against the original domain.

nerdamer.solveEquations(equations: Vector | ExpressionInput | Equation[], variables?: string[]): VectorFunction

Solves a system of expressions or equations for an ordered set of variables. Expressions are interpreted as equal to zero. The solver first tries exact linear reduction, then a lexicographic Groebner basis with symbolic back substitution for polynomial systems, and finally bounded multivariate Newton-Raphson. Rational polynomial systems may have denominators cleared for symbolic work; candidates are checked against the original domain.

nerdamer.solveSystem(equations: Vector | ExpressionInput | Equation[], variables?: string[]): VectorFunction

Solves a system of expressions or equations for an ordered set of variables. Expressions are interpreted as equal to zero. The solver first tries exact linear reduction, then a lexicographic Groebner basis with symbolic back substitution for polynomial systems, and finally bounded multivariate Newton-Raphson. Rational polynomial systems may have denominators cleared for symbolic work; candidates are checked against the original domain.

nerdamer.sqrt(x: ExpressionInput): ExpressionFunction

Computes the square root of an expression. Equivalent to raising to the power of 1/2. Nested square roots are automatically simplified (e.g. `sqrt(sqrt(x))` becomes `x^(1/4)`).

nerdamer.subst(expression: ExpressionInput, value: ExpressionInput, withValue: ExpressionInput, includeNumeric: boolean): ExpressionFunction

Replaces a value with another using the existing Expression tree.

nerdamer.sum(expr: Expression, index: Expression, lower: Expression, upper: Expression): ExpressionFunction

Computes a finite summation: `sum(expr, k, a, b) = Σ_{k=a}^{b} expr`. - If bounds are integers and the number of terms ≤ `Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION`, evaluates by accumulating each term. - If `lower > upper`, returns `0` (empty range). - If `expr` does not depend on the index variable, simplifies to `expr · (b − a + 1)`. - Otherwise returns a symbolic `sum(expr, k, a, b)` node.

nerdamer.symbols(...args: string[]): Record<string, Expression>Function

Creates frozen plain-variable Expressions keyed by their requested names.

nerdamer.tan(x: ExpressionInput): ExpressionFunction

Computes the tangent of an expression. Tangent is an odd function: `tan(-x)` automatically simplifies to `-tan(x)`. Returns `0` for all integer multiples of π. Inverse trig compositions are resolved: - `tan(atan(x))` returns `x` - `tan(asin(x))` returns `x/sqrt(1 − x²)` - `tan(acos(x))` returns `sqrt(1 − x²)/x`

nerdamer.tanh(x: ExpressionInput): ExpressionFunction

Computes the hyperbolic tangent of an expression. - `tanh(0) = 0` - `tanh(+∞) = 1`, `tanh(−∞) = −1` - For complex inputs, uses the identity `tanh(z) = sinh(z)/cosh(z)` with component-wise evaluation.

nerdamer.trunc(x: ExpressionInput): ExpressionFunction

Truncates a number toward zero. Numeric inputs discard their fractional part without changing the sign of the integer portion. Symbolic inputs remain unevaluated.

nerdamer.updateAPI(): typeof nerdamerFunction

Function exported by Nerdamer.

nerdamer.version(): stringFunction

Returns the package version declared by this Nerdamer build.

Properties

These values are attached to nerdamer but are not called as functions.

Errors

Error constructors can be imported directly from nerdamer/core. The full package also exposes the same constructors through nerdamer.errors for compatibility and reliable instanceof checks.

import nerdamer from 'nerdamer';
import { UnexpectedInputError } from 'nerdamer/core';

err instanceof UnexpectedInputError;
err instanceof nerdamer.errors.UnexpectedInputError;
nerdamer.errors.AssignmentErrorClass

Thrown when code attempts to assign to a reserved or otherwise non-assignable parser name.

nerdamer.errors.DimensionErrorClass

Thrown when vector, matrix, or structured-entity dimensions are incompatible.

nerdamer.errors.DivisionByZeroErrorClass

Thrown for exact division by zero. Small nonzero numerical values are not treated as zero.

nerdamer.errors.MathErrorClass

General mathematical precondition error for cases without a more specific error type.

nerdamer.errors.MissingReferenceErrorClass

Thrown when a named converter or pattern reference cannot be resolved.

nerdamer.errors.NaNErrorClass

Thrown when a required numeric conversion produces `NaN`.

nerdamer.errors.NotImplementedErrorClass

Used for recognized operations that have not been implemented yet.

nerdamer.errors.OperatorErrorClass

Used for invalid parser-operator definitions and operator dispatch failures.

nerdamer.errors.ParserErrorClass

General parser error for construction, evaluation, and registered-function failures.

nerdamer.errors.ParserSyntaxErrorClass

Parser syntax error kept separate from lower-level tokenization failures.

nerdamer.errors.PolynomialErrorClass

Thrown when input cannot be represented as a polynomial under the requested contract.

nerdamer.errors.UndefinedErrorClass

Used when a mathematical operation has no defined value in the handled domain.

nerdamer.errors.UnexpectedInputErrorClass

Used when input parses successfully but does not have the form an operation requires.

nerdamer.errors.UnexpectedTokenErrorClass

Thrown when tokenization encounters invalid adjacency, punctuation, or bracket structure.

nerdamer.errors.UnsupportedOperationErrorClass

Thrown when an operation is known but unsupported for the supplied form or domain.

nerdamer.errors.ZeroToZeroPowerErrorClass

Thrown for the indeterminate symbolic form `0^0`.

For user-defined symbolic functions, see User-defined functions.