[SciPy-User] fmin / I'm sure this is a dumb syntax error on my part
Fri Oct 14 09:56:35 CDT 2011
On Thu, Oct 13, 2011 at 3:55 PM, tazzben <email@example.com> wrote:
> 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-x**2.0)**2.0 + (1.0-x)**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.
You need a * Between 100.0 and (. It's treating the float like a
function and trying to call it.
> I'm sure it's really stupid, but could someone explain what's suppose to be
> going on?
> SciPy-User mailing list
More information about the SciPy-User