[SciPy-user] lambda forms?

dmitrey openopt at ukr.net
Thu Jun 28 10:27:17 EDT 2007


works for me
(however, I used 1-line:

return lambda x,y:sum(height*exp(-(((center_x-x)/width)**2+((center_y-y)/width)**2)/2))

)
HTH, D

Emanuele Zattin wrote:
> Hello,
> i'm trying to define a function to calculate the sum of some gaussian
> given their paramers. Something like:
>
> def gaussian(height, center_x, center_y, width):
>     """Returns a gaussian function with the given parameters"""
>     width = float(width)
>     return lambda x,y:
> sum(height*exp(-(((center_x-x)/width)**2+((center_y-y)/width)**2)/2))
>
> where all the parameters are arrays of the same length (the length is variable).
> This version of course does not work, but i wonder if it is still
> possible using lambda forms or if i have to write the function in an
> explicit way.
>
> Emanuele
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>
>   




More information about the SciPy-User mailing list