[SciPy-Dev] optimize.fsolve too accurate

Joris Vankerschaver joris.vankerschaver at gmail.com
Thu Feb 24 01:38:08 EST 2011


Hi all,

I'm relatively new to SciPy, so I hope you will excuse the occasional 
inaccuracies, but I noticed something slightly strange with 
scipy.optimize.fsolve: the following snippet

   import scipy.optimize
   fun = lambda x: x**2
   scipy.optimize.fsolve(fun, 0.5)

returns  "Warning: The number of calls to function has reached maxfev = 
400", while the answer is presented as  2.8405269166788003e-84 (you 
might have to change the initial conditions somewhat to obtain this 
error).  As the default tolerance for fsolve is roughly 1.4e-8, the 
computation should have terminated long before reaching this level of 
precision.

My question: is this a bug or am I invoking fsolve in the wrong way?

Secondly, is there a quick and easy way to build parts of the scipy 
library in place for testing?  I looked at the implementation and there 
are a few things I would like to experiment with, but I don't know how 
to go about this other than by rebuilding scipy in its entirety.

Thanks!
Joris



More information about the SciPy-Dev mailing list