multivariate_gcd

Function multivariate_gcd 

Source
pub fn multivariate_gcd(
    poly1: &Expression,
    poly2: &Expression,
    vars: &[Symbol],
) -> Expression
Expand description

Compute GCD of multivariate polynomials using evaluation-interpolation

This is the main entry point. Uses the heuristic GCD algorithm which:

  1. Extracts numeric content (ground GCD)
  2. Evaluates at integer points
  3. Recursively reduces dimension
  4. Interpolates and verifies

§Arguments

  • poly1 - First polynomial expression
  • poly2 - Second polynomial expression
  • vars - List of variables (in order of elimination)

§Returns

Returns the GCD expression. Falls back to 1 if heuristic fails.

§Examples

use mathhook_core::{symbol, expr};
use mathhook_core::algebra::multivariate_gcd::multivariate_gcd;

let x = symbol!(x);
let y = symbol!(y);

// gcd(2xy, 3xy) = xy
let p1 = expr!(2 * x * y);
let p2 = expr!(3 * x * y);
let result = multivariate_gcd(&p1, &p2, &[x.clone(), y.clone()]);