(* *) (* Numerical Mathematics and Computing, Fifth Edition *) (* Ward Cheney & David Kincaid *) (* Brooks/Cole Publ. Co. *) (* (c) 2003 *) (* No warranties implied or expressed. *) (* File: heat *) (* PDE: solve heat eqn & plot *) soln = NDSolve[ {D[u[x,t],x,x] == D[u[x,t],t], u[0,t] == 0, u[1,t] == 0, u[x,0] == Sin[Pi*x]}, u, {x, 0, 1}, {t, 0, .5}]; Plot3D[Evaluate[u[x,t] /. First[soln]], {x, 0, 1}, {t, 0, .5}, PlotPoints->30,PlotRange->All] ContourPlot[Evaluate[u[x,t] /. First[soln]], {x, 0, 1}, {t, 0, .5}, PlotPoints->30,Contours->30,ContourLines->False,ColorFunction->Hue, PlotRange->All]