Status: New
Owner: ----
New issue 245 by
Kirill.I...@gmail.com: Bisection method fails with high
precision
http://code.google.com/p/mpmath/issues/detail?id=245
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/optimization.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.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings