Bill Allombert on Mon, 10 Apr 2006 13:57:41 +0200


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

Re: Pol problem (bug?)


On Mon, Apr 10, 2006 at 12:14:01PM +0200, Joerg Arndt wrote:
> * Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> [Apr 10. 2006 11:50]:
> > There might be. What are you trying to achieve ?
> 
> I compute recurrences via modular polynomial exponentiation,
> see http://www.jjj.de/pari/fastrec.inc.gp
> 
> The (topmost) function vec2charpol() used by frec() (bottom
> of file) fails sometimes with symbolic recursions, e.g.
> when trying to compute Fibonacci polynomials.
> 
> ? frec([1,x],[2*x,-1],3)
>   *** Pol: main variable has highest priority in gtopoly.
> ? frec([1,a],[2*a,-1],3)
> time = 0 ms.
> [4*a^3 - 3*a, 8*a^4 - 8*a^2 + 1]

I would suggest you use 'x as main variable in vec2charpol() etc. and 
disallow input that refer to the 'x variable. You can test that using
if(variable(M)!='x,error("coefficients must not use variable x")).  
  
I don't think there is any better way in GP.

This is what minpoly does.  There is no really better way in PARI either
if you have to return the polynomial to the user.

Cheers,
Bill.