19Wave.mws

Partial Differential Equations PowerTool

by Dr. Jim Herod

Section 5.1: The One Dimensional Wave Equation

Maple Packages for Section 5.1

>    restart;

>    with(plots):

Warning, the name changecoords has been redefined

>    with(PDEtools):

>   

We now begin a study of the classical wave equation.

     The classical, linearized wave equation is

                                        diff(u(t,x),`$`(t,2)) = c^2*diff(u(t,x),`$`(x,2)) .

     We classify this PDE as a special case of the more general constant coefficient, second order equation:

          a*diff(u(t,x),`$`(t,2))+b*diff(u(t,x),t,x)+c*diff(u(t,x),`$`(x,2))+d*diff(u(t,x),t)+e*diff(u(t,x),x)+f*u(t,x)  = 0.

Second order  refers to the lack of derivatives of more than second order.We will solve the wave equation by the method of separation of variables in this worksheet. We will find there are alternate methods for this equation. We will also see that slightly more complicated situations lead to the more general second order equation.

     We have seen that the standard separation of variables methods work well for the heat equation. This method is often good for linear equations. The method takes advantage of the superposition property . That is, if two functions u[1]  and u[2]  are solutions to a linear PDE, then so is any linear combination:

                          alpha*u[1]+beta*u[2] .

As with the heat equation, the wave equation commonly comes with boundary conditions and initial conditions. At the start, we take homogeneous boundary conditions, assuming that x  ranges between 0 and L .

Boundary Conditions:   u ( t , 0) = 0, and u ( t , L ) = 0.

Because the equation is second order in t , we expect two initial conditions.  (Contrast this with the heat equation, which is first order in t  and so needed only one initial condition.)

Initial Conditions:   u (0, x ) = f ( x ) and diff(u,t) (0, x ) = g ( x ) for x  in [0, L ].

The usual physical realization made for this model is that of a string, held fixed at two ends, displaced by an amount f ( x ) initially, and given an initial velocity g ( x ). This model will guide our intuition and, with small displacements, gives an accurate impression for the vibrations of a taut string.

     We often set c  = 1 for convenience. We do this in this worksheet but remove the restriction later. It is of value to consider the difference in the left and right side of the wave equation. That difference reminds us that we are solving linear operator equations and looking for the null space of these linear operators. This example is simply a linear equation which has an infinite number of solutions. We seek one which satisfies the boundary and initial conditions.

     

    We have had experience with the method of separation of variables and know that this method for solving partial differential equations is precisely what it says: One assumes that solutions can be written as products of separate functions of t  and x . Thus, we make the assumption  that u ( t , x ) is of the special form

               T( t ) X( x ),

known as a product solution.

>    u:=(t,x)->T(t)*X(x);

u := proc (t, x) options operator, arrow; T(t)*X(x) end proc

>    eq:=diff(u(t,x),t,t)-diff(u(t,x),x,x);

eq := diff(T(t),`$`(t,2))*X(x)-T(t)*diff(X(x),`$`(x,2))

     This simplifies if we divide through by T( t ) X( x ).

>    eq/X(x)/T(t);
expand(%);

(diff(T(t),`$`(t,2))*X(x)-T(t)*diff(X(x),`$`(x,2)))/X(x)/T(t)

1/T(t)*diff(T(t),`$`(t,2))-1/X(x)*diff(X(x),`$`(x,2))

>    sep:=(%)+diff(X(x),x,x)/X(x)=diff(X(x),x,x)/X(x);

sep := 1/T(t)*diff(T(t),`$`(t,2)) = 1/X(x)*diff(X(x),`$`(x,2))

     The left side of the equation sep  depends only on t  and the right side depends only on x . Thus, each side must be constant. We do not know the value of this constant, yet. As in the heat equation, it will be negative; we call it - mu^2 .

>    dsolve(diff(X(x),x,x)=-mu^2*X(x),X(x));

X(x) = _C1*sin(mu*x)+_C2*cos(mu*x)

In order to satisfy the boundary condition at x  = 0, we must have

>    X:=x->sin(mu*x);

X := proc (x) options operator, arrow; sin(mu*x) end proc

>    solve(X(L)=0,L);

0

There are an infinite number of solutions for this equation, they change with L  and mu . Maple did not pick out any solution except L  = 0. We know, however where the sine function is zero: the sine function is zero at all integral multiples of pi  . Thus, take mu*L = n*Pi  and solve for mu .

>    solve(mu*L=n*Pi,mu);

n*Pi/L

>    mu:=%;

mu := n*Pi/L

     We now have the function X( x ).

>    X(x);

sin(n*Pi/L*x)

Check that X'/X is -mu^2 .

>    diff(X(x),x,x)/X(x);

-n^2*Pi^2/L^2

     We now look at the other part of the PDE which we "separated off".

>    dsolve(diff(T(t),t,t)=-mu^2*T(t),T(t));

T(t) = _C1*sin(n*Pi/L*t)+_C2*cos(n*Pi/L*t)

     Both the sine and cosine functions give possible solutions. We have no reason to eliminate either of these. The general solution we find is a linear combination of the particular solutions we get by separating the equation.

     The most general linear combination is of the form.

>    u:=(t,x)->sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),
                   n=1..infinity);

u := proc (t, x) options operator, arrow; sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),n = 1 .. infinity) end proc

     The coefficients A and B have to be determined from the initial conditions in a manner that is familiar. We use the initial conditions. Suppose that u(0,x) = f(x)  and u[t](0,x) = g(x) .

>    u(0,x)=f(x);
D[1](u)(0,x)=g(x);

sum(A[n]*sin(n*Pi/L*x),n = 1 .. infinity) = f(x)

sum(B[n]*n*Pi/L*sin(n*Pi/L*x),n = 1 .. infinity) = g(x)

>   

Doesn't this look like a job for Fourier Series? To compute the coefficients, recall that we have

                          A[n]  = int(f(x)*sin(n*Pi*x/L),x = 0 .. L)/int(sin(n*Pi*x/L)^2,x = 0 .. L)

and

                         B[n]*n*Pi/L  = int(g(x)*sin(n*Pi*x/L),x = 0 .. L)/int(sin(n*Pi*x/L)^2,x = 0 .. L)  =   2/L   int(g(x)*sin(n*Pi*x/L),x = 0 .. L)  , or

                        B[n]  = 2/(n*Pi)   int(g(x)*sin(n*Pi*x/L),x = 0 .. L)   .

Here is an example. We can animate the graph of the solution and expect to see the vibrations of the string. The following two examples may give considerable insight for how the wave equation models the motion of a string. In the first example, take f  as below and g  to be zero. This will mean that all the B coefficients will be zero and A coefficients will be determined by the Fourier quotient.

       

>    L:=4;
f:=x->(x-1)*(Heaviside(x-1)-Heaviside(x-2))+
       (3-x)*(Heaviside(x-2)-Heaviside(x-3));

L := 4

f := proc (x) options operator, arrow; (x-1)*(Heaviside(x-1)-Heaviside(x-2))+(3-x)*(Heaviside(x-2)-Heaviside(x-3)) end proc

We sketch the graph of this function f .

>    plot(f(x),x=0..L);

[Maple Plot]

We compute the Fourier coefficients.  Since g(x) = 0 , the B coefficients are also zero..

>    for n from 1 to 5 do
     A[n]:=int(f(x)*sin(n*Pi*x/L),x=0..L)/
              int(sin(n*Pi*x/L)^2,x=0..L);
     B[n]:=0:
od;
n:='n':

A[1] := (-16*2^(1/2)+32)/Pi^2+1/2*(16-8*2^(1/2))/Pi^2+1/2*(-16+8*2^(1/2))/Pi^2+1/2*(16*2^(1/2)-32)/Pi^2

B[1] := 0

A[2] := 1/2*(-4+2*Pi)/Pi^2+1/2*(4-2*Pi)/Pi^2

B[2] := 0

A[3] := 1/9*(-16*2^(1/2)-32)/Pi^2+1/18*(-16-8*2^(1/2))/Pi^2+1/18*(16+8*2^(1/2))/Pi^2+1/18*(32+16*2^(1/2))/Pi^2

B[3] := 0

A[4] := 0

B[4] := 0

A[5] := 1/25*(32+16*2^(1/2))/Pi^2+1/50*(16+8*2^(1/2))/Pi^2+1/50*(-16-8*2^(1/2))/Pi^2+1/50*(-16*2^(1/2)-32)/Pi^2

B[5] := 0

We define the solution u .

>    u:=(t,x)->sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),
                   n=1..5);

u := proc (t, x) options operator, arrow; sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),n = 1 .. 5) end proc

Check that this is a solution

>    diff(u(t,x),t,t)-diff(u(t,x),x,x);

0

Here are the boundary conditions.

>    u(t,0); u(t,L);

0

0

We see how close u (0, x ) is to f ( x ).

>    plot([u(0,x),f(x)],x=0..L);

[Maple Plot]

We check the other initial condition.

>    D[1](u)(0,x);

0

>   

Now, we draw the graph of u  and then we watch an animation. We should expect to see the motion of a vibrating string.

>    plot3d(u(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-45,70]);

[Maple Plot]

>    animate(u(t,x),x=0..L,t=0..2*L, frames=30);

[Maple Plot]

>   

In the second example, take f to be zero and g to be as below. The formula for f and g suggests that the string is at rest and we give the middle an initial velocity.  This will mean that all the B coefficients will be zero and A coefficients will be determined by the Fourier quotient.

>    L:=4;
g:=x->-(Heaviside(x-1)-Heaviside(x-3));

L := 4

g := proc (x) options operator, arrow; -Heaviside(x-1)+Heaviside(x-3) end proc

>    plot(g(x),x=0..L,discont=true,color=RED);

[Maple Plot]

>    n:='n':
for n from 1 to 5 do
     A[n]:=0:
     B[n]:=2/(n*Pi)*int(g(x)*sin(n*Pi*x/L),x=0..L);
od;
n:='n':

A[1] := 0

B[1] := -8/Pi^2*2^(1/2)

A[2] := 0

B[2] := 0

A[3] := 0

B[3] := 8/9/Pi^2*2^(1/2)

A[4] := 0

B[4] := 0

A[5] := 0

B[5] := 8/25/Pi^2*2^(1/2)

>    u:=(t,x)->sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),
                   n=1..5);

u := proc (t, x) options operator, arrow; sum((A[n]*cos(Pi*n*t/L)+B[n]*sin(Pi*n*t/L))*sin(n*Pi*x/L),n = 1 .. 5) end proc

>    plot3d(u(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-135,45]);

[Maple Plot]

>    animate(u(t,x),x=0..L,t=0..2*L, frames=30);

[Maple Plot]

>   

Unassisted Maple

Again, it is of interest to see what progress Maple can make with this problem unassisted by humans. Note that we have read in the PDE package.

We define the partial differential equation.

>    PDE:=diff(v(t,x),t,t)-diff(v(t,x),x,x)=0;

PDE := diff(v(t,x),`$`(t,2))-diff(v(t,x),`$`(x,2)) = 0

Look to see what form Maple gets for a solutions.

>    ans := pdsolve(PDE);

ans := v(t,x) = _F1(x+t)+_F2(x-t)

Maple suggests that solutions have a particular form. There are no Fourier coefficients, no integrals to compute. The answer seems compact.

No surprise. This solution for the one dimensional wave equation is classical. It is called the d'Alembert solution. It is the subject of the next section.

EMAIL: herod@math.gatech.edu   or   jherod@tds.net

URL: http://www.math.gatech.edu/~herod

Copyright ©  2003  by James V. Herod

All rights reserved