More elegant way to recover the last iterate of a non-converging newton?
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
A silly suggestion perhaps, but why don't you just change the tolerance? 2009/8/27 David Goldsmith <d_l_goldsmith@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@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
'Cause I'm generating a fractal and, at least until I've found the window I want, speed is more important than precision. DG --- On Wed, 8/26/09, nicky van foreest <vanforeest@gmail.com> wrote:
From: nicky van foreest <vanforeest@gmail.com> Subject: Re: [SciPy-User] More elegant way to recover the last iterate of a non-converging newton? To: "SciPy Users List" <scipy-user@scipy.org> Date: Wednesday, August 26, 2009, 11:49 PM A silly suggestion perhaps, but why don't you just change the tolerance?
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
2009/8/27 David Goldsmith <d_l_goldsmith@yahoo.com>: 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@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
participants (2)
-
David Goldsmith
-
nicky van foreest