Choosing the GCD algorithm of two polynomials

### 11.2.6 Choosing the GCD algorithm of two polynomials

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

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)

1 |  |  |  |  |  |  |  |  |  |

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)

x+y+1 |  |  |  |  |  |  |  |  |  |

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

−x−y−1 |  |  |  |  |  |  |  |  |  |

ezgcd((x+1)^4-y^4,(x+1-y)^2)

GCD not successful Error: Bad Argument Value |  |  |  |  |  |  |  |  |  |

But:

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)

x−y+1 |  |  |  |  |  |  |  |  |  |