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 Heat Equation Movies:   
        Figures 5.2, 5.3, 5.4, 5.5, 5.8, 5.9, 5.10.

Routine for constructing tridiagonal matrices

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

Heatset := ( δx =1/n//N;  μ = δt/δx^2;Print["μ = ", μ];xs = (Range[n-1]/n //N);us = f /@ xs;);

Numerical iteration and plotting routine

Heatit := (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])},{(Subscript[y, 0]) , (Subscript[y, 1])}},AspectRatio -> asp,Ticks -> None, PlotStyle ->{Thickness[th],Hue[hu]}]]; us = M. us;t = t+δt])

Figure 5.2. Numerical solutions for the heat equation based on the explicit scheme

Set initial data

f[x_] := 3Which[x < .2,-x, x < .7, x - .4, True,1-x]

pr = {{0,1},{-1.8,1.8}};

Set plotting parameters

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

Explicit numerical solution routine

Heatex := ( M=A = trd[1-2μ,μ,n-1];t=0;If[μ < 1,hu=.6,hu=.95];Heatit);

Set time range and plot movies — evaluate Notebook to generate output

n=10; δt = .01;tf  = .1; Heatset

Heatex

n=10; δt = .005;tf  = .2; Heatset

Heatex

n=100; δt = .005;tf  = .07; Heatset

Heatex

n=100; δt = .0001;tf  = .003; Heatset

Heatex

n=100; δt = .00005;tf  = .01; Heatset

Heatex

Figure 5.3. Numerical solutions for the heat equation based on the implicit scheme

Set initial data

f[x_] := 3Which[x < .2,-x, x < .7, x - .4, True,1-x]

pr = {{0,1},{-1.8,1.8}};

Set plotting parameters

(Subscript[x, 0]) =0;(Subscript[x, 1])=1;(Subscript[y, 0]) = -1; (Subscript[y, 1]) =1.2; asp = .95; th = .004;hu=.85;

Implicit numerical solution routine

Heatim:= ( A = trd[1+2μ,-μ,n-1];M= Inverse[A];Heatit);

Set time range and plot movies — evaluate Notebook to generate output

n=10; δt = .01;tf  = .3; Heatset

Heatim

n=10; δt = .005;tf  = .3; Heatset

Heatim

n=100; δt = .005;tf  = .3; Heatset

Heatim

Figure 5.4. Numerical Solutions for the heat equation based on the Crank-Nicolson scheme

Set initial data

f[x_] := 3Which[x < .2,-x, x < .7, x - .4, True,1-x]

pr = {{0,1},{-1.8,1.8}};

Set plotting parameters

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

Crank–Nicholson numerical solution routine

HeatCN := ( B= trd[1+μ,-μ/2,n-1];
A= trd[1-μ,μ/2,n-1];M= Inverse[B].A;Heatit);

Set time range and plot movies — evaluate Notebook to generate output

n=10; δt = .01;tf  = .3; Heatset

HeatCN

n=10; δt = .005;tf  = .3; Heatset

HeatCN

n=100; δt = .01;tf  = .3; Heatset

HeatCN