nerdamer/algebra
Polynomial tools, factorization, simplification, rational expressions, and related algebra operations.
nerdamer/algebra. For functions used inside nerdamer('...'), see Nerdamer Notation.Functions
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.
content(x: ExpressionInput | Polynomial): ExpressionFunctionReturns the exact numeric content of polynomial expression input.
deg(x: ExpressionInput | Polynomial, variable?: ExpressionInput): ExpressionFunctionReturns the degree of a polynomial expression.
factor(x: ExpressionInput): ExpressionFunctionFactors polynomial-like numerator and denominator components of an expression.
gcd(x: ExpressionInput, y: ExpressionInput): ExpressionFunctionComputes a symbolic greatest common divisor over rational polynomial structure.
groebner(expressionArray: Vector | ExpressionInput[], vars?: string[]): VectorFunctionComputes an expression-facing Groebner basis for polynomial generators.
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.
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.
partfrac(x: ExpressionInput, variable?: ExpressionInput): ExpressionFunctionDecomposes a rational expression P(x)/Q(x) into partial fractions.
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.
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}.
polyFactors(x: ExpressionInput): VectorFunctionWraps the polynomial factor expressions in an ordered Vector.
simplify(x: string | Expression, modifiers: { … }): ExpressionFunctionApplies Nerdamer's finite symbolic simplification strategy to an expression.
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.
uUnSub(expression: Expression, map: SubstitutionMap): ExpressionFunctionRestores substitutions produced by uSub.
Classes
Types
Variable
APIs
EvalInputType: number | bigint | RationalAPIExact values accepted when evaluating a polynomial.
Ordering: "none" | "deg" | "lex" | "revlex" | "grlex" | "grevlex" | "byvar"APIMonomial ordering labels understood by Polynomial.order.
PolyType: string | Polynomial | ExpressionAPIInputs accepted by polynomial conversion helpers.
PowersObject: Record<string, number>APIPowers keyed by variable name. Missing variables have degree zero.
VariableFrequency: unknownAPIAPI exported by Nerdamer.
