/** * Exact multivariate polynomial arithmetic + Buchberger's algorithm (B-5). * * Replaces the former groebnerBasis internals, which (a) extracted coefficients * by evaluating at unit points — unable to distinguish `x` from `x²` (both are 1 * at x = 1) — and (b) never ran Buchberger at all (the "basis" was the parsed * inputs). Polynomials are parsed EXACTLY from the expression AST (`parse`), so * coefficients are never inferred numerically; division and S-polynomial * reduction use graded-free lex order (first variable most significant). * * Scope: small systems (the CAS surface's documented target). Iteration and * basis-size caps throw an honest error instead of returning wrong results. */ /** One monomial: coefficient × Π varsᵢ^powersᵢ (dense exponent vector). */ export interface Term { coeff: number; powers: number[]; } /** A polynomial: combined, lex-sorted (descending), no near-zero coefficients. */ export type Poly = Term[]; /** Combine like terms, drop |coeff| ≤ EPS, sort lex-descending. */ export declare function normalize(p: Poly): Poly; /** * Return the sum of two multivariate polynomials, with like terms combined. * The result drops near-zero terms and is sorted in descending lex order. */ export declare function polyAdd(a: Poly, b: Poly): Poly; /** Return the negation of `a`. The function makes a new polynomial and does not change `a`. */ export declare function polyNeg(a: Poly): Poly; /** Return the difference `a - b` of two multivariate polynomials. */ export declare function polySub(a: Poly, b: Poly): Poly; /** * Return the product of two multivariate polynomials, with like terms combined. * The result drops near-zero terms and is sorted in descending lex order. */ export declare function polyMul(a: Poly, b: Poly): Poly; /** * Convert a polynomial expression string to a {@link Poly} over `vars` — exactly. * Supports numeric constants, the given variables, `+ − * / ^`, unary minus and * parentheses, with `/` restricted to nonzero numeric-constant divisors and `^` * to non-negative integer literal exponents. Unknown symbols throw. */ export declare function polyFromExpression(expr: string, vars: string[]): Poly; /** * A spatial index grouping divisor polynomials by their leading term's total degree. * This filters out polynomials whose degree exceeds the target term, reducing search overhead. */ export declare class DivisorGeobucket { private buckets; private maxDeg; constructor(polys: Poly[]); insert(poly: Poly): void; find(target: number[]): Poly | undefined; } /** Remainder of p on multivariate division by G (lex order). */ export declare function polyReduce(p: Poly, G: Poly[] | DivisorGeobucket): Poly; /** * Buchberger's algorithm with honest caps: returns the REDUCED Gröbner basis * (monic, minimal, fully inter-reduced) in lex order over the given variable * ordering, or throws if the caps are exceeded. */ export declare function buchberger(input: Poly[]): Poly[]; /** Format a Poly back to an expression string (constant-first, like `-1 + 1*y + 1*x^2`). */ export declare function polyToString(p: Poly, vars: string[]): string; //# sourceMappingURL=polynomial-ideal.d.ts.map