Skip to main content

Module multipoly

Module multipoly 

Source
Expand description

Sparse multivariate polynomials over ℚ. Sparse multivariate polynomials over ℚ.

MultiPoly represents polynomials in multiple variables with exact rational coefficients. Monomials are stored sparsely as (exponent_vector, coefficient) pairs.

This module provides:

  • Polynomial arithmetic (+, -, ×)
  • Degree computation
  • Evaluation
  • Partial derivatives
  • Variable substitution
  • Multivariate polynomial division
  • S-polynomials for Gröbner basis computation

The monomial ordering is parameterized via the MonomialOrd trait, enabling graded reverse lex (default), lex, and graded lex orderings.

Structs§

GrLex
Graded lexicographic ordering.
GrevLex
Graded reverse lexicographic ordering (default for Gröbner computation).
Lex
Pure lexicographic ordering (for elimination/back-substitution).
MonoKey
A monomial exponent vector with ordering determined by type parameter O.
MultiPoly
A sparse multivariate polynomial over ℚ.

Enums§

MonomialOrder
A monomial order chosen at run time — the value-level counterpart of the zero-sized order types Lex and GrevLex, for APIs that take the order as an argument (Ex::groebner, Ex::reduce_modulo).

Traits§

MonomialOrd
Trait for monomial orderings. Implemented by zero-sized types.

Functions§

monomial_coprime
Check if two monomials are coprime (no shared variable).
monomial_div
Divide monomial b by a (component-wise subtraction). Returns None if a doesn’t divide b.
monomial_divides
Check if monomial a divides monomial b (component-wise ≤).
monomial_lcm
Component-wise maximum of two exponent vectors (LCM of monomials).
monomial_mul
Multiply two monomials (component-wise addition).
multipoly_vars
Create variable polynomials for a ring with the given number of variables.
s_polynomial
Compute the S-polynomial of f and g.

Type Aliases§

Exponent
An exponent vector representing a monomial x₀^a · x₁^b · x₂^c · … as [a, b, c, …]. The length equals the number of variables.