Boundary Value Problems

bvp.mws

Douglas B. Meade (meade@math.sc.edu)

1 Introduction

Boundary value problems (BVPs) are commonly encountered in applications of differential equations. For example, the temperature in a bar which has its ends held at fixed temperatures. A BVP is a differential equation with values of the solution specified at (two or more) different points. These points are often the endpoints of the interval on which the solution is needed. Thus, the asymptotic behavior of solutions for large values of the independent variable is not of primary interest. The questions of existence and uniqueness of solutions are more interesting for BVPs.

2 Objectives

• to be exposed to BVPs as an alternative to IVPs

• to experience the different existence and uniqueness properties that can be found in BVPs

• to learn techniques for the use of Maple in the solution of BVPs

3 New Maple Commands

• unapply converts an expression into a function

4 Problem 30 (Section 4.2, p. 159)

   > restart;

Boundary Value Problems. When the values of a solution to a differential equation are specified at two different points, these conditions are called boundary conditions. (In contrast, initial conditions specify the values of a function and its derivative at the same point.)

In this problem we will consider the second-order differential equation

   > ODE := diff( y(x), x$2 ) + y(x) = 0;

ODE := (\frac{∂^{2}}{∂x^{2}} y(x)) + y(x) = 0

which has the general solution

   > GSOLN := dsolve( ODE, y(x) );

GSOLN := y(x) = C1 cos(x) + C2 sin(x)

Show that

4.1 (a)

there is a unique solution to the ODE that satisfies the boundary conditions y(0) = 2 and y(\frac{π}{2} ) = 0;

4.1.1 Solution

There are two different ways in which Maple can be used to solve this problem. The first, and simplest, is to use dsolve with the boundary conditions replacing the initial conditions. For example

   > BCa := y(0) = 2, y(Pi/2)=0;

BCa := y(0) = 2, y(\frac{1}{2} π) = 0

   > SOLNa := dsolve( { ODE, BCa }, y(x) );

SOLNa := y(x) = 2 cos(x)

But, how do we know that this is the only solution to the problem?

To definitively answer this question, it is necessary to work directly in terms of basic principles. All solutions to the differential equation must be in the form of the general solution. Showing that there is a unique solution to the BVP means that there are unique values of the constants C1 and C2 that force the general solution to satisfy the boundary conditions. To see how the boundary conditions place restrictions on the constants, it will be most convenient to have the general solution in the form of a Maple function (not as an equation or expression). The unapply command will do the necessary conversion:

   > Y := unapply( rhs(GSOLN), x );

Y := x → C1 cos(x) + C2 sin(x)

Now, substituting this function into the boundary conditions yields

   > CEQN := eval( subs( y=Y, { BCa } ) );

CEQN := { C1 = 2, C2 = 0}

from which it is apparent that there is exactly one set of constants for which the boundary conditions are satisfied. These values of the constants identify the unique solution to the BVP as

   > SOLNa2 := subs( CEQN, GSOLN );

SOLNa2 := y(x) = 2 cos(x)

Note the agreement between this solution and the one returned by dsolve:

   > SOLNa;

y(x) = 2 cos(x)

4.2 (b)

there is no solution to the ODE that satisfies y(0) = 2, y(π) = 0;

4.2.1 Solution

The same two methods can be used to solve this BVP. Because we are interested in the how and why of this example, the dsolve solution will not be displayed. As before, the first step is to substitute the general solution into the boundary conditions. The result is

   > BCb := y(0)=2, y(Pi)=0;

BCb := y(0) = 2, y(π) = 0

   > CEQN := eval( subs( y=Y, { BCb } ) );

CEQN := { C1 = 2, − C1 = 0}

Note that the equations are inconsistent ( C1 cannot be both 0 and 2). Thus, there is no choice of the constants for which the boundary conditions are satisfied and this BVP has no solution.

It is now of interest to learn what dsolve will report as “the solution” to this problem.

   > dsolve( { ODE, BCb }, y(x) );

The fact that Maple returns no solution should not be interpretted to mean that there is no solution to the problem. (Maple sometimes produces no return value when it is unable to complete the requested task.) Thus, the first approach is the one that really shows that there is no solution to this problem.

4.3 (c)

there are infinitely many solutions to the ODE that satisfy y(0) = 2, y(π) = −2.

4.3.1 Solution

The routine should now be familiar. Substitute the general solution into the boundary conditions, then examine the resulting equations for the constants C1 and C2. In this case these yield

   > BCc := y(0)=2, y(Pi)=-2;

BCc := y(0) = 2, y(π) = −2

   > CEQN := eval( subs( y=Y, { BCc } ) );

CEQN := { C1 = 2, − C1 = −2}

These equations specify only one of the constants; C2 is still arbitrary.

   > CSOLN := solve( CEQN, { _C1, _C2 } );

CSOLN := { C1 = 2, C2 = C2 }

For each value of C2 a different solution to the boundary value problem is obtained.

   > SOLNc := subs( CSOLN, GSOLN );

SOLNc := y(x) = 2 cos(x) + C2 sin(x)

The same solutions are obtained using dsolve.

   > SOLNc2 := dsolve( { ODE, BCc }, y(x) );

SOLNc2 := y(x) = 2 cos(x) + C2 sin(x)

In either case, there are an infinite number of solutions to this problem.

These different types of existence results are very common in BVPs. In general, there is no way to look at a boundary value problem and decide how many solutions a BVP will have. (All that can be said is that the number will be either 0, 1, or ∞.)

5 Extension to more general boundary conditions

To conclude this worksheet, let’s consider a slight extension of this problem. The boundary conditions may involve more than the value of the function. Common examples are the value of the derivative of the function and a linear combination of the function and its first derivative at a point. Examples of each of these will be considered at this time.

5.1 Example 1

> restart;

For what values of α does the BVP

> ODE := diff( y(x), x$2 ) - 6*diff( y(x), x ) + 5*y(x) = 1 - 2*x;

ODE := (\frac{∂^{2}}{∂x^{2}} y(x)) − 6 (\frac{∂}{∂x} y(x)) + 5 y(x) = 1 − 2 x

> BC := y(0)=0, D(y)(2)=alpha;

BC := y(0) = 0, D(y)(2) = α

have a unique solution? Plot this solution, and verify that the solution does satisfy the appropriate boundary conditions.

5.1.1 Solution The general solution to this equation is easily found by hand, or with Maple.

> GSOLN := dsolve( ODE, y(x) );

GSOLN := y(x) = −\frac{7}{25} − \frac{2}{5} x + C1 e^{x} + C2 e^{(5 x)}

Preparing for later use, the general solution is converted from an equation to a function.

> Y := unapply( rhs(GSOLN), x );

Y := x → −\frac{7}{25} − \frac{2}{5} x + C1 e^{x} + C2 e^{(5 x)}

Equations that the constants must satisfy are determined by substituting the general solution into the boundary conditions.

> CEQN := eval( subs( y=Y, { BC } ) );

CEQN := \{−\frac{7}{25} + C1 + C2 = 0, −\frac{2}{5} + C1 e^{2} + 5 C2 e^{10} = α\} While these equations are slightly more complicated than those encountered

earlier in this worksheet, there are still two linear equations for the two constants. The solution to this system is

> CSOLN := solve( CEQN, { _C1, _C2 } );

CSOLN := \{ C1 = −\frac{1}{5} \frac{7 e^{10} − 2 − 5 α}{e^{2} − 5 e^{10}}, C2 = \frac{1}{25} \frac{−10 + 7 e^{2} − 25 α}{e^{2} − 5 e^{10}}\}

Note that these solutions are defined for all values of α, and that the solution is unique. Thus, the BVP has a unique solution for all values of α. These solutions are

> SOLN := simplify( subs( CSOLN, GSOLN ) );

SOLN := y(x) = −\frac{1}{25}(−7 e^{2} + 35 e^{10} − 10 x e^{2} + 50 x e^{10} − 35 e^{(x+10)} + 10 e^{x} + 25 e^{x} α

− 10 e^{(5 x)} + 7 e^{(5 x+2)} − 25 e^{(5 x)} α)e^{(−2)}/(−1 + 5 e^{8}) Using dsolve to solve this problem leads to

> SOLN2 := dsolve( { ODE, BC }, y(x) );

SOLN2 := y(x) = −\frac{7}{25}−\frac{2}{5} x−\frac{1}{5} \frac{(7 e^{10} − 2 − 5 α) e^{x}}{e^{2} − 5 e^{10}} +\frac{1}{25} \frac{(−10 + 7 e^{2} − 25 α) e^{(5 x)}}{e^{2} − 5 e^{10}}

The two solutions look rather different, but are equivalent. This is easily verified:

> simplify( rhs(SOLN) - rhs(SOLN2) );

0

To conclude this example, it is most appropriate to plot both the solution and its first derivative on the same axes. Here are the plots for α = 0, α = 3, and α = −1:

> P := array(1..3):
> P[1] := plot( subs( alpha=0, { rhs(SOLN), diff( rhs(SOLN), x
) }), x=0..2,
> title=`y(0)=1, y'(2)=0` ):
> P[2] := plot( subs( alpha=3, { rhs(SOLN), diff( rhs(SOLN), x
) }), x=0..2,
> title=`y(0)=1, y'(2)=3` ):
> P[3] := plot( subs( alpha=-1, { rhs(SOLN), diff( rhs(SOLN), x
) }), x=0..2,
> title=`y(0)=1, y'(2)=-1` ):
> plots[display]( P );

5.1.2 New feature in Release 4 Note that the ability to plot an array of plots is new to Release 4.

5.2 Example 2

   > restart;

For what values of the parameter α does the following boundary value problem

   > ODE := diff( y(x), x$2 ) + 4*diff( y(x), x ) + 4*y(x) = exp(-2*x);

ODE := (\frac{∂^{2}}{∂x^{2}} y(x)) + 4 (\frac{∂}{∂x} y(x)) + 4 y(x) = e^{(−2 x)}

   > BC := y(0)=alpha, D(y)(Pi) - y(Pi) = 0;

BC := y(0) = α, D(y)(π) − y(π) = 0

have a solution?

5.2.1 Solution Note the new form of the boundary condition at x = π. We can attempt to use dsolve to find a solution to this problem:

   > dsolve( { ODE, BC }, y(x) );

But, how exactly should the lack of a response be interpretted?

Our only hope (using Maple) is the long method introduced previously in this worksheet. The first step is to determine the general solution for the nonhomogeneous equation

> GSOLN := dsolve( ODE, y(x) );

GSOLN := y(x) = \frac{1}{2} x^{2} e^{(−2 x)} + C1 e^{(−2 x)} + C2 e^{(−2 x)} x

> Y := unapply( rhs(GSOLN), x );

Y := x → \frac{1}{2} x^{2} e^{(−2 x)} + C1 e^{(−2 x)} + C2 e^{(−2 x)} x

The constraints to be satisfied by the constants are

> CEQN := eval( subs( y=Y, { BC } ) );

CEQN :=

\{ C1 = α, e^{(−2 π)} π − \frac{3}{2} π^{2} e^{(−2 π)} − 3 C1 e^{(−2 π)} − 3 C2 e^{(−2 π)} π + C2 e^{(−2 π)} = 0\}

The values of the constants that satisfy these conditions are

> CSOLN := solve( CEQN, { _C1, _C2 } );

CSOLN := \{ C1 = α, C2 = −\frac{1}{2} \frac{−2 π + 3 π^{2} + 6 α}{3 π − 1}\}

It is now apparent that they are well-defined for all values of α – hence the BVP has a unique solution for all α. This solution is

> SOLN := subs( CSOLN, GSOLN );

SOLN := y(x) = \frac{1}{2} x^{2} e^{(−2 x)} + α e^{(−2 x)} − \frac{1}{2} \frac{(−2 π + 3 π^{2} + 6 α) e^{(−2 x)} x}{3 π − 1}

The solution that corresponds with α = −\frac{1}{2} is

> YY := subs( alpha=-1/2, rhs(SOLN) );
> plot( [ YY, diff( YY, x ) - YY ], x=0..Pi,color=[RED,GREEN],
> title=`y and y' where y''+5y'+4y=e^{-2x}, y(0)=-1/2, y'(Pi)-y(Pi)=0`
);

YY := \frac{1}{2} x^{2} e^{(−2 x)} − \frac{1}{2} e^{(−2 x)} − \frac{1}{2} \frac{(−2 π + 3 π^{2} − 3) e^{(−2 x)} x}{3 π − 1}

It can also be interesting, and informative, to animate these solutions using α as the animation parameter.

> YYY := unapply( rhs(SOLN), (x,alpha) );

YYY := (x, α) → \frac{1}{2} x^{2} e^{(−2 x)} + α e^{(−2 x)} − \frac{1}{2} \frac{(−2 π + 3 π^{2} + 6 α) e^{(−2 x)} x}{3 π − 1}

> plots[animate](YYY(x,alpha), x=0..Pi, alpha=-1..1 );

From these plots, it appears as though y(π) = 0 for all values of α. Is this true? (Explain.)

6 Copyright

bvp.mws – a Maple worksheet to illustrate basic concepts relating to boundary value problems

(for use with section 4.2, #30, p. 159 of Nagle and Saff) Prepared by: Douglas B. Meade (7 March 1996) as part of the Maple Supplement for Nagle/Saff (Addison-Wesley) Updated to Maple V, Release 4, by Douglas B. Meade (27 December, 1996) For more information, please contact the author at one of following addresses: Department of Mathematics, Univ. of South Carolina, Columbia, SC 29208 (803) 777-6183 meade@math.sc.edu (copyright, Douglas B. Meade, 1996)