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