Mario Rodriguez wrote:
> Jaime Robledo escribi?:
>> In Maxima, the polynomial (x-4)^2*(x-2)^3*(x-1)*(x+3) has two complex roots
>> and only one integer root. Try it yourself:
>>
>> %i1 (x-4)^2*(x-2)^3*(x-1)*(x+3);
>> %i2 allroots(%);
> Hello,
>
> allroots is a numerical solver and roots are approximate. See that
> imaginary parts are near zero. I don't know if it is possible to control
> its accuracy; maybe someone in the list can tell us something about this.
An alternative might be to use polyroots, which you can get from
load(jtroot3). This is essentially the same algorithm as allroots, but
supports bfloat arithmetic. If I set fpprec to 32, I get the roots:
[9.9999999999999999999999999999999b-1
- 4.2370458776519188767231514736868b-33 %i,
2.0967098044841547417705251129837b-11 %i +
1.999999999996426866873956584756b0,
1.9509670336642699191457056558385b-31 %i
- 3.0000000000000000000000000000005b0,
1.9999999999836285277997026851267b0 - 1.3577973543378557813146327177067b-11
%i, 2.0000000000199446053263407300922b0
- 7.3891245014629895950001484527873b-12 %i,
4.8135821109982436660981576396279b-15 %i
+ 4.0000000000000008869298470996269b0,
3.9999999999999991130701529003988b0 -
4.8135821109982534157333151111319b-15 %i]
And prt_root_error tells me that the estimated errors in the roots are:
[8.234297913969850316964397927954b-31,
4.9446128309052513207164850565785b-9,
6.0819981869720905951308760004527b-31,
4.9736209677990489185125295584204b-9, 4.8869211713208376093083688645524b-9,
3.5862126603415141455614873576955b-15, 3.57319044991954585353389212079b-15]
Thus, the single root at 1 is very accurate, as is the single root at
-3. The rest have reduced accuracy because they are repeated.
Ray