I am using the Newton algorithm in minpack.py to find the roots of a
complex expression. This seems to work correctly, but the error
raised if it doesn't convert wasn't written with the possiblity of
complex expressions in mind. I have changed the ending of the newton
function (line 330) from
raise RuntimeError, "Failed to converge after %d iterations, value is
%f" % (maxiter,p)
to
if type(p) is complex:
raise RuntimeError, "Failed to converge after %d iterations,
value is %f%+fj" % (maxiter,real(p),imag(p))
else:
raise RuntimeError, "Failed to converge after %d iterations,
value is %f" % (maxiter,p)
This just makes the function raise a more helpful error message.
Otherwise it reads, error float is required.
I made this change on my machine. Is it valuable and what is the
procedure to make it part of scipy? And is it worth doing if I am not
in the newscipy yet?
Thanks,
Ryan