Partial Differential Equations PowerTool
by Dr. Jim Herod
Section 5.3: D'Alembert's Solution on Intervals
Maple Packages for Section 5.3
| > | restart: |
| > | with(plots): |
Warning, the name changecoords has been redefined
The remaining part of this portion of Section 5.3 recreates the methods to make extensions. Details for these techniques are discussed in
Section 2.2: Extensions
. Recall that the function
HS
defined below is very closely related to what is called the Heaviside function. It has the value 1 for
x
> 0, the value 0 for
x
0. The difference from the the Heaviside is structural and conceptual. We discussed this difference in more detail in
Section 2.2: Extensions
in the portion titled
Unassisted Maple
| > | HS:=x->(1+signum(x))/2; |
| > | HS(1); HS(0); HS(-1); |
The next two lines have as input x and a function defined for x > 0. They produce an even function or an odd function.
| > | evnf:=(f,x)->HS(x)*f(x)+HS(-x)*f(-x); |
| > | oddf:=(f,x)->HS(x)*f(x)-HS(-x)*f(-x); |
We will also need to extend functions from intervals of the form [- L , L ] to the entire real line. Recall that we have also referred to a procedure for doing this in Section 2.2: Extensions .
| > | PeriodicExtender:=proc(f,d::range) subs( {'F' = f, 'L'=lhs(d), 'D'=rhs(d)-lhs(d)}, proc(x::algebraic) local y; y:=floor((x-L)/D); F(x-y*D); end) end proc: |
| > |
In Section 5.2, we derived d'Alembert's solution for the wave equation on the entire real line. We will now get the solution for the wave equation on finite intervals. One way to think about the process is this: suppose that the initial functions are given on a finite interval. Extend these functions appropriately to functions on the entire real line and then use the techniques of the previous section.. We make these extensions in this Section.
Hereafter we acknowledge from Section 5.2 that d'Alembert's solution has the form
u(t, x) =
+
.
We have not used any information about boundary conditions to arrive at this result. We only used information about the initial conditions. We review the situation with the assumption that
u
(0,
x
) =
f
(
x
) and
(0, x) =
g
(
x
).
A general solution for the wave equation
We use the ideas of the previous Section 5.2 to construct a general solution for the wave equation. If necessary, review that section. The definition of u depends on f , g , t , x , and c . These are all the items used to make the u .
| > | u:=(f,g,t,x,c)->(f(x+c*t)+f(x-c*t))/2 +int(g(s),s=x-c*t..x+c*t)/(2*c); |
To illustrate this general solution, we take a particular example. We will take c = 1.
| > | f:=x->4*sin(Pi*x); g:=x->cos(x); |
Here is an evaluation and animation of this general solution.
| > | u(f,g,t,x,1); |
| > | animate(u(f,g,t,x,1),x=-2..2,t=0..4, frames=30); |
| > |
Half Infinite Strings
The solution just given is for all numbers
x
. It is as though we had a string that was infinite in both directions. That is, this solution holds for
and
.
Our next idea is to suppose that we want to solve the equation on the interval [0,
). This would model a long string tied down at one end. We begin by imposing only one boundary condition. We suppose that
x
> 0. With this assumption, we have a boundary condition at the left end.
Boundary Condition: u ( t , 0) = 0.
Initial Conditions:
u
(0,
x
) =
f
(
x
) and
(0,
x
) =
g
(
x
) for
x
> 0.
With no initial conditions or boundary conditions, we have concluded that
u
(
t
,
x
) =
+
as t increases. With initial conditions, as in Section 5.2 and the above, we got that
u
(
t
,
x
) =
+
where G is an antiderivative of g .
As we have said, we are supposing that
x
> 0. The solution is not defined for negative
x
. However, we must do an extension of
because, as
t
increases, the number
c t
will exceed
x
and we will need the definition of
for the negative number
x
-
c t
. While
x
is positive,
x
-
c t
may be negative. Happily, there is information available through the boundary conditions which compels how the extension should be made.
The first boundary condition is
0 = u(
t
, 0) =
(
c t
) +
(-
c t
) =
+
.
Thus,
0 = f ( c t ) + f ( - c t ) + G( c t ) - G( - c t ).
Since this holds for all f and for all g , then it must be that
f ( c t ) = - f ( - c t ) and G( c t ) = G( - c t ) for all t > 0.
Thus, f should have an odd extension and G should have an even extension.
Making even and odd extensions
It's clear that in order to illustrate these ideas, we are going to need to be able to make even and odd extensions for functions. There is a procedure for doing this introduced in
Section 2.2 Extensions
and recalled at the beginning of this Section. We illustrate this extension here. We define
f
and g on the interval [0,
). Then we construct G. Finally we draw graphs of
f
and G, and we draw graphs of the odd extension of f and the even extension of G.
| > | f:=x-> (signum(x-2)-signum(x-3))*(x-3)*(x-2); plot(f(x),x=-6..6); |
| > | g:=x->(signum(x-2)-signum(x-3)); G:=x->int(g(s),s=0..x); plot([x,G(x),x=0..6],x=-6..6); |
Having executed the top lines contained in Maple Packages for Section 5.3 we draw the extensions.
| > | plot(oddf(f,x),x=-6..6); |
| > | plot(evnf(G,x),x=-6..6); |
| > |
Having reviewed this part we proceed with the development.
Comparing Infinite Interval and Half-Infinite Interval Problems.
It is wise to contrast this "half" infinite string with the infinite string of the previous module. Let's do one example twice: first we let x range over all numbers and use just the original d'Alembert solution, and then we let x only be positive and use the odd extension of f .
Example for Comparison: No Boundary Conditions, Infinite Interval
Here's f and g.
| > | f:=x->-(HS(2*Pi-x)-HS(Pi-x))*sin(x); g:=x->0; |
| > | plot(f(x),x=0..10); |
Now, we solve the PDE with initial conditions and no boundary conditions. We use the d'Alembert solution, and take c = 1. The function G will be zero.
| > | u:=(t,x)->(f(x+t)+f(x-t))/2; |
| > | plot3d(u(t,x),x=-10..10,t=0..5,orientation=[-105,50],axes=normal, grid=[50,50]); |
What we expect to see is that the wave splits apart and moves off in both directions.
| > | animate(u(t,x),x=-10..20,t=0..15, frames=40, numpoints=200); |
| > |
Example for Comparison: One Boundary Condition, Half Infinite Interval
Next, we solve the PDE with initial conditions and boundary condition u( t , 0) = 0, same f and G.
| > | u:=(t,x)->(oddf(f,x+t)+oddf(f,x-t))/2; |
| > | plot3d(u(t,x),x=0..4*Pi,t=0..10,orientation=[-35,45], axes=normal, grid=[50,50]); |
In this example, where the boundary is held at zero at the left end, we expect the wave to bounce off the left side.
| > | animate(u(t,x),x=0..4*Pi,t=0..10,numpoints=75,color=RED, frames=40); |
Pretty nice!
The problem gets more complicated if both ends of the string are fixed. This is the next stage of development.
| > |
| > |
Finite Strings
If we have a finite string, we have an end point at x = 0 and at x = L . We have used information at x = 0. We have never used the other end point. At that end point, we can get in a similar manner that
0 = u (t, L ) = f ( L + c t ) + f ( L - c t ) + G( L + c t ) - G( L - c t ),
and
f ( L + c t ) = - f ( L - c t ) and G( L + c t ) = G( L - c t ) for all t > 0.
The oddness of f and evenness of G changes these to
f ( L + c t ) = f (- L + c t ) and G( L + c t ) = G( - L + c t ) for all t > 0.
That is, f and G have period 2 L . Now we know how to make the extensions of f and of G so we can define u .
We work a first easy example. Then, we will do a series of more interesting ones.
Take
c
= 1 here. For the first example,
and
g
(
x
) = 0. Let us choose
f
(
x
) = sin(
x
) on the interval [ 0,
]. This function is already odd and has period 2
.
We have found how to construct a general solution for the wave equation on the interval [0, L].
| > | f:=x->sin(x); g:=x->0; L:=Pi; c:=1; |
| > | u:=(t,x)->(f(x+c*t)+f(x-c*t))/2; |
Check the boundary conditions and initial conditions.
| > | u(t,0); u(t,L); u(0,x); simplify(subs(t=0,diff(u(t,x),t))); |
We expect that this string should be fixed as zero at both ends and vibrate back and forth in between.
| > | animate(u(t,x),x=0..2*Pi,t=0..2*Pi,color=RED); |
| > | plot3d(u(t,x),x=0..L,t=0..2*Pi,axes=NORMAL,orientation=[-155,65]); |
| > |
Even periodic extensions and odd periodic extensions
As we showed just above, in order to be able to graph solutions for the finite string, we need to be able to make a different extensions of functions other than simply even extensions or odd extensions. We need to make odd, 2 L periodic extensions and to make even, 2 L periodic extensions of functions defined on the interval [0, L ]. Here are examples where we do this. To illustrate, we define a function f on the interval [0,1]. In this case, L = 1.
| > | L:=1; f:=x->x*(1-x); |
Next, we make an odd, 2 L extension and draw the graph to verify that the extension looks correct.
| > | odf:=x->oddf(f,x); plot(odf(x),x=-L..L); |
Here is where we make extension of the function to all numbers and draw the graph to verify that the extension looks correct.
| > | opf:=PeriodicExtender(odf,-L..L): plot(opf(x),x=-2*L..2*L); |
| > |
This was the odd, 2 L periodic extension of the specified function f. We now do a similar process, only we create the even, 2 L periodic function.
First we make the extension of a function defined on the interval [0, L ] to a function on the interval [- L , L ] aware that the goal is to get an even extension. We also draw a graph to assist our intuition.
| > | evf:=x->evnf(f,x); plot(evf(x),x=-L..L); |
Here is where we make extension of the function to all numbers and draw the graph to verify that the extension looks correct.
| > | epf:=PeriodicExtender(evf,-L..L): plot(epf(x),x=-2*L..2*L); |
| > |
It seems we are ready to make solutions for the wave equation on a finite interval and with zero boundary conditions.
| > |
Illustrations
Examples:
Take c = 1 and L, f, and g are specified:
1. L = 2, f(x) = sin(
x), g(x) = 0.
2. L = 2, f(x) = 0, g(x) = sin(
x).
3. L =
, f(x) =
/2 - |x-
/2|, g(x) = 0.
Here is Example 1.
We define L and f.
| > | L:=2; f:=x->sin(Pi*x); |
We make the odd extension on the interval [- L , L ].
| > | odf:=x->oddf(f,x); |
We extend this odd function so that it is 2 L periodic.
| > | opf:=PeriodicExtender(odf,-L..L): |
We draw the graph of this extension to check that it is odd and 2 L periodic.
| > | plot(opf(x),x=-2*L..2*L); |
We define the solution u .
| > | u1:=(t,x)->(opf(x+t)+opf(x-t))/2; |
We draw a graph of u and make an animation to see that the solution meets with our expectations.
| > | plot3d(u1(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-135,45]); |
| > | animate(u1(t,x),x=0..L,t=0..L); |
| > |
Here is example 2.
We define L and g.
| > | L:=2; g:=x->sin(Pi*x); |
We make G from the function g.
| > | int(g(x),x); G:=unapply(%,x); |
We make the even extension of G.
| > | evG:=x->evnf(G,x); |
We make the 2 L periodic extension of this even function and draw the graph.
| > | epG:=PeriodicExtender(evG,-L..L): |
| > | plot(epG(x),x=-2*L..2*L); |
We define the solution u .
| > | u2:=(t,x)->(epG(x+t)-epG(x-t))/2; |
We draw a graph of u and make an animation to see that the solution meets with our expectations.
| > | plot3d(u2(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-135,45]); |
| > | animate(u2(t,x),x=0..L,t=0..L); |
| > |
Here is example 3.
| > | L:=Pi; f:=x->Pi/2-abs(x-Pi/2); |
| > | plot(oddf(f,x),x=-L..L); |
| > | odf:=x->oddf(f,x); |
| > | opf:=PeriodicExtender(odf,-L..L): |
| > | plot(opf(x),x=-2*L..2*L); |
| > | u3:=(t,x)->(opf(x+t)+opf(x-t))/2; |
| > | plot3d(u3(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-135,45]); |
| > | animate(u3(t,x),x=0..L,t=0..2*L); |
Here is example 4.
| > | L:=4; f:=x->(x-1)*(HS(x-1)-HS(x-2)) + (3-x)*(HS(x-2)-HS(x-3)); |
| > | odf:=x->oddf(f,x); |
| > | plot(odf(x),x=-L..L); |
| > | opf:=PeriodicExtender(odf,-L..L): |
| > | plot(opf(x),x=-2*L..2*L); |
| > | u4:=(t,x)->(opf(t+x)+opf(x-t))/2; |
| > | plot3d(u4(t,x),x=0..L,t=0..2*L,axes=NORMAL,orientation=[-35,60], grid=[50,50]); |
| > | animate(u4(t,x),x=0..L,t=0..4*L, frames = 80); |
| > |
Structure of Solutions
Before we leave these examples too far behind, they call our attention to at least four properties of the wave equation that are central.
(1) Bumps in the initial distribution will split into two parts each having half the height of the original. One bump moves to the right and one moves to the left.
(2) We are willing to talk about functions being solutions to the wave equation that are not even differentiable once, much less twice. This luxury is seen as a result of having d'Alembert's formulation of solutions. Such an extension of the idea of solution can be made precise with the concept of weak solutions . We will not pursue this idea further here.
(3) Choose points
out in the plane and ask what points of the extended
f
and
g
influence the behavior of the solution at this chosen point. We see that u(
) involves the values of
f
at
and
and involves the values of
g
over the interval [
,
]. This interval, then, is the
domain of dependence
for
. If we change the initial conditions outside this interval and leave it the same inside, the change will not influence the value of
u
at this point.
(4) If
f
and
g
are zero outside some interval [
a
,
b
], then u will be zero for
and for
. Thus, information travels no faster than speed
c
to the left or to the right.
In this Section, we have defined and illustrated solutions for the simple wave equation on half infinite intervals, and on finite intervals. In the next Section, we make the wave equation more complicated by supposing that the vibration happens in a viscous medium.
Unassisted Maple
We did not check a single one of the u 's generated in the Illustrations. Think what a mess it would be for a human to compute derivatives of these. Here is the first example. Stand back!
| > | u1(t,x); |
Who wants to take one derivative of u ? Or, two with respect to t and then two with respect to x ? Maple will do this completely unemotionally and unassisted. It may be hard to see what is obtained is zero, so graph the difference in the derivatives and see how close it it to zero.
| > | simplify(diff(u1(t,x),t,t)-diff(u1(t,x),x,x)): plot3d(%,x=0..2,t=0..2,axes=normal,orientation=[-30,75]); |
We repeat this with the other three solutions.
| > | simplify(diff(u2(t,x),t,t)-diff(u2(t,x),x,x)); plot3d(%,x=0..2,t=0..2,axes=normal,orientation=[-30,75]); |
| > | simplify(diff(u3(t,x),t,t)-diff(u3(t,x),x,x)): plot3d(%,x=0..2,t=0..2,axes=normal,orientation=[-30,75]); |
| > | simplify(diff(u4(t,x),t,t)-diff(u4(t,x),x,x)): plot3d(%,x=0..2,t=0..2,axes=normal,orientation=[-30,75]); |
Maple's Solution for the Wave Equation
The d'Alembert solution for the one dimensional wave equation is so simple in structure, it would be a surprise if the solution was not built into Maple. We illustrate how to use this built in solution with the following problem.
PDE:
=
,
Boundary conditions: u(t,0) = 0 = u(t,1).
Initial conditions: u(0,x) = 4 x (1 - x),
(0,x) = 0.
The solution is obtained by using the partial differential equation tools package. We need to read in this package at this stage.
| > | with(PDEtools): u:='u': |
We read in the pde that Maple will solve.
| > | pdeM:=diff(u(t,x),t,t)-c^2*diff(u(t,x),x,x); |
We now require that Maple should solve this equation and call the solution wav .
| > | wav:=pdsolve(pdeM,u(t,x)); |
Recall from the discussion in this section that, because this is a finite "string", we must make an odd extension of u(0,x) with period 2. The other initial condition is zero, so that we need no other extensions for this problem.
WARNING : the procedure Periodic Extender is needed in what follows and can be found at the beginning of this Section.
| > | f:=x->4*x*(1-x); |
We now make the odd, periodic extension of f. First, here is the odd extension.
| > | F:=unapply(oddf(f,x),x); |
As a check, the first two of these should be equal and the next two should be the negative of each other.
| > | f(1/2),F(1/2); f(1/2),F(-1/2); |
Next, we extend F with period 2.
| > | Fext:=PeriodicExtender(F,-1..1): |
As a check, we graph Fext on the interval [-2, 2]. We should find an odd function with period 2.
| > | plot(Fext(x),x=-2..2); |
We put this odd, period 2 function into the solution for the wave equation Maple provided above.
| > | eval(wav,{c=1,_F1=Fext/2,_F2=Fext/2}): |
This will define the solution.
| > | u:=unapply(rhs(%),(t,x)): |
We draw the graph.
| > | plot3d(u(t,x),x=0..1,t=0..1,axes=normal); |
And we provide an animation for the solution.
| > | animate(u(t,x),x=0..1,t=0..4, frames=30); |
| > |
| > |
It is hoped that the explanation in this Section 5.3 for how to construct a solution for this simple wave equation makes this built in solution understandable and appreciated.
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