Worksheet: d'Alembert.mw
d'Alembert Solution and Fourier Sine Series Solutions to the Wave Equation
This worksheet examines the sine series that arises in a separation of variables
solution for the wave 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
(x,0)=G(x)=0 0 < x< L
 |
 |
(1) |
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.
 |
(1.1) |
 |
(1.2) |
| > |
a:=n->(2/L)*int(F(x)*f(n),x=0..L); |
 |
(1.3) |
| > |
seq(a[n]=a(n),n=1..10); |
![a[1] = `+`(`/`(`*`(4), `*`(`^`(Pi, 2)))), a[2] = 0, a[3] = `+`(`-`(`/`(`*`(`/`(4, 9)), `*`(`^`(Pi, 2))))), a[4] = 0, a[5] = `+`(`/`(`*`(`/`(4, 25)), `*`(`^`(Pi, 2)))), a[6] = 0, a[7] = `+`(`-`(`/`(`*`...](dAlembert_images/dAlembert_11.gif) |
(1.4) |
| > |
g:= M->sum(a(m)*f(m),m=1..M); |
 |
(1.5) |
 |
(1.6) |
| > |
s:=seq(g(2*M-1),M=1..6); |
Wave Equation via Fourier Sine Series
We can now reconstitute our solution to the heat equation, with the initial condition we derived.
| > |
u:=M->sum(a(m)*sin(m*Pi*x/L)*cos(c*m*Pi*t/L),m=1..M); |
 |
(2.1) |

 |
(2.2) |
| > |
plot3d(up,x=0..L,t=0..2.0,style=patchcontour,shading=zhue,axes=boxed); |
| > |
animate(up,x=0..L,t=0..2*L,frames=51); |
d'Alembert Solution
We can construct a d'Alembert solution for the same initial condition by constructing the odd
periodic extension of the initial condition F(x)
| > |
p:=x->x-2*L*floor((x-L)/(2*L))-2*L; |
 |
(3.1) |
| > |
plot(p(x),x=-3*L..3*L); |
| > |
F1:=x->signum(x)*F(abs(x)); |
 |
(3.2) |
 |
(3.3) |
| > |
plot(F2(x),x=-3*L..3*L); |
| > |
U:=(F2(x-c*t)+F2(x+c*t))/2: |
| > |
plot3d(U,x=0..L,t=0..2.0,style=patchcontour,shading=zhue,axes=boxed); |
| > |
animate(U,x=0..L,t=0..2*L,frames=51); |
| > |
animate({U,-up},x=0..L,t=0..2*L,frames=51,thickness=3); |