Euclindean algorithm for polynomials



El mi?, 04-03-2009 a las 23:03 -0500, Sheldon Newhouse escribi?:
> Hello,
>  Is there a routine which performs the Euclidean algotithm for polynomials.
> 
> I.e.,  p, q are polynomials with degree(p) = d > degree(q) =s,
> I want to obtain
> 
>     p = k*q + r
>  where k, r are polynomials and degree(r) < s.


eu (dividend, divisor) :=
  block([k, r],
    [k, r] : divide(dividend, divisor),
    dividend = divisor * k + r) $

p : x^3-7*x^2+14*x-15 $
q : x-4 $
eu(p, q);



See also functions 'quotient' and 'remainder'



-- 
Mario