|Bill Allombert on Tue, 24 Sep 2013 20:32:50 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: rational roots|
On Tue, Sep 24, 2013 at 10:20:17AM -0700, somayeh didari wrote: > I need to find rational roots of a polynomial in Pari/gp. But when I use polroots command, Pari gives all complex roots. On the other hand rational points are returned in complex type, too. How can i find rational roots in rational type? for example > > ? polroots(x^2-0.25) > %14 = [-0.5000000000000000000000000000 + 0.E-28*I, 0.500000000000000000000000000 > 0 + 0.E-28*I]~ > > But I need [-0.5, 0.5]!!!!!!!!! If you want rational roots, you need to give rational coefficients. Do ? nfroots(,x^2-1/4) %1 = [-1/2,1/2] which is a short-hand for ? Q=nfinit(Q); ? nfroots(Q,x^2-1/4) %6 = [-1/2,1/2] Cheers, Bill.