Previous Up Next

11.2.5  GCD of two polynomials with the Euclidean algorithm

The gcd command computes the gcd (greatest common divisor) of polynomials. (See also Section 7.1.1 for GCD of integers.)

Gcd is the inert form of gcd; namely, it evaluates to gcd for later evaluation. It is used when Xcas is in Maple mode (see Section 2.5.2) to compute the gcd of polynomials with coefficients in ℤ/pℤ using Maple-like syntax.

Examples

gcd(x^2+2*x+1,x^2-1)
     
x+1           
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])
     
x−1           

For polynomials with modular coefficients:

gcd((x^2+2*x+1) mod 5,(x^2-1) mod 5)
     

1%5
x+1%5
          

Input in Xcas mode:

Gcd(x^3-1,x^2-1)
     
gcd
x3−1,x2−1
          

Input in Maple mode:

Gcd(x^2+2*x,x^2+6*x+5) mod 5
     
1           

Previous Up Next