Choosing the GCD algorithm of two polynomials: ezgcd heugcd modgcd psrgcd

### 5.28.7 Choosing the GCD algorithm of two polynomials: ezgcd heugcd modgcd psrgcd

The ezgcd, heugcd, modgcd and psrgcd commands compute the gcd (greatest common divisor) of two univariate or multivariate polynomials with coefficients in ℤ or ℤ[i] with different algorithms.

- ezgcd, heugcd, modgcd and psrgcd take two arguments:
  P and Q, two polynomials.
- ezgcd(P,Q) returns the gcd of P and Q computed with the ezgcd algorithm.
- heugcd(P,Q) returns the gcd of P and Q computed with the heuristic algorithm.
- modgcd(P,Q) returns the gcd P and Q computed with the modular algorithm.
- psrgcd(P,Q) returns the gcd of P and Q computed with the sub-resultant algorithm.

#### Examples

- Input:
  ezgcd(x^2-2*x*y+y^2-1,x-y)
  or:
  heugcd(x^2-2*x*y+y^2-1,x-y)
  or:
  modgcd(x^2-2*x*y+y^2-1,x-y)
  or:
  psrgcd(x^2-2*x*y+y^2-1,x-y)
  Output:

  1

- Input:
  ezgcd((x+y-1)*(x+y+1),(x+y+1)^2)
  or:
  heugcd((x+y-1)*(x+y+1),(x+y+1)^2)
  or:
  modgcd((x+y-1)*(x+y+1),(x+y+1)^2)
  Output:

  x+y+1

- Input:
  psrgcd((x+y-1)*(x+y+1),(x+y+1)^2)
  Output:

  −x−y−1

- Input:
  ezgcd((x+1)^4-y^4,(x+1-y)^2)
  Output:
  "GCD not successful Error: Bad Argument Value"
  But:
  input:
  heugcd((x+1)^4-y^4,(x+1-y)^2)
  or:
  modgcd((x+1)^4-y^4,(x+1-y)^2)
  or:
  psrgcd((x+1)^4-y^4,(x+1-y)^2)
  Output:

  x−y+1