[SciPy-user] howto call optimize.brute()

Spuhler, Peter pspuhler at ball.com
Mon Oct 9 14:00:13 CDT 2006


On Mon, 9 Oct 2006 10:17:28 -0600
  "Spuhler, Peter" <pspuhler <at> ball.com> wrote:
> I can't seem to get optimize.brute working
> 
> The following error function works for 
>optimize.fmin_powell for example
> Def _error(x,offset):
> 	Error = x[0]**2 + x[1]**2 + offset
> 	Return error
> Optimize.fmin(_error,x0=[1,1],args=(10,))
> 
> But if I now try to use optimize.brute
> Bounds = ((-10,10,0.1),(-10,10,0.1))
> Optimize.brute(_error,ranges=bounds,args=(10,))
> I get the following error. What am I missing?
> 
> C:\Python24\lib\site-packages\scipy\optimize\optimize.py 
>in brute(func,
> ranges,
> args, Ns, full_output, finish)
>   1577     if (N==1):
>   1578         grid = (grid,)
> -> 1579     Jout = vecfunc(*grid)
>   1580     Nshape = shape(Jout)
>   1581     indx = argmin(Jout.ravel())
> 
> C:\Python24\lib\site-packages\numpy\lib\function_base.py 
>in
> __call__(self, *args
> )
>    619         nargs = len(args)
>    620         if (nargs > self.nin) or (nargs < 
>self.nin_wo_defaults):
> --> 621             raise ValueError, "mismatch between 
>python function
> inputs"\
> 
>    622                   " and received arguments"
>    623         if self.nout is None or self.otypes == 
>'':
> 
> ValueError: mismatch between python function inputs and 
>received
> arguments
> 
> Thanks
> -Peter
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user <at> scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

I cannot reproduce your problem.
I am using
>>> scipy.__version__
'0.5.2.dev2247'
>>> import numpy
>>> numpy.__version__
'1.0.dev3292'

Nils

I'm using enthought python dist
Numpy 0.9.9.2706
Scipy 0.5.0.2033
Is this a bug in this version of scipy?





More information about the SciPy-user mailing list