next up previous contents index
suivant: GCD of two polynomials monter: Arithmetic and polynomials précédent: Quotient and remainder :   Table des matières   Index


GCD of two polynomials with Euclide algorithm: gcd

gcd denotes the gcd (greatest common divisor) of two polynomials (or of a list of polynomials or of a sequence of polynomials) (see also 1.6.2 for GCD of integers).

Examples
Input :

gcd(x^2+2*x+1,x^2-1)
Output :
x+1
Input :
gcd(x^2-2*x+1,x^3-1,x^2-1,x^2+x-2)
or
gcd([x^2-2*x+1,x^3-1,x^2-1,x^2+x-2])
Output :
x-1

For polynomials with modular coefficients, input e.g. :

gcd((x^2+2*x+1) mod 5,(x^2-1) mod 5)
Output :
x % 5
Note that :
gcd(x^2+2*x+1,x^2-1) mod 5
will output :
1
since the mod operation is done after the GCD is computed in $ \mathbb {Z}$[X].



giac documentation written by Renée De Graeve and Bernard Parisse