[Tutor] What Eval() Hath Men Wrought
Theresa Robinson
robinst at MIT.EDU
Thu Jun 24 12:30:11 EDT 2004
> There is no right way, mostly I would pass a function reference
> as my preferred route and apply() as a close second if, for
> example the functions took different numbers of arguments.
Thank you very much for your help. I did a little more research and it
looks like somebody has already started on an optimization package,
although it doesn't have everything we'll need.
(http://pylab.sourceforge.net/packages/optimize.py)
I think it would be a good idea for me to use the same techniques, and
hopefully even the same argument list etc. for any algorithms I add to it.
And it has:
def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, fulloutput=0, printmessg=1)
<snip>
fxr = apply(func,(xr,)+args)
so I think I'll just copy that. Next I should look up apply().
Thanks,
Theresa
More information about the Tutor
mailing list