[SciPy-Dev] optimize.fsolve endless loop with nan
Wed Mar 13 11:17:41 CDT 2013
On Wed, Mar 13, 2013 at 10:51 AM, <firstname.lastname@example.org> wrote:
> preliminary question, I didn't have time yet to look closely
> I have a problem where fsolve goes into a range where the values are
> nan. After that it goes into an endless loop, as far as I can tell.
> Something like this has been fixed for optimize.fmin_bfgs. Was there a
> fix for this also for fsolve, since 0.9.0?
> (The weirder story: I rearranged some test, and made unfortunately
> also some other changes, and now when I run nosetests it never
> returns. Ctrl+C kills nosetests, but leaves a python process running.
> I have no clue why the test sequence should matter.)
I had left the starting values in a module global even after I started
to adjust them in one of the cases.
The starting value for fsolve was in a range where the curvature is
very flat, and fsolve made huge steps into the invalid range. After
getting nans, it went AWOL.
If I return np.inf as soon as I get a nan, then fsolve seems to stop
right away. Is there a way to induce fsolve to stay out of the nan
zone, for example returning something else than inf?
I don't want to find a very specific solution, because I'm throwing
lot's of different cases at the same generic method.
More information about the SciPy-Dev