[SciPy-user] Using SciPy/NumPy optimization
Wed Mar 14 02:00:57 CDT 2007
> Hi there:
> I am looking for a non-linear, constrained optimization tool, and thought fmin_tnc would do the job that I wanted to do.
> As a starter, I tried the attached script posted here recently. However, I get the following error when I run this script:
> "TypeError: only length-1 arrays can be converted to Python scalars"
> Can any one help me to figure out what I was doing wrong ?
> def __call__(self, abc):
> """ A function suitable for passing to the fmin() minimizers.
> a, b, c = abc
> y = a*(1.0 + b*c*self.x) ** (-1.0/b)
> dy = self.y - y
> return dy*dy
Sorry, I screwed up this example. The function needs to return a scalar.
return dot(dy, dy)
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user