I have a question. It's more of a python question than a sympy
question... but here it is. I have this function that I'm trying to
view/model. Basically it's a sine function... but a traveling sine
function. I'd like to plot it at various stages of progression. I
thought something of the following would be acceptable, but I was wrong.
##
import pylab
xx = pylab.arange(0,1,1/1000)
u = 1/2 * (sin(pi*(x+t/6)) + sin(pi*(x-t/6)))
U = lambdify(x, u, 'numpy')
pylab.figure(1)
for t in range(0,6.6):
pylab.plot(xx, U(xx))
pylab.show()
##
Here's the output
##
NameError: global name 't' is not defined
##
I'm using isympy as interface, FYI.
I was thinking/hoping that sympy would "see" the t dependence and
substitute accordingly. However, I believe that numpy is taking over at
the point of initializing U. Hence my error of an undefined variable t.
I thought I would outsmart numpy by making a substitution of my own and
modify the for-loop as follows.
##
for i in range(0,6.6):
pylab.plot(xx, U(xx).subs(t,i/6))
##
However, that failed as well.
Does anybody know of a little trick that I could use to get the original
function u(x,t) to plot at various values of t... without hard coding
each interval independently?
~~archery~~
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.