roots of cubics?




Stavros Macrakis wrote:

>>The polynomial is p(z) = -z^3 + 14*z + 12
>>...However,  realroots produces 3 rational roots.
>>...I was surprised that "realroots" produced rational solutions in the
>>first place, but, given that, I thought I'd be in the realm of
>>rational arithmetic.
>>    
>>
>
>I think you have misunderstood realroots.  Realroots finds a *rational
>approximation* to the roots to any given precision.
>
>I'm not sure why it gives its result as a rational number rather than
>a bfloat: perhaps because it was written before bfloats existed;
>
Yes, but in the commercial macsyma, if rootsepsilon is written as a 
bfloat, the final results are converted to bfloats. I expect that the 
internal computation is done in rationals because that avoids any need 
to consider roundoff. The person who first exploited this as a 
computational method was George Collins (and his students), and Collins 
seems to have a strong aversion to any floating point computation. 

>perhaps because it is more efficient internally to do the calculation
>with rationals rather than bfloats (because rationals naturally deal
>with the different precision at each iteration);
>
Efficiency is probably not a strong motivator. Using floats when 
possible (almost all the time), but carefully, would make it much 
faster; falling back on rationals when floats don't work would make the 
algorithm just as foolproof.

> perhaps because the
>algorithm it uses is inherently a rational-number rather than a
>floating-number algorithm.  I suspect a combination of the three.
>
>In any case, it is behaving as documented:
>
>-- Function: realroots (<poly>, <bound>)
>     Finds all of the real roots of the real univariate polynomial poly
>     within a tolerance of bound which, if less than 1, causes all
>     integral roots to be found exactly.  The parameter bound may be
>     arbitrarily small in order to achieve any desired accuracy.  The
>     first argument may also be an equation.  `realroots' sets
>     `multiplicities', useful in case of multiple roots.  `realroots
>     (<p>)' is equivalent to `realroots (<p>, rootsepsilon)'.
>     `rootsepsilon' is a real number used to establish the confidence
>     interval for the roots.  Do `example (realroots)' for an example.
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>  
>