upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

failing findroot using solver='anewton' #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
>>> from mpmath import *
>>> findroot(lambda x: sin(60*degree)-6/(sqrt(x**2+40)), 0,
solver='anewton', verbose=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/one/src/mpmath/svn/mpmath/settings.py", line 135, in g
    return f(*args, **kwargs)
  File "mpmath/optimization.py", line 909, in findroot
    if not isinstance(x, (list, tuple, matrix)):
UnboundLocalError: local variable 'x' referenced before assignment

Somehow the solver (being an iterator) cancels immediately, so that x is
undefined.

Original issue reported on code.google.com by Vinzent.Steinberg@gmail.com on 27 Jan 2009 at 7:46

GoogleCodeExporter commented 9 years ago

Original comment by Vinzent.Steinberg@gmail.com on 26 Jun 2009 at 7:32