s_polynomial

Function s_polynomial 

Source
pub fn s_polynomial(
    f: &Expression,
    g: &Expression,
    variables: &[Symbol],
    order: &MonomialOrder,
) -> Expression
Expand description

Compute the S-polynomial of two polynomials

The S-polynomial is defined as: S(f, g) = (lcm(LT(f), LT(g)) / LT(f)) * f - (lcm(LT(f), LT(g)) / LT(g)) * g

where LT is the leading term. The S-polynomial is designed so that the leading terms of f and g cancel out, making it useful for finding new basis elements.

§Arguments

  • f - First polynomial
  • g - Second polynomial
  • variables - Ordered list of variables
  • order - Monomial ordering to use

§Returns

The S-polynomial of f and g

§Examples

use mathhook_core::{symbol, expr, Expression};
use mathhook_core::algebra::groebner::{s_polynomial, MonomialOrder};

let x = symbol!(x);
let y = symbol!(y);
let f = expr!((x^2) + y);
let g = expr!((x*y) + 1);
let s = s_polynomial(&f, &g, &vec![x, y], &MonomialOrder::Lex);