JavaScript / TypeScript API

nerdamer/algebra

Polynomial tools, factorization, simplification, rational expressions, and related algebra operations.

Direct npm import. The items on this page are JavaScript / TypeScript exports from nerdamer/algebra. For functions used inside nerdamer('...'), see Nerdamer Notation.
27 exports

Functions

coeffs(x: ExpressionInput, variable?: ExpressionInput): VectorFunction

Returns 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.

content(x: ExpressionInput | Polynomial): ExpressionFunction

Returns the exact numeric content of polynomial expression input.

deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): ExpressionFunction

Returns the degree of a polynomial expression.

factor(x: ExpressionInput): ExpressionFunction

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

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

Computes a symbolic greatest common divisor over rational polynomial structure.

groebner(expressionArray: Vector | ExpressionInput[], vars?: string[]): VectorFunction

Computes an expression-facing Groebner basis for polynomial generators.

isPrime(x: ExpressionInput): ExpressionFunction

Tests 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.

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

Returns 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.

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

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

pfactor(x: ExpressionInput): VectorFunction

Returns 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.

pfactord(x: ExpressionInput): DictionaryFunction

Returns 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}.

polyFactors(x: ExpressionInput): VectorFunction

Wraps the polynomial factor expressions in an ordered Vector.

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

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

uSub(x: ExpressionInput, value: ExpressionInput, map?: SubstitutionMap): USubstitutionResultFunction

Replaces 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.

uUnSub(expression: Expression, map: SubstitutionMap): ExpressionFunction

Restores substitutions produced by uSub.

Classes

Types

Variable

APIs