Re: [sage-support] why doesn't [lambda x: bessel_J(n, x) for n in [0,1]] work?

2011-10-04 Thread Mike Hansen
On Tue, Oct 4, 2011 at 9:09 PM, Dan Drake wrote: > It seems unreasonably annoying to plot a bunch of Bessel functions > together. How can I work around this? This is due to the way binding works in list comprehensions. For a good explanation and workaround, see http://stackoverflow.com/questions

[sage-support] why doesn't [lambda x: bessel_J(n, x) for n in [0,1]] work?

2011-10-04 Thread Dan Drake
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.000 sage: bessel_J(0,0) 1.0 That is, I get two copies of bessel_J(1, x), instead of J_0 and J_1. Why doesn't that list com