Bill Allombert on Sat, 02 Apr 2005 00:09:39 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: dividing polynomias


On Fri, Apr 01, 2005 at 11:35:37PM +0200, Csányi Pál wrote:
> I red the tutorial, the user's guide, but I still don't know, how to tell 
> to gp that, that if I want to divide e.g. the following polynomials:
> p(x) = x^4
> q(x) = x^2 + 1
> 
> ? p(x)/q(x)
> %1 = x^4/(x^2 + 1)
> 
> then I want the result in form similarly like follow:
> 
> p(x)/q(x)= x^2 - 1 (remainder 1)
> 
> How can I do that in gp?

What you want to do is called an 'Euclidean division' or a
'division with remainder'.
You can do:
? divrem(x^4,x^2 + 1)
%1 = [x^2 - 1, 1]~

or:
? (x^4)\(x^2 + 1)
%2 = x^2 - 1
? (x^4)%(x^2 + 1)
%3 = 1

Cheers,
Bill.