I want a list of Bessel functions, suitable for feeding to plot(). But I get:

sage: f0, f1 = [lambda x: bessel_J(n, x) for n in [0,1]]  
sage: f0(0)
0.000000000000000
sage: bessel_J(0,0)
1.0000000000000

That is, I get two copies of bessel_J(1, x), instead of J_0 and J_1. Why
doesn't that list comprehension work? Why does the lambda function seem
to wait until n has its last value?

Something like [sin(n*x) for n in range(5)] works as expected.

It seems unreasonably annoying to plot a bunch of Bessel functions
together. How can I work around this?

Dan

--
---  Dan Drake
-----  http://mathsci.kaist.ac.kr/~drake
-------

Attachment: signature.asc
Description: Digital signature

Reply via email to