Maxima Function
gcdex (f, g)
gcdex(f,g,x)
Returns a list [a, b, u]
where u is the greatest common divisor (gcd) of f and g,
and u is equal to a f + b g.
The arguments f and g should be univariate polynomials,
or else polynomials in x a supplied main variable
since we need to be in a principal ideal domain for this to work.
The gcd means the gcd regarding f and g as univariate polynomials with coefficients
being rational functions in the other variables.
gcdex implements the Euclidean algorithm,
where we have a sequence
of L[i]: [a[i], b[i], r[i]] which are all perpendicular
to [f, g, -1] and the next one is built as
if q = quotient(r[i]/r[i+1]) then L[i+2]: L[i] - q L[i+1], and it
terminates at L[i+1] when the remainder r[i+2] is zero.
(%i1) gcdex (x^2 + 1, x^3 + 4); 2 x + 4 x - 1 x + 4 (%o1)/R/ [- ------------, -----, 1] 17 17 (%i2) % . [x^2 + 1, x^3 + 4, -1]; (%o2)/R/ 0
Note that the gcd in the following is 1
since we work in k(y)[x], not the y+1 we would expect in k[y, x].
(%i1) gcdex (x*(y + 1), y^2 - 1, x); 1 (%o1)/R/ [0, ------, 1] 2 y - 1