Thanks for your offer. The function above was only a test case, but I had requests where it was necessary to return zeros exactly in double precision. I solved this -- for the test and other functions -- utilizing the 'mpfr' software for arbitrary precision. Actually, Ridders' method can be applied in this context and returns the zero in whatever precision is needed. More iterations are needed, of course, to identify roots so accurately. For example, for the test function `sqrt(e)` will be computed exactly for 20 digits in only(!) 112 iterations.
Think it would be interesting for me to reconstruct this calculation in Julia. Hans Werner On Tuesday, February 25, 2014 5:26:16 PM UTC+1, Simon Byrne wrote: > > On Monday, 24 February 2014 11:34:22 UTC, Hans W Borchers wrote: >> >> This innocent looking test function appears to be so flat that only an >> arbitrary precision solver will locate this root more exactly. >> > > I think what is required in this case is a more accurate implementation of > the function itself! > > If you actually have a use case for such functions, please let me know as > I've been (slowly) making some changes to the Distributions.jl, and one of > the functions required is "log1pmx", a stable form of log(1+x) - x. I've > got some draft code such that I've managed to get the error down to 2.5 > ulps. It would be fairly straightforward to modify this to get an > expression for g(x) = log(x+1) - x + x^2/2, and then your function could be > written as g(x/sqrt(e) -1) > >
