Bill Allombert on Tue, 24 Sep 2013 20:39:53 +0200


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

Re: rational roots


On Tue, Sep 24, 2013 at 01:45:44PM -0400, Max Alekseyev wrote:
> Another approach would be to convert obtained floating point roots in
> rational numbers as follows:
> 
> ? polroots(x^2-0.25)
> %1 = [-0.50000000000000000000000000000000000000 + 0.E-38*I,
> 0.50000000000000000000000000000000000000 + 0.E-38*I]~
> ? apply(t->algdep(t,1),%)
> %2 = [2*x + 1, 2*x - 1]~

For such conversion, rather use bestappr
? apply(bestappr,%)
%2 = [-1/2,1/2]~

Cheers,
Bill