Worksheet: Neumann.mw
Fourier Cosine Series Solution:
Neumann Problem for the Heat Equation
This worksheet examines the Fourier cosine series that arises in a separation of variables solution for the Neumann problem for the heat equation:
=
0 < x < L
(0,t)=
(L,t)=0
with initial condition
u(x,0)=F(x)=1 0 < x< L/2
0 L/2 < x < L
Fourier Cosine Series for the Initial Condition
Let's approximate the initial condition f(x) with the sum of sines that came from separation of variables.
| > |
F:=piecewise(x<L/2,1,x=L/2,1/2,L/2<x,0); |
| > |
plot(F, x=0..L,thickness=2); |
| > |
c0:=(2/L)*int(F,x=0..L); |
| > |
c:=n->(2/L)*int(F*f(n),x=0..L); |
| > |
seq(c[n]=c(n),n=1..10); |
| > |
g:=M->c0*f0+sum(c(m)*f(m),m=1..M); |
| > |
plot({F,h},x=0..L,thickness=2); |
| > |
s:=seq(g(2*M-1),M=1..9); |
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->c0*f0+ sum(c(m)*f(m)*exp(-(m*Pi/L)^2*t),m=1..M); |
| > |
plot3d(u15,x=0..L,t=0..0.5,style=patchcontour,shading=zhue,axes=boxed); |
| > |
animate(u15,x=0..L,t=0..0.5,frames=50); |