Week 11

Fourier Series - Getting all the coefficients

We would now like to go through an example where we extract all the coefficients An and δn.  To do this, we will start with a superposition of normal modes with different phases and amplitudes, and we will go backwards from there - extracting out those coefficients from initial conditions.  Then we will do another example where we have a given initial configuration and velocity configuration, and we will then work out the coefficients again.

Let’s take some values for the velocity and length:

v=1;L=1;

Then let’s take a set of A’s and δ’s that I made up out of thin air:

A[n_]=1/n;δ[n_]=π n/4;

Let’s take 10 total modes contributing:

y[x_,t_]=Sum[A[n] Cos[n π v/L t-δ[n]] Sin[n π x/L],{n,1,10}];

Now lets look at the initial conditions at t=0:

y0[x_]=y[x,0];

v0[x_]=D[y[x,t],t]/.{t->0};

Now recall we define Bn = An Cos[δn] and Cn = An n π v/L Sin[δn] with

Bn[n_]:=2/L Integrate[y0[x] Sin[n π x/L],{x,0,L}];

Cn[n_]:=2/L Integrate[v0[x] Sin[n π x/L],{x,0,L}];

Ansolv[n_]:=Sqrt[Bn[n]^2+Cn[n]^2/(n π v/L)^2];

δnsolv[n_]:=ArcTan[Bn[n],(Cn[n]/(n π v/L))]

Table[Ansolv[n],{n,1,20}]

This last step took a while!  However, we see that the numbers we started with (1/n) come out up to 10, which is the number we stopped at

For the phases, we should get π/4,π/2,3π/4, etc (although signs can be different for equivalent quadrants).  We only look up to 10, since we just showed that the A’s for n>10 are all zero:

Table[δnsolv[n],{n,1,10}]

And it works out!

Now Go For More General initial conditions:

Let us do a positive sawtooth initial configuration, with a negative square wave initial velocity:

k=1;a=1;

Y20[x_]=k x;

V20[x_]=-a π;

Bn2[n_]:=2/L Integrate[Y20[x]Sin[n π x/L],{x,0,L}];

Cn2[n_]:=2/L Integrate[V20[x] Sin[n π x/L],{x,0,L}];

An2[n_]:=Sqrt[Bn2[n]^2+Cn2[n]^2/(n π v/L)^2];

δn2[n_]:=ArcTan[Bn2[n],(Cn2[n]/(n π v/L))];

Now we will look at the first 50 normal modes that make up this initial configuration and velocity:

Atab=Table[Simplify[An2[n]],{n,1,50}]

δtab=Table[Simplify[δn2[n]],{n,1,50}]

Using this info, we can write the full solution in terms of normal modes 1-50 as:

y2[x_,t_]=Sum[Atab[[n]] Cos[n π v/L t-δtab[[n]]] Sin[n π x/L],{n,1,50}];

Now let us look at how this system evolves with time over 5 periods using a slider bar:

T1=2 π/(π v/L);

Here is what the string will look like as a function of time:

Manipulate[Plot[y2[x,t],{x,0,L},PlotRange->{-2,2}],{t,0,5*T1}]

Here is a plot of the transverse velocity of the string as a function of time:

Manipulate[Plot[D[y2[x,T],T]/.{T->t},{x,0,L},PlotRange->{-5,5}],{t,0,5*T1}]

A Traveling Wave:

Let us create a traveling wave pulse that moves to the right.  We start by writing down a “freeze frame” pulse that has a “Gaussian” shape:

σ=1;

WAVE[x_]=Sqrt[2 π/σ]Exp[-x^2/2/σ^2];

Plot[WAVE[x],{x,-10,10},PlotRange->{0,3}]

Now let’s make it move to the RIGHT:

Animate[Plot[WAVE[x-v t],{x,-10,10},PlotRange->{0,3}],{t,0,10}]

And to the left!  (Note here we change the sign on v, as we discussed in class)

Animate[Plot[WAVE[x+v t],{x,-10,10},PlotRange->{0,3}],{t,0,10}]

And a superposition of them:

Animate[Plot[WAVE[x-v t+10]+WAVE[x+v t-10],{x,-10,10},PlotRange->{0,6}],{t,0,20}]

And another interesting Superposition:

Animate[Plot[WAVE[x-v t+10]-WAVE[x+v t-10],{x,-10,10},PlotRange->{-3,3}],{t,0,20}]