Studying the heat equation with MapleExecute the worksheet and play! To manipulate a plot or an animation, click on the output and your options will appear in the menu bar.restart:with(plots): #to plot and animatetent:=t->(1-Heaviside(t-Pi/2))*t +Heaviside(t-Pi/2)*(Pi-t):plot(tent(t),t=0..Pi,color=black);sineseries:=proc(ff,L,b) #ff=function, L=half period
local m, #dummy letter to index coefficients
s; #domain variable
assume(m,integer):
b:=m->simplify(2/L*int(ff(s)*sin(Pi/L*m*s),s=0..L)):
end:sineseries(tent,Pi,B): #to solve the zero temperature
#at endpoints problem we use sine seriesB(n);u1:=(x,t)->sum(B(n)*sin(n*x)*exp(-n^2*t),n=1..10);
#we take the diffusivity constant k to equal 1plot3d(u1(x,t),x=0..Pi,t=0..3,axes=boxed,title=`boundary temp=0`);Make a movie!animate(u1(x,t), x=0..Pi, t=0..3,frames=100);
#syntax may have changed between Maple 8 and
#later versions, check in help windows for
#animatecosseries:=proc(ff,L,a) #ff=function, L=half period
local m, #dummy letter to index coefficients
s; #domain variable
assume(m,integer):
a:=m->simplify(2/L*int(ff(s)*cos(Pi/L*m*s),s=0..L)):
end:cosseries(tent,Pi,A): #for insulated endsA(0);
A(n);u2:=(x,t)->Pi/4+sum(A(n)*cos(n*x)*exp(-n^2*t),n=1..10);plot3d(u2(x,t),x=0..Pi,t=0..3,axes=boxed,title=`zero flux boundary
conditions`);Make a movie!animate(u2(x,t), x=0..Pi, t=0..3,frames=100);