# [SciPy-user] basic usage of fmin_tnc and fmin_l_bfgs_b

physeco andrewenoble@gmail....
Sun May 31 11:17:41 CDT 2009

```I'm new to multidimensional optimization with scipy.  Sorry for asking the
simple question, but I can't figure out the syntax for fmin_tnc and
fmin_l_bfgs_b.  Here's a simple example of the error I'm getting:

Executing:
>def f(x):
return (x[0]*x[1]-1)**2+1
>g=0.1,0.1
>b=[(-10,10),(-10,10)]
>so.fmin_tnc(f,g,bounds=b)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/usr/lib/python2.5/site-packages/scipy/optimize/tnc.py in fmin_tnc(func, x0,
fprime, args, approx_grad, bounds, epsilon, scale, offset, messages,
maxCGit, maxfun, eta, stepmx, accuracy, fmin, ftol, xtol, pgtol, rescale)
244     rc, nf, x = moduleTNC.minimize(func_and_grad, x0, low, up,
scale, offset,
245             messages, maxCGit, maxfun, eta, stepmx, accuracy,
--> 246             fmin, ftol, xtol, pgtol, rescale)
247     return array(x), nf, rc
248

204             x = asarray(x)
--> 205             f, g = func(x, *args)
206             return f, list(g)
207     else:

<type 'exceptions.TypeError'>: 'numpy.float64' object is not iterable
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I get a similar error from so.fmin_l_bfgs_b(f,g,bounds=b).  If you can point
out my mistake, it would be greatly appreciate.

Thank you!
--
View this message in context: http://www.nabble.com/basic-usage-of-fmin_tnc-and-fmin_l_bfgs_b-tp23798939p23798939.html
Sent from the Scipy-User mailing list archive at Nabble.com.

```