[sympy] Using symbolic expressions for numeric calculations

2009-12-03 Thread twk
Hi, I am relatively new to sympy but like it and try to use it for my calculations. Now, I would like to use symbolic terms for further numeric calculations. I tried to use something like .subs(x,range(20)) but it did not work. Is there a way to treat symbols in a symbolic expression like a list o

Re: [sympy] Using symbolic expressions for numeric calculations

2009-12-03 Thread Aaron S. Meurer
Maybe we should vectorize subs, but in the meanwhile, you can use list comprenehsions, and map if you want to evalf: In [5]: s = x*pi In [6]: [s.subs(x, i) for i in range(10)] Out[6]: [0, π, 2⋅π, 3⋅π, 4⋅π, 5⋅π, 6⋅π, 7⋅π, 8⋅π, 9⋅π] In [7]: map(N, [s.subs(x, i) for i in range(10)]) Out[7]: [0, 3.

Re: [sympy] Using symbolic expressions for numeric calculations

2009-12-03 Thread Aaron S. Meurer
I also made this issue for this: http://code.google.com/p/sympy/issues/detail?id=1743 What do you think about a subs function? I just realized that would have to be a lambda for map anyway because it takes multiple arguments. So I could go either way on that. Aaron Meurer On Dec 3, 2009, at