Hi!
I'm trying to animate a fourier series in terms of time. I use the
animate command, but it won't take a free variable (in my case x).
Here is my code:
q(n,x,t,v,L) = (4/pi)* cos((2*n+1)*pi/8)*sin((2*n+1)*pi*x/L)*cos((2*n
+1)*v*t/L)/(2*n+1)
Qxt(x,t)=q(0,x,t,1,1)+q(1,x,t,1,1)+q(2,x,t,1,1)+q(3,x,t,1,1)+q(4,x,t,
1,1)+q(5,x,t,1,1)+q(6,x,t,1,1)+q(7,x,t,1,1)+q(8,x,t,1,1)+q(9,x,t,
1,1)+q(10,x,t,1,1)+q(11,x,t,1,1)+q(12,x,t,1,1)+q(13,x,t,1,1)+q(14,x,t,
1,1)+q(15,x,t,1,1)+q(16,x,t,1,1)+q(17,x,t,1,1)+q(18,x,t,1,1)+q(19,x,t,
1,1)+q(20,x,t,1,1)+q(21,x,t,1,1)+q(22,x,t,1,1)+q(23,x,t,1,1)+q(24,x,t,
1,1)+q(25,x,t,1,1)+q(26,x,t,1,1)+q(27,x,t,1,1)+q(28,x,t,1,1)+q(29,x,t,
1,1)+q(30,x,t,1,1)+q(31,x,t,1,1)+q(32,x,t,1,1)+q(33,x,t,1,1)+q(34,x,t,
1,1)+q(35,x,t,1,1)+q(36,x,t,1,1)+q(37,x,t,1,1)+q(38,x,t,1,1)+q(39,x,t,
1,1)+q(40,x,t,1,1)+q(41,x,t,1,1)+q(42,x,t,1,1)+q(43,x,t,1,1)+q(44,x,t,
1,1)+q(45,x,t,1,1)+q(46,x,t,1,1)+q(47,x,t,1,1)+q(48,x,t,1,1)+q(49,x,t,
1,1)+q(50,x,t,1,1)+q(51,x,t,1,1)+q(52,x,t,1,1)+q(53,x,t,1,1)+q(54,x,t,
1,1)+q(55,x,t,1,1)+q(56,x,t,1,1)+q(57,x,t,1,1)+q(58,x,t,1,1)+q(59,x,t,
1,1)+q(60,x,t,1,1)+q(61,x,t,1,1)+q(62,x,t,1,1)+q(63,x,t,1,1)+q(64,x,t,
1,1)+q(65,x,t,1,1)+q(66,x,t,1,1)+q(67,x,t,1,1)+q(68,x,t,1,1)+q(69,x,t,
1,1)
a = animate([Qxt(x,t + float(k)) for k in srange(0,2,0.3)],
xmin=0, xmax=2*pi, figsize=[2,1])
I know I probably don't need the 69th term, but I just wanted to see
how far sage can go.
Anyways, It's a square wave, and I want to see the shape of the square
wave as time progresses, not the displacement of a point x on the
wave. That just causes the pulse to move relative to the point x. So
that's why I want x free.
I was able to do it using @interact, but I don't know if there is way
to present a continuous playback that's smooth.
Any ideas?
--
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/sage-support
URL: http://www.sagemath.org