[Maxima] Brent's method of root finding

Stavros Macrakis macrakis at alum.mit.edu
Mon May 7 10:18:56 CDT 2007


Thanks for this useful code.  Since this code comes from the numeric world
of C, there are a few things which might make it "play better" with Maxima:

   - bzero(lambda([x],%i),-1,1,.0001) => 1.0b0
   (should check that values are real)
   - bzero(acos,.5,2,0.001) => error, `sign' called on an imaginary
   (should handle complex values and errors more reasonably)
   - bzero(lambda([x],mod(x,%pi)-1),1,4,.001) => infinite loop
   (should explicitly float all values)

Compare the code at coerce-float-fun (in plot.lisp).

There are a few other perfectly reasonable assumptions that bzero makes
which should nonetheless be documented explicitly:

   -  That the function is continuous and bounded.
   bzero(tan,1,3,.001) => error: Maximum iterations reached
   -  That there is no guarantee at all about the value of f(z) where
   z=bzero(f,...), only that there exists a zp s.t. abs(zp-z)<tol where
   f(zp) is zero.  For example:
   bzero(lambda([x],print(x,length(cf(x))-5)),1,%pi,0.001) => 1.001b0
   (but f(1.001b0) = -3

Why does it "find" a zero for bounded tan but not unbounded tan, by the way?

Hope these points are helpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070507/b9685f0a/attachment-0001.htm 

More information about the Maxima mailing list