Allroot function problem



Raymond Toy a ?crit :
> Leo Butler wrote:
>   
>> Here is the example, but with an errant %i in front. Perhaps the
>> developers can comment on why allroots finds slightly different roots. I
>> would have thought that it would have first normalised %i*g(x) to a
>> monic polynomial (i.e. g(x)) before root finding.
>>   
>>     
> If all the coefficients are real, allroots takes advantage of that and
> uses a real-valued algorithm so that conjugate pairs of roots are truly
> conjugates.  If any coefficient is complex, then a complex-valued
> algorithm is used.  Hence the roots can be different.  (I think
> sometimes they can be VERY different.)
>
> Ray
>   
Yes they can be very different just because the roots may depend 
critically on the coefficients, so any small rounding error on the 
coefficients implies a big error on the roots. Try for instance

P:product(x-i,i,1,23);  allroots(P);  allroots(%i*P);

and look at the roots around 15 to 18 : they are far from integers, even 
from real numbers (and allroots(P) finds conjugate pairs !).

Replacing 23 by 24 is even worse, and 25 (and higher) is beyond the 
possibilities of allroots.

Is there a way to increase the precision of these computations using 
bfloats with allroots ?

Eric Reyssat