Vectorization and Numeric (Newbie)
Cyril Bazin
cyril.bazin at info.unicaen.fr
Tue Feb 28 08:08:05 EST 2006
Are you looking for the "map" function?
>>> def f(x): return x+4
>>> map(f, [1,2,3,3,70])
[5, 6, 7, 7, 74]
Cyril
On 2/28/06, Ronny Mandal <ronnyma at math.uio.no> wrote:
>
> Assume you have a mathematical function, e.g. f(x) = x + 4
>
> To calculate all the values from 1 to n, a loop is one alternative.
>
> But to make this function work with vectors instead i.e
> f(x_vector) = result_vector,
> how should the function then be implemented?
>
> Thanks
>
> RM
>
> --
>
> Support bacteria - it's the only culture some people have!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060228/253d4f9e/attachment.html>
More information about the Python-list
mailing list