Bill Allombert on Thu, 4 Jul 2002 14:23:08 +0200


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

Re: polcoeff() mystery


On Tue, Jul 02, 2002 at 09:16:06AM -0400, Ilya Zakharevich wrote:
> Do you mean that to have efficient polynomial arithmetic, it is enough
> to insert enough calls to simplify(), as in
> 
>   T = simplify(x^2+y*x+z)
> 
> ?
> 
> > Hope this is clearer,
> 
> Much clearer in some respects, much more obscure in others...

There are three things to keep in mind:
1) GP know only about univariate polynomials over a field.
2) 'foo^0 is printed as 1 for every foo., but is internally still 'foo^0
3) The same happen for zero complex, quadratic and algebraic numbers.

There is no such thing as x^2+y*x+z. 
What there is really is x^2+y*x+z*x^0, but eventually it can be x^2+y*x+z*y^0*x^0,
x^2+z^0*y*x+z*y^0*x^0,etc...

polcoeff(P,n) is exactly identical to Vec(P)[poldegree(P)-n+1]

Maybe a print function that output 'foo^0 as 'foo^0 not 1 could be useful.

Cheers,

Bill.