[SciPy-User] fmin / I'm sure this is a dumb syntax error on my part
tazzben
tazzben at me.com
Thu Oct 13 15:55:42 EDT 2011
So, I'm new to the optimization tools in scipy, so I'm trying to solve a problem I already know the answer to in an attempt to learn the system.
What I'm trying to solve is:
min of 100(y-x^2)^2+(1-x)^2
solving for both x and y (the solution is 1,1).
Based on the example, I tried this:
from scipy.optimize import fmin
def sFunction(x):
return 100.0(x[1]-x[0]**2.0)**2.0 + (1.0-x[0])**2.0
iv = [2.0, 5.0]
fmin(sFunction, iv)
Also in an earlier version I had x and y, but it wasn't working so I thought it might be better as an array. So when I do this I get an error that says that a float is not callable. What I think is happening is that it is substituting the initial guess in (thus it returns a float) but it isn't iterating for some reason.
I'm sure it's really stupid, but could someone explain what's suppose to be going on?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111013/363e9b67/attachment.html>
More information about the SciPy-User
mailing list