[SciPy-User] More elegant way to recover the last iterate of a non-converging newton?

nicky van foreest vanforeest at gmail.com
Thu Aug 27 02:49:08 EDT 2009


A silly suggestion perhaps, but why don't you just change the tolerance?

2009/8/27 David Goldsmith <d_l_goldsmith at yahoo.com>:
> Hi, folks!  Question re: my own work - I'm using scipy.optimize.minpack.newton with a rather low maxiter (10) so it's frequently terminating with the "Failed to converge after maxiter iterations, value is <last iterate>" RuntimeError, which isn't a problem for now.  What is a problem is I still want to use <last iterate>, and the best I've come up with for "catching" it is:
>
> try:
>    result = newton(f, z, fp, tol=tol, maxiter=maxiter)
> except RuntimeError, e:
>    result = np.complex( e.message.split( '(' )[-1].split( ')' )[0] )
>
> There's got to be a better way, no?
>
> DG
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list