Heat Equation

Solution by Separation of Variables

Rod of length L initially at 100°; ends put in contact with ice bath for  t ≥ 0. To allow numerical evaluation, take L=1, c=1.

Verify Fourier Series for initial temperature distribution.

c=1; L=1;

b[m_] := 400/((2m-1)*Pi)

eigen[m_] := Sin[(2m-1)*Pi*x/L]

Sum[b[m]*eigen[m], {m,1,9}]

Plot[%, {x,-1,2}]

Include exponential decay for each term to obtain temperature evolution.

λ[m_] := (2m-1)*Pi*c/L

decay[m_] := Exp[-(((λ[m]))^2)*t]

partSum = Sum[b[m]*eigen[m]*decay[m], {m,1,9}]

Table[ Plot[N[partSum] /. t-> u, {x,0, 1}, PlotRange -> {0,110}], {u,0,0.025, .005}]

Partition[%,2]

Plot3D[N[partSum], {x,0, 1}, {t,0,0.25}, PlotRange -> {0,100}, AxesLabel -> {"X", "Time", "Temp"}, ViewPoint->{2.216, -1.730, 1.070}]

ContourPlot[N[partSum], {x,0, 1}, {t,0,0.25}]