The nerdamer object
nerdamer, the default import, is a function that reads Notation. It also has methods for most operations, and for variables, settings and output.
Calling nerdamer
nerdamer(e: ExpressionInput, values?: ParserValuesObject): ParserEntityParses 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. Most type-specific methods
still require the corresponding class guard. Full-package methods declared across all
parser results can be called directly; scalar-only methods such as buildFunction()
reject structured results at runtime.
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'nerdamer.factor('x^2-1') gives the same result as nerdamer('factor(x^2-1)'), but you call it from your code instead of writing it in the formula.Functions
nerdamer.abs(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes the arccotangent (inverse cotangent) of an expression: acot(x) = atan(1/x). At infinity: acot(+∞) = 0, acot(−∞) = π.
nerdamer.acoth(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes the arccosecant (inverse cosecant) of an expression: acsc(x) = asin(1/x). At infinity: acsc(±∞) = 0.
nerdamer.acsch(x: ExpressionInput): ExpressionFunctionComputes 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 nerdamerFunctionAliases an existing parser operator and returns the root API for chaining.
nerdamer.append(...args: [x, value]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.arccos(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acos.
nerdamer.arccosh(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acosh.
nerdamer.arccot(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acot.
nerdamer.arccoth(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acoth.
nerdamer.arccsc(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acsc.
nerdamer.arccsch(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.acsch.
nerdamer.arcsec(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.asec.
nerdamer.arcsech(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.asech.
nerdamer.arcsin(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.asin.
nerdamer.arcsinh(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.asinh.
nerdamer.arctan(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.atan.
nerdamer.arctanh(x: ExpressionInput): ExpressionFunctionAlias for nerdamer.atanh.
nerdamer.arg(x: ExpressionInput): ExpressionFunctionReturns the principal argument of a complex expression.
nerdamer.asec(x: ExpressionInput): ExpressionFunctionComputes the arcsecant (inverse secant) of an expression: asec(x) = acos(1/x). At infinity: asec(±∞) = π/2.
nerdamer.asech(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): AssumptionFunctionRegisters a numeric interval assumption in Nerdamer's global assumption state.
nerdamer.atan(x: ExpressionInput): ExpressionFunctionComputes 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. For complex arguments, uses the principal logarithmic branch, with logarithmic singularities at ±i. The negative imaginary-axis cut is selected by odd symmetry rather than the opposite bank of the cut. Reference: NIST DLMF §4.23, Inverse Trigonometric Functions, https://dlmf.nist.gov/4.23 At infinity: atan(+∞) = π/2, atan(−∞) = −π/2.
nerdamer.atan2(y: ExpressionInput, x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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.binom(n: ExpressionInput, k: ExpressionInput): ExpressionFunctionComputes an exact binomial coefficient for nonnegative integer n and integer k. Non-integer or unresolved arguments remain symbolic.
nerdamer.buildFunction(x: ExpressionInput, argsArray?: string[]): (...args: number[]): numberFunctionCompiles an expression into a native JavaScript-number function for repeated evaluation.
nerdamer.C(x: ExpressionInput): ExpressionFunctionComputes the normalized Fresnel cosine integral C(x) = integral(cos(pi*t^2/2), t, 0, x). Numeric real arguments are evaluated numerically. Symbolic arguments remain as C(x).
nerdamer.cbrt(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionRounds a value up to the nearest integer.
nerdamer.Chi(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.Ci(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.clearFunctions(names?: string[]): typeof nerdamerFunctionRemoves user-defined parser functions without affecting built-in functions.
nerdamer.clearVars(): typeof nerdamerFunctionClears all known parser values.
nerdamer.clearWarnings(): voidFunctionClears accumulated warnings without changing reporting settings.
nerdamer.coeffs(x: ExpressionInput, variable?: ExpressionInput): VectorFunctionReturns polynomial coefficients as a dense Vector ordered by ascending power. When no variable is supplied, the first variable in the expression is used, matching the legacy parser helper. A constant expression therefore has the single coefficient at power zero.
nerdamer.completeSquare(expr: ExpressionInput, variable?: string): CompleteSquareResultFunctionCompletes the square for a quadratic expression. For a*x^2+b*x+c, the returned expression has the form a*(x+h)^2+k, with h=b/(2*a) and k=c-b^2/(4*a).
nerdamer.conjugate(x: ExpressionInput): ExpressionFunctionReturns the complex conjugate of an expression. For a complex number z = a + bi, the conjugate is a - bi. Distributes over sums, products, integer powers, and powers whose constant base is known not to lie on the principal logarithm's branch cut.
nerdamer.connect(names: readonly string[], source: NumericalFunctionSource): typeof nerdamerFunctionImports numerical implementations from another library while preserving Nerdamer's symbolic representation of the selected functions. Imported functions are used by numerical evaluation and by buildFunction(). New function names remain symbolic during ordinary parsing; existing Nerdamer functions retain their symbolic simplification rules.
nerdamer.contains(x: Expression | Vector | ValuesSet | Dictionary | SolutionSet, value: ExpressionInput): ExpressionFunctionTests whether a value is present in a supported finite container.
nerdamer.content(x: ExpressionInput | Polynomial): ExpressionFunctionReturns the exact numeric content of polynomial expression input.
nerdamer.continued_fraction(x: ExpressionInput, depth: ExpressionInput): CollectionFunctionReturns the continued-fraction decomposition as a Collection containing sign, whole part, and a Vector of partial quotients.
nerdamer.convertFromLaTeX(TeX: string): ParserEntityFunctionParses the supported TeX subset into a Nerdamer parser entity.
nerdamer.convertToLaTeX(expression: string | ParserEntity, options?: TeXOptions): stringFunctionConverts an expression to TeX math markup 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.convertToTeX(expression: string | ParserEntity, options?: TeXOptions): stringFunctionConverts an expression to TeX math markup 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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): ExpressionFunctionComputes the hyperbolic cotangent of an expression: coth(x) = 1/tanh(x). - coth(+∞) = 1, coth(−∞) = −1 - coth(0) is undefined.
nerdamer.cross(...args: [a, b]): Expression | VectorFunctionFunction exported by Nerdamer.
nerdamer.csc(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes the hyperbolic cosecant of an expression: csch(x) = 1/sinh(x). - csch(±∞) = 0 - csch(0) is undefined.
nerdamer.csgn(x: ExpressionInput): ExpressionFunctionReturns the complex signum (csgn) of an expression, following the Maple/SymPy convention. Returns 1 if Re(z) > 0, -1 if Re(z) < 0, and sgn(Im(z)) if Re(z) = 0. Returns 0 for z = 0. For expressions containing free variables where the sign cannot be determined, returns an unevaluated symbolic csgn(z). Useful for branch cut decisions in sqrt, log, and power simplification.
nerdamer.defint(f: ExpressionInput, dx: ExpressionInput, from: ExpressionInput, to: ExpressionInput): ExpressionFunctionCalculates the definite integral numerically when the bounds are numbers, with Decimal arithmetic at the configured precision. Setting USE_NATIVE_DEFINT uses adaptive Simpson with native JS numbers instead, which is faster but limited to about 16 digits.
nerdamer.deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): ExpressionFunctionReturns the degree of a polynomial expression.
nerdamer.degrees(x: ExpressionInput): ExpressionFunctionConverts radians to degrees exactly.
nerdamer.delta(...args: [x]): ExpressionFunctionEvaluates the Dirac delta function when the input is known to be nonzero.
nerdamer.determinant(...args: [M]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.dfact(x: ExpressionInput): ExpressionFunctionComputes the double factorial of an expression.
nerdamer.dfactorial(x: ExpressionInput): ExpressionFunctionComputes the double factorial of an expression.
nerdamer.diff(x: Expression, variable?: ExpressionInput, n?: number | Expression): ExpressionFunctionThe parser's diff for an expression, equation, vector or matrix. An omitted variable follows the parser's rule: the input's only variable, counted across all of it, is used, and several are an error. An order needs a variable, as it does in parser syntax.
nerdamer.difference(...args: [a, b]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.div(dividend: ExpressionInput, divisor: ExpressionInput): VectorFunctionReturns the quotient and remainder of polynomial division.
nerdamer.divide(dividend: ExpressionInput, divisor: ExpressionInput): ExpressionFunctionDivides two expressions using polynomial quotient/remainder reconstruction when possible.
nerdamer.dot(...args: [a, b]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.Ei(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.erf(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.erfc(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.exp(x: ExpressionInput): ExpressionFunctionComputes 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(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.fact(...args: [x]): ExpressionFunctionAlias for nerdamer.factorial.
nerdamer.factor(x: ExpressionInput): ExpressionFunctionFactors polynomial-like numerator and denominator components of an expression.
nerdamer.factorial(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.fib(x: ExpressionInput): ExpressionFunctionComputes the Fibonacci number for an integer index.
nerdamer.floor(x: ExpressionInput): ExpressionFunctionRounds a number down to the nearest integer (floor function).
nerdamer.functions(): { … }FunctionLists currently registered parser functions by registration level.
nerdamer.gamma(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.gamma_incomplete(a: ExpressionInput, z: ExpressionInput): ExpressionFunctionUpper incomplete gamma Γ(a, z). Positive integer first arguments are expanded exactly using the finite-sum formula. Other inputs remain symbolic.
nerdamer.gamma_incomplete_lower(a: ExpressionInput, z: ExpressionInput): ExpressionFunctionLower incomplete gamma γ(a, z). Positive integer first arguments use γ(a,z) = Γ(a) - Γ(a,z). Other inputs remain symbolic.
nerdamer.gcd(x: ExpressionInput, y: ExpressionInput): ExpressionFunctionComputes a symbolic greatest common divisor over rational polynomial structure.
nerdamer.get(setting: keyof SettingsType | "PRECISION"): string | number | booleanFunctionReads 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.getAssumptions(): Map<string, Assumption>FunctionReturns a snapshot of all currently registered assumptions. Changing the returned Map does not change Nerdamer's active assumptions.
nerdamer.getConstant(name: string): stringFunctionReturns 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 | undefinedFunctionReturns a detached snapshot of a registered parser operator.
nerdamer.getVars(option: "text" | "LaTeX"): Record<string, string>FunctionReturns a snapshot of all known parser values in text or TeX form.
nerdamer.getWarnings(): Readonly<{ … }>[]FunctionReturns an independent snapshot of the recorded warnings.
nerdamer.groebner(expressionArray: Vector | ExpressionInput | ExpressionInput[], vars?: string[] | Vector | ExpressionInput): VectorFunctionComputes an expression-facing Groebner basis for polynomial generators.
nerdamer.heaviside(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.hypot(...args: [a, b]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.ilaplace(expr: ExpressionInput, s: ExpressionInput, t: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionAlias for nerdamer.ilaplace.
nerdamer.imagpart(...args: [a]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.imatrix(...args: [x]): Expression | MatrixFunctionFunction exported by Nerdamer.
nerdamer.integrate(x: Expression, variable?: ExpressionInput): ExpressionFunctionThe parser's integrate for an expression, equation, vector or matrix, with the same rule as diffInput for an omitted variable.
nerdamer.intersection(...args: string | number | bigint | ParserEntity[]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.intersects(...args: [a, b]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.invert(...args: [M]): MatrixFunctionFunction exported by Nerdamer.
nerdamer.is_subset(...args: [a, b]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.isPrime(x: ExpressionInput): ExpressionFunctionTests whether an exact integer expression is prime. Non-integer or unresolved symbolic input remains as an unevaluated isprime(...) expression so it can be simplified later.
nerdamer.isReserved(name: string): booleanFunctionReturns whether Nerdamer currently reserves a variable or symbol name.
nerdamer.issubset(...args: [a, b]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.laplace(expr: ExpressionInput, t: ExpressionInput, s: ExpressionInput): ExpressionFunctionComputes 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. Supported exponential factors also shift the transform variable when the remainder is transformable.
nerdamer.lcm(x: ExpressionInput, y: ExpressionInput): ExpressionFunctionReturns the least common multiple of two expressions. Numeric inputs reuse exact Rational arithmetic. Polynomial expressions use the polynomial GCD so shared symbolic factors are retained.
nerdamer.Li(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.limit(expr: ExpressionInput, x: ExpressionInput, val: ExpressionInput, dir: LimitDir, depth: number): ExpressionFunctionComputes 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.line(...args: [p1, p2, dimension]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.log(x: ExpressionInput, base?: ExpressionInput, expandPrimes: boolean): ExpressionFunctionComputes 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π, so log(-∞) is ∞ + iπ. Complex inputs use the principal branch: log(z) = log|z| + i·arg(z). log(0) is -∞, the limit from the right, so with a base b it becomes -∞/log(b).
nerdamer.log10(x: ExpressionInput): ExpressionFunctionReturns the base-10 logarithm using the ordinary logarithm implementation.
nerdamer.matrix(...args: string | number | bigint | Vector | NerdamerInput[][]): MatrixFunctionFunction exported by Nerdamer.
nerdamer.max(...args: ExpressionInput[]): ExpressionFunctionReturns 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.mean(...args: StatisticsInput[]): ExpressionFunctionReturns the arithmetic mean of the supplied values. A single Vector is unpacked.
nerdamer.median(...args: StatisticsInput[]): ExpressionFunctionReturns the median when all supplied values can be ordered numerically. Symbolic or complex inputs remain as an unevaluated median call.
nerdamer.min(...args: ExpressionInput[]): ExpressionFunctionReturns 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(...args: [x, y]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.mode(...args: StatisticsInput[]): ExpressionFunctionReturns the most frequent value. A tie remains symbolic as mode(...), matching the legacy behavior instead of selecting an arbitrary winner.
nerdamer.modInv(...args: [a, p]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.nextprime(x: ExpressionInput): ExpressionFunctionReturns the first prime strictly greater than an exact integer.
nerdamer.nthroot(x: ExpressionInput, n: ExpressionInput): ExpressionFunctionComputes the nth root of an expression as its principal power.
nerdamer.nullspace(...args: [M, prime]): VectorFunctionFunction exported by Nerdamer.
nerdamer.numeric(x: ExpressionInput, precision?: ExpressionInput): ExpressionFunctionEvaluates a numeric expression to a finite number of significant decimal digits. Exact rational results are converted to decimal-origin values so subsequent numerical arithmetic does not keep expanding their numerators and denominators. Symbolic results remain symbolic after evaluation.
nerdamer.parens(x: ExpressionInput): ExpressionFunctionWraps an expression in parentheses. Returns a function node whose only purpose is to visually group x with surrounding parentheses in output.
nerdamer.partfrac(x: ExpressionInput, variable?: ExpressionInput): ExpressionFunctionDecomposes a rational expression P(x)/Q(x) into partial fractions.
nerdamer.pfactor(x: ExpressionInput): VectorFunctionReturns the prime factors of a positive integer in ascending order. Repeated factors are retained, so pfactor(100) returns [2, 2, 5, 5]. The value 1 has no prime factors and returns an empty Vector.
nerdamer.pfactord(x: ExpressionInput): DictionaryFunctionReturns the prime-factor multiplicities of a positive integer. Dictionary keys are prime numbers in ascending order and values are their occurrence counts. For example, pfactord(100) returns {2 => 2, 5 => 2}.
nerdamer.polarform(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.polyFactors(x: ExpressionInput): VectorFunctionWraps the polynomial factor expressions in an ordered Vector.
nerdamer.powmod(base: ExpressionInput, exponent: ExpressionInput, modulus: ExpressionInput): ExpressionFunctionComputes base^exponent modulo a positive integer without materializing the power. Uses exact BigInt arithmetic; unresolved arguments remain symbolic.
nerdamer.pretty(e: string | ParserEntity, type: "text" | "TeX"): stringFunctionFunction exported by Nerdamer.
nerdamer.product(expr: ExpressionInput, index: ExpressionInput, lower: ExpressionInput, upper: ExpressionInput): ExpressionFunctionComputes 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.radians(x: ExpressionInput): ExpressionFunctionConverts degrees to radians exactly.
nerdamer.rank(...args: [M]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.realpart(...args: [a]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.rect(x: ExpressionInput): ExpressionFunctionRectangular pulse with unit width centered at zero. Returns 1 for |x| < 1/2, 1/2 at |x| = 1/2, and 0 for |x| > 1/2.
nerdamer.rectform(x: ExpressionInput): ExpressionFunctionAttempts to convert a polar form complex to rectangular form. If no exact identity is found, the decimal representation in rectangular form is returned.
nerdamer.roots(input: ExpressionInput, variable?: ExpressionInput, method?: ExpressionInput): VectorFunctionReturns polynomial roots as a Vector. Unlike solve(), which returns a SolutionSet with solver metadata, this function preserves the roots API's Vector return type. Numeric constants retain the historical square-root interpretation. Univariate polynomials delegate to PolynomialSolver and therefore return numerical roots. An optional third argument selects aberth (default) or jenkinstraub.
nerdamer.round(x: ExpressionInput, n?: ExpressionInput): ExpressionFunctionRounds a number to the nth decimal place. If no precision is provided, rounds to the nearest integer.
nerdamer.S(x: ExpressionInput): ExpressionFunctionComputes the normalized Fresnel sine integral S(x) = integral(sin(pi*t^2/2), t, 0, x). Numeric real arguments are evaluated numerically. Symbolic arguments remain as S(x).
nerdamer.scientific(x: ExpressionInput, significantDigits: ExpressionInput): ExpressionFunctionReturns a copy that renders numeric values in scientific notation. The legacy implementation stored a formatting flag that its formatter did not consume. Nerdamer 2.0 keeps the expression exact and records the requested number of significant digits for formatting. Precision validation follows decimal.js and accepts integer values from 1 through 1e9.
nerdamer.sec(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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 nerdamerFunctionChanges 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.setConsoleWarnings(enabled: boolean): voidFunctionEnables or disables optional console output (disabled by default).
nerdamer.setConstant(name: string, value: string | number): typeof nerdamerFunctionRegisters 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 nerdamerFunctionRegisters 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: OperatorDefinition, action?: OperatorFunction): typeof nerdamerFunctionRegisters or updates a parser operator and returns the root API for chaining.
nerdamer.setVar(name: string, value: string | number): voidFunctionSets a known parser value. Unlike a constant, a known value can be overridden by the values object supplied to a parse call.
nerdamer.setWarningHandler(handler?: WarningHandler): voidFunctionRoute new diagnostics to an application callback.
nerdamer.Shi(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.Si(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.sign(x: ExpressionInput): ExpressionFunctionReturns 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.significant(x: ExpressionInput, digits: ExpressionInput): ExpressionFunctionRounds a number to the requested number of significant figures. Unlike round(x, n), which counts decimal places, this operation counts significant digits from the first nonzero digit. It changes the numeric value rather than just its display format (unlike scientific). Zero stays zero; complex values are rounded component by component. Symbolic values remain unevaluated until they become numeric.
nerdamer.simplify(x: string | Expression, modifiers?: { … }): ExpressionFunctionSimplifies an expression, or each member of a set such as the result of solve. A set keeps its type and solver details, and members that simplify to the same value are merged, as when the method is called on the set.
nerdamer.sin(x: ExpressionInput): ExpressionFunctionComputes 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(...args: [x]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.sinh(x: ExpressionInput): ExpressionFunctionComputes 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.smpstdev(...args: StatisticsInput[]): ExpressionFunctionLegacy parser spelling for sample standard deviation. A separate function, rather than an alias, so that its errors name smpstdev.
nerdamer.smpvar(...args: StatisticsInput[]): ExpressionFunctionLegacy parser spelling for sample variance. A separate function, rather than an alias, so that its errors name smpvar.
nerdamer.solve(input: Equation | ExpressionInput, variable?: ExpressionInput, onInterval?: Vector | FunctionSolverOptions, recursion?: SolveRecursionContext): SolutionSetFunctionSolves 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 limited-range function-numeric strategies to the factors. Zeros of denominator factors are excluded from the result.
nerdamer.solveeqs(equations: Vector | Equation | ExpressionInput | Equation | ExpressionInput[], variables?: string[]): VectorFunctionSolves 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. For one-variable systems with multiple equations, it exactly intersects supported rational-pi sine/cosine families and otherwise verifies finite univariate candidates before falling back to multivariate Newton-Raphson over a fixed search interval. Rational polynomial systems may have denominators cleared for symbolic work; candidates are checked against the original domain.
nerdamer.solveEquations(...args: [equations, variables]): VectorFunctionFunction exported by Nerdamer.
nerdamer.solveSystem(equations: Vector | Equation | ExpressionInput | Equation | ExpressionInput[], variables?: string[]): VectorFunctionSolves 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. For one-variable systems with multiple equations, it exactly intersects supported rational-pi sine/cosine families and otherwise verifies finite univariate candidates before falling back to multivariate Newton-Raphson over a fixed search interval. Rational polynomial systems may have denominators cleared for symbolic work; candidates are checked against the original domain.
nerdamer.sqrt(x: ExpressionInput): ExpressionFunctionComputes 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.stdev(...args: StatisticsInput[]): ExpressionFunctionReturns the population standard deviation.
nerdamer.step(x: ExpressionInput): ExpressionFunctionLegacy unit-step function. Unlike heaviside, the value at zero is 1.
nerdamer.subst(expression: ExpressionInput, value: ExpressionInput, withValue: ExpressionInput, includeNumeric: boolean): ExpressionFunctionReplaces a value with another using the existing Expression tree.
nerdamer.sum(expr: ExpressionInput, index: ExpressionInput, lower: ExpressionInput, upper: ExpressionInput): ExpressionFunctionComputes 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>FunctionA convenience function for creating simple symbols reducing the reliance on strings
nerdamer.tan(x: ExpressionInput): ExpressionFunctionComputes 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): ExpressionFunctionComputes 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.taylor(input: ExpressionInput, variable: ExpressionInput, center: ExpressionInput, order: ExpressionInput): ExpressionFunctionConstructs a finite Taylor polynomial about a center, through the specified degree. Derivatives and coefficients are computed symbolically. If a derivative cannot be resolved, a coefficient is undefined, or the work budget is exhausted, the entire call is preserved as an unevaluated taylor(...) rather than returning a partial series.
nerdamer.trace(...args: [M]): ExpressionFunctionFunction exported by Nerdamer.
nerdamer.tri(x: ExpressionInput): ExpressionFunctionTriangular pulse: max(1 - |x|, 0) when the comparison can be resolved.
nerdamer.trunc(x: ExpressionInput): ExpressionFunctionTruncates a number toward zero. Numeric inputs discard their fractional part without changing the sign of the integer portion. Symbolic inputs remain unevaluated.
nerdamer.union(...args: string | number | bigint | ParserEntity[]): ParserEntityFunctionFunction exported by Nerdamer.
nerdamer.updateAPI(): typeof nerdamerFunctionFunction exported by Nerdamer.
nerdamer.uSub(x: ExpressionInput, value: ExpressionInput, map?: SubstitutionMap): USubstitutionResultFunctionReplaces one repeated sub-expression with a generated uN symbol. The generated symbol is chosen so it does not collide with variables already present in the expression or substitution map. Pass the returned map to later calls when several substitutions should share one namespace, then use uUnSub to restore the original expressions.
nerdamer.uUnSub(expression: Expression, map: SubstitutionMap): ExpressionFunctionRestores substitutions produced by uSub.
nerdamer.variance(...args: StatisticsInput[]): ExpressionFunctionReturns the population variance using the legacy algebraic squared-deviation definition.
nerdamer.version(): stringFunctionReturns the package version declared by this Nerdamer build.
nerdamer.zscore(x: ExpressionInput, average: ExpressionInput, standardDeviation: ExpressionInput): ExpressionFunctionReturns the z-score (x - mean) / standardDeviation.
Properties
Values on nerdamer that you read rather than call.
nerdamer.classes: { … }PropertyCompatibility registry of selected Nerdamer constructors and the shared Parser instance.
nerdamer.constants: Readonly<{ … }>PropertyReadonly categories of built-in function names. Shares the exact frozen name lists exported by nerdamer/constants. Unlike getConstant(), these groups do not inspect or modify parser values.
nerdamer.errors: __modulePropertyRuntime namespace containing Nerdamer's public error constructors. Use these constructors for reliable instanceof checks when calling the compatibility root API.
Errors
Import error classes from nerdamer/core, or use the same classes on nerdamer.errors. Either works with instanceof.
import nerdamer from 'nerdamer';
import { UnexpectedInputError } from 'nerdamer/core';
err instanceof UnexpectedInputError;
err instanceof nerdamer.errors.UnexpectedInputError;nerdamer.errors.AssignmentErrorClassThrown when code attempts to assign to a reserved or otherwise non-assignable parser name.
nerdamer.errors.DimensionErrorClassThrown when vector, matrix, or structured-entity dimensions are incompatible.
nerdamer.errors.DivisionByZeroErrorClassThrown for exact division by zero. Small nonzero numerical values are not treated as zero.
nerdamer.errors.MathErrorClassGeneral mathematical precondition error for cases without a more specific error type.
nerdamer.errors.MissingReferenceErrorClassThrown when a named converter or pattern reference cannot be resolved.
nerdamer.errors.NaNErrorClassThrown when a required numeric conversion produces NaN.
nerdamer.errors.NotImplementedErrorClassUsed for recognized operations that have not been implemented yet.
nerdamer.errors.OperatorErrorClassUsed for invalid parser-operator definitions and operator dispatch failures.
nerdamer.errors.ParserErrorClassGeneral parser error for construction, evaluation, and registered-function failures.
nerdamer.errors.ParserSyntaxErrorClassParser syntax error kept separate from lower-level tokenization failures.
nerdamer.errors.PolynomialErrorClassThrown when input cannot be represented as a polynomial under the requested requirements.
nerdamer.errors.UndefinedErrorClassUsed when a mathematical operation has no defined value in the handled domain.
nerdamer.errors.UnexpectedInputErrorClassUsed when input parses successfully but does not have the form an operation requires.
nerdamer.errors.UnexpectedTokenErrorClassThrown when tokenization encounters invalid adjacency, punctuation, or bracket structure.
nerdamer.errors.UnsupportedOperationErrorClassThrown when an operation is known but unsupported for the supplied form or domain.
nerdamer.errors.ZeroToZeroPowerErrorClassThrown for the indeterminate symbolic form 0^0.
For user-defined symbolic functions, see User-defined functions.
