Worksheet: heatsine.mw
Fourier Sine Series
and a solution to the Heat Equation
This worksheet examines the sine series that arises in a separation of variables
solution for the heat equation :
=
0 < x < L u(0,t)=u(L,t)=0
with initial condition
u(x,0)=F(x)=L/2-abs(x-L/2) 0 < x< L
Least Squares Approximation of The Initial Condition
Let's approximate the initial condition f(x) with the sum of sines that came from separation of variables.
| > |
c:=n->(2/L)*int(F*f(n),x=0..L); |
| > |
seq(c[n]=c(n),n=1..10); |
| > |
g:= M->sum(c(m)*f(m),m=1..M); |
| > |
s:=seq(g(2*M-1),M=1..6); |
Bessel's Inequality and Parseval's Theorem
Let's compute the (norm)^2 of F(x) and the n-term approximation of F
| > |
normF:=int(F^2,x=0..L); evalf(%); |
| > |
normg:=N-> int(g(N)^2,x=0..L); |
| > |
seq(normg(n),n=1..9); evalf(%); |
Heat Equation Revisited
We can now reconstitute our solution to the heat equation, with the initial condition we derived.
| > |
u:=M->sum(c(m)*sin(m*Pi*x/L)*exp(-(m*Pi/L)^2*t),m=1..M); |
| > |
plot3d(u6,x=0..L,t=0..0.5,style=patchcontour,shading=zhue,axes=boxed); |
| > |
animate(u6,x=0..L,t=0..0.5,frames=50); |