On Wed, 16 Jun 2010 at 07:34PM -0700, Jaasiel Ornelas wrote:
> 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(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've made a bunch of these animations for Fourier series; one thing I've
done is render the plots of partial sums to PNG files, and then use
ffmpeg2theora to make a Theora video, which seems to display nicer than
animated GIFs. You can't do it all inside Sage, but the result looks
quite good.



Dan

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

Attachment: signature.asc
Description: Digital signature

Reply via email to