Heat Animation

John M. Sullivan and Mathew M. Thomas

Solution to the heat equation

Separable solution to the heat equation

U[x_,t_] := Block[{k=Ceiling[1/Sqrt[t]]},
  2 Sum[Block[{nu=(m+.5) N[Pi]},
     (-1)^m/nu Exp[-nu^2 t] Cos[nu x]], {m,0,k}]];

U[x_,0.] := 1;

Full solution to the heat equation

T[x_,y_,t_] := U[x,t] U[y,t];

Graphics

heatplot

heatplot[n_,t_] := Block[{u = Table[U[x,t], {x,-1,1,2/n}]},
  ListHuePlot[Outer[Times,u,u]]];

ListHuePlot

ListHuePlot[array_] :=
  ListPlot3D[
    Table[Table[0,{Length[array]+1}],{Length[array]+1}],
    Map[HueColor, array, {2}],
    Boxed->False, ViewPoint->{0,0,10}, 
    Mesh->False, Axes->None]

HueColor

HueColor[h_] := 
  Block[{fh = 4.5 h, i, f}, i = Floor[fh]; f = fh - i;
    HelpColor[i,f]];

HelpColor

HelpColor[0,f_] := RGBColor[1,f,0];    
HelpColor[1,f_] := RGBColor[1-f,1,0];
HelpColor[2,f_] := RGBColor[0,1,f];    
HelpColor[3,f_] := RGBColor[0,1-f,1];
HelpColor[4,f_] := RGBColor[f,0,1];    
HelpColor[5,f_] := RGBColor[1,0,1-f];