plot a lambda function?

Hi.

Is it possible to plot arbitrary lambda function with matplotlib? Say, if i have f = lambda x: x*sin(x), can i just plot it without building argument-value arrays? It would be a very convenient and useful feature.

···

Sincerely,

max ulidtko

You'd always have to specify the domain, so

plot(map(lambda x:x**2, range(1,10)))

shouldn't be much longer than the minimal command.

&C

···

On Mar 10, 2010, at 10:12 AM, max ulidtko wrote:

Hi.

Is it possible to plot arbitrary lambda function with matplotlib? Say, if i have f = lambda x: x*sin(x), can i just plot it without building argument-value arrays? It would be a very convenient and useful feature.

------
Sincerely,
max ulidtko
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

...although

>>plot(map(lambda x:x**2, range(5,15)))

probably doesn't do exactly what you want; is the idea that

>>plot(range(5,15),lambda x:x**2) #DOESN'T WORK

should automatically work like

>>plot(range(5,15), map(lambda x:x**2, range(5,15)))

by recognizing that the second argument is a function rather than a list?

&C

···

On Mar 10, 2010, at 10:47 AM, Chloe Lewis wrote:

You'd always have to specify the domain, so

plot(map(lambda x:x**2, range(1,10)))

shouldn't be much longer than the minimal command.

&C

On Mar 10, 2010, at 10:12 AM, max ulidtko wrote:

Hi.

Is it possible to plot arbitrary lambda function with matplotlib?
Say, if i have f = lambda x: x*sin(x), can i just plot it without
building argument-value arrays? It would be a very convenient and
useful feature.

------
Sincerely,
max ulidtko
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

How about this (though it is getting a little clunky):

    plot(*transpose(map(lambda x:(x,sin(x**2)/x**3), arange(3,6, 0.01))))

···

On Wed, Mar 10, 2010 at 7:57 PM, Chloe Lewis <chlewis@...1016...> wrote:

...although

>>plot(map(lambda x:x**2, range(5,15)))

probably doesn't do exactly what you want; is the idea that

>>plot(range(5,15),lambda x:x**2) #DOESN'T WORK

should automatically work like

>>plot(range(5,15), map(lambda x:x**2, range(5,15)))

by recognizing that the second argument is a function rather than a
list?

&C

On Mar 10, 2010, at 10:47 AM, Chloe Lewis wrote:

You'd always have to specify the domain, so

plot(map(lambda x:x**2, range(1,10)))

shouldn't be much longer than the minimal command.

&C

On Mar 10, 2010, at 10:12 AM, max ulidtko wrote:

Hi.

Is it possible to plot arbitrary lambda function with matplotlib?
Say, if i have f = lambda x: x*sin(x), can i just plot it without
building argument-value arrays? It would be a very convenient and
useful feature.

------
Sincerely,
max ulidtko
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users