Find roots



>>>>> "Aleksas" == Aleksas Domarkas <aleksasd873 at gmail.com> writes:

    Aleksas> see 
http://www.math.utexas.edu/pipermail/maxima/2013/031439.html
    Aleksas> Find roots of f=log(x^3-x*78+90)+1000*x
    Aleksas>  (%i1) f:log(x^3-x*78+90)+1000*x$
    Aleksas> (%i2) allroots(x^3-x*78+90); map(rhs,%)$
    Aleksas> (%o2) 
[x=1.174624074847539,x=8.185668853475939,x=-9.360292928323476]
    Aleksas> (%i4) [x1,x2,x3]:sort(%);
    Aleksas> (%o4) [-9.360292928323476,1.174624074847539,8.185668853475939]
    Aleksas> x^3-x*78+90<0 if x in (-infinity, x1)U (x2, x3). Then
    Aleksas>  function f is defined for all x in (x1, x2)U(x3, infinity)
    Aleksas> (%i5) limit(f,x,x1,plus);
    Aleksas> (%o5) -inf
    Aleksas> (%i6) limit(f,x,x2,minus);
    Aleksas> (%o6) 1140.659863000102
    Aleksas> (%i7) limit(f,x,x3,plus);
    Aleksas> (%o7) 8155.863524711861

What is the intent of computing the limits above with approximate
roots of the cubic?

    -->   wxplot2d([f], [x,-20,20])$
    Aleksas>  Function f has only one root:

"No, the function has 3 roots.  You've found the negative root.

The other two roots, which don't show up in the graph, are very close
the to positive roots of the cubic.  As mentioned before, this is
easier to see if you transform log(x^3-78*x+90)+1000*x = 0 to
(x^3-78*x+90)=exp(-1000*x).  Since exp(-1000*x2) and exp(-1000*x3) are
zero (for floats), x2 and x3 are very close to the roots."


I agree with Ray on this.  The function f definitely has three real roots. 
But two of them are very close to causing the error "log(0) encountered" 
which means the function has infinities in very close proximity to the 
roots.  I guess they are called poles.  Anyway, I am not sure if there is an 
easy way in Maxima to find the roots since find_root() fails on complex 
values. Finding the three roots to high precision is hard.  Ray has found 
two of them to low precision by stating they are more or less the same as 
the roots of the cubic, which is true but the roots of f differ slightly 
from the roots of the cubic, but not by very much.  The challenge is maybe 
to figure out the difference between the cubic's roots and f's roots.

Rich