On 17 February 2014 22:15, "André Walker-Loud <walksl...@gmail.com>"
<walksl...@gmail.com> wrote:
>> This particular case is easily solved:
>>
>> def f_lambda(x,pars):
>>     return lambda x: poly(x,*pars)
>>
>> You let the closure take care of pars and return a function that takes
>> exactly one argument x.
>
> Hi Oscar,
>
> This is the opposite of what I am trying to do.  In the example, x represents 
> the data and pars represent the parameters I want to determine, so it is the 
> pars which I need passed into the "func_code.co_varnames" part of f.

BTW if you're trying to fit the coefficients of a polynomial then a
general purpose optimisation function is probably not what you want to
use. I would probably solve (in a least squares sense and after
suitable scaling) the Vandermonde matrix.

(I can explain that more if desired.)


Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to