Previous Page Next Page Contents

gcd -- the greatest common divisor of polynomials

Introduction

gcd(p, q...) returns the greatest common divisor of the polynomials p, q, ...

Call(s)

gcd(p, q...)
gcd(f, g...)

Parameters

p, q... - polynomials of type DOM_POLY
f, g... - polynomial expressions

Returns

a polynomial, a polynomial expression, or the value FAIL.

Overloadable:

p, q, f, g

Related Functions

content, div, divide, factor, gcdex, icontent, ifactor, igcd, igcdex, ilcm, lcm, mod, poly

Details

Example 1

The greatest common divisor of two polynomial expressions can be computed as follows:

>> gcd(6*x^3 + 9*x^2*y^2, 2*x + 2*x*y + 3*y^2 + 3*y^3)
                                         2
                                2 x + 3 y
>> f := (x - sqrt(2))*(x^2 + sqrt(3)*x-1):
   g := (x - sqrt(2))*(x - sqrt(3)):
   gcd(f, g)
                                      1/2
                                 x - 2

One may also choose polynomials as arguments:

>> p := poly(2*x^2 - 4*x*y - 2*x + 4*y, [x, y], IntMod(17)):
   q := poly(x^2*y - 2*x*y^2, [x, y], IntMod(17)):
   gcd(p, q)
                     poly(x - 2 y, [x, y], IntMod(17))
>> delete f, g, p, q:

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000