pub fn multivariate_gcd(
poly1: &Expression,
poly2: &Expression,
vars: &[Symbol],
) -> ExpressionExpand description
Compute GCD of multivariate polynomials using evaluation-interpolation
This is the main entry point. Uses the heuristic GCD algorithm which:
- Extracts numeric content (ground GCD)
- Evaluates at integer points
- Recursively reduces dimension
- Interpolates and verifies
§Arguments
poly1- First polynomial expressionpoly2- Second polynomial expressionvars- 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()]);