Karim Belabas on Mon, 27 Oct 2014 11:08:38 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: A Strange problem |
* Allan MacLeod [2014-10-27 10:57]: > Over the weekend, I was developing some software in Pari which needs > to check whether rational polynomials are squares over the rationals. > > I used isqsquare(polynomial,&root) > > At the start of the program, everything worked fine and the roots, > when found, were rational. > > At a certain point, however, the roots changed to having real > coefficients which completely screwed the code. > > I got round the problem by writing my own "idiot" test subroutine, > which works fine. > > This problem occurred using Pari 2.7.2, Pari 2.6.0, and Pari 2.3.4. > > Any suggestions as to what I did wrong? Indeed, I can reproduce the problem: (11:05) gp > issquare((x+1/2)^2,&n); n %1 = 1.0000000000000000000*x + 0.5000000000000000000 The current (faulty) code works as you expected iff the constant coefficient is an integer. I'll fix the problem shortly. In the meantime, a simple workaround is to kill the content first. Thanks for your report! K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite de Bordeaux Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux1.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP] `