What steps will reproduce the problem?
1. Execute this:
mp.dps = 240
-ceil(log(abs(findroot(lambda x: sign(x-3), (1,4), solver='bisect',
verbose=True, verify=False, tol=1e-200) - 3))/log(10))
2.
3.
What is the expected output? What do you see instead?
Expected 200, or something close to log(1/tol)/log(10)
The actual output is 30.
What version of the product are you using? On what operating system?
0.17 (using sage 5.12), but the bug is present in development version: line 304
in this file:
https://code.google.com/p/mpmath/source/browse/trunk/mpmath/calculus/optimizatio
n.py
Please provide any additional information below.
To fix, change
maxsteps = 100
to
self.maxsteps = 2*ctx.prec + ceil(log(abs(a-b))/log(2))
With maxsteps set to this, this will provide absolute accuracy of the root of
2**(-2*prec), which is all right for any roots greater than 2**-prec in
absolute value.
A similar bug appears to be present in every other root finding method that
uses fixed maxsteps, but takes more precision/work to show.
Original issue reported on code.google.com by Kirill.I...@gmail.com on 30 Oct 2013 at 8:42
Original issue reported on code.google.com by
Kirill.I...@gmail.com
on 30 Oct 2013 at 8:42