Movies for 
  Introduction to Partial Differential Equations
      by Peter J. Olver

Movies can be viewed at    
         http : // www.math.umn.edu/~olver/mov.html

Numerical Transport and Wave Equation Movies:   
        Figures 5.5, 5.8, 5.9, 5.10.

Routine for constructing bidiagonal and tridiagonal matrices

bid[a_,b_,n_] := (r = Join[{a,b},Table[0,{k,n-2}]]; m=Table[RotateRight[r,k-1],{k,n}]; m[[n,1]] = 0;m);

trd[a_,b_,c_,n_] := (r = Join[{b,c},Table[0,{k,n-3}],{a}]; m=Table[RotateRight[r,k-1],{k,n}]; m[[1,n]]= m[[n,1]] = 0;m);
trd[b_,c_,n_] := trd[c,b,c,n]

Determine numerical parameters and initial data for transport equation

Transet:= (xs = (Subscript[x, 0]) + δx  Range[0,n] ;us = f /@ xs; σ = c δt/δx;A= bid[σ  + 1,-σ ,n+1];Print["Δx = ",δx,"     Δt = ",δt,"     c =  ",c,"     σ =  ",σ];
hu=Which[σ <= 0 &&σ >= -1 ,.6,True,.95];);

Trancd:= (xs = (Subscript[x, 0]) + δx  Range[0,n] ;us = f /@ xs; σ = c δt/δx;A= trd[-σ/2,1,σ/2,n+1];Print["Δx = ",δx,"     Δt = ",δt,"     c =  ",c,"     σ =  ",σ];
hu=Which[σ <= 0 &&σ >= -1 ,.6,True,.95];);

Numerical iteration and plotting routine for transport equation

Tranit := (t=0;While[t< tf,vs = {xs,us}//Transpose; Print[ListPlot[vs,Joined -> True, PlotRange ->{{(Subscript[x, 0]) ,(Subscript[x, 1])},{(Subscript[y, 0]) , (Subscript[y, 1])}},AspectRatio -> asp,Ticks -> None,PlotStyle ->{Thickness[th],Hue[hu]}]];us = A. us; t = t+δt])

Determine numerical parameters and initial data for wave equation

Waveset:= (xs = (Range[n-1]/n //N) ;us = f /@ xs; σ = c δt/δx; B = trd[2(1-(σ^2)),(σ^2),n-1];uv = B.us/2;Print["Δx = ",δx,"     Δt = ",δt,"     c =  ",c,"     σ =  ",σ];
hu=Which[σ <= 1,.6,True,.1];);

Numerical iteration and plotting routine for wave equation

Waveit := (t=0;While[t< tf,vs = {xs,us}//Transpose; vs = Join[{{0,0}},vs,{{1,0}}];Print[ListPlot[vs,Joined -> True, PlotRange ->{{(Subscript[x, 0]) ,(Subscript[x, 1])+.01},{(Subscript[y, 0]) , (Subscript[y, 1])}},AspectRatio -> asp,Ticks -> None,PlotStyle ->{Thickness[th],Hue[hu]}]]; uw= B. uv - us;us = uv; uv = uw; t = t+δt])

Figure 5.5. Numerical solutions to the transport equation

Set initial data

e[x_,a_] := (E^(-a x^2))

f[x_] = .4 e[x-.5,300] + .1  e[x-.65,300];

Set plotting parameters

(Subscript[x, 0]) =0;(Subscript[x, 1])=1;(Subscript[y, 0]) = 0; (Subscript[y, 1]) =.6;asp = Automatic; th = .004;

Plot movies — evaluate Notebook to generate output

c=.5;n=200;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = δx;tf = .3;

Transet

Tranit

c=-.5;n=200;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = δx;tf = .5;

Transet

Tranit

c=-1;n=200;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = δx;tf = .3;

Transet

Tranit

c=-1.5;n=200;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = δx;tf = .3;

Transet

Tranit

Figure 5.8. Centered difference numerical solution to the transport equation

Set initial data

e[x_,a_] := (E^(-a x^2))

f[x_] = .4 e[x-.5,300] + .1  e[x-.65,300];

Set plotting parameters

(Subscript[x, 0]) =0;(Subscript[x, 1])=1;(Subscript[y, 0]) = -.5; (Subscript[y, 1]) =1.;asp =.75; th = .004;

Plot movies — evaluate Notebook to generate output

c=1;n=200;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = δx;tf = .5;

Trancd

Tranit

Figures 5.9 and 5.10. Numerically stable and unstable waves

Set initial data

d = .3; a = .05;f[x_] := (E^(-((x-d)/a)^2));

Set plotting parameters

(Subscript[x, 0]) =0;(Subscript[x, 1])=1.;(Subscript[y, 0]) =-1 ;(Subscript[y, 1]) =1;asp =.75; th = .004;

Plot movies — evaluate Notebook to generate output

c=1;n=90;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .01;tf = 1;

Waveset

Waveit

c=1;n=90;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .02;tf = .5;

Waveset

Waveit

c=1;n=100;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .01;tf = 1;

Waveset

Waveit

c=1.05;n=100;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .01;tf = 1;

Waveset

Waveit

c=1.;n=110;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .01;tf = .5;

Waveset

Waveit

c=1.;n=90;δx = ((Subscript[x, 1])-(Subscript[x, 0]))/n//N;δt = .01;tf = 1;

Waveset

Waveit