Boundary Value Problems
Boundary Value Problems
Problems
3.1 Introduction
1
We mainly consider the so-called two-point BVP
2
bvp4c and bvp5c can actually handle a class of singular
BVPs of the form
S
y′(x) = y + f (x, y, p), a ≤ x ≤ b,
x
0 = g(y(a), y(b), p),
3
Parameters may arise naturally as the physical model is
derived, or they may be added artificially as part of the
solution process, e.g., if there are singular coefficients
or the problem is posed on an infinite interval.
bvp4c and bvp5c accept problems with unknown
parameters directly; but many other solvers do not, so
we discuss how to convert problems with parameters
so they can be handled by these other solvers.
Note 3. For brevity, we generally suppress the explicit
dependence of p in (1).
We have talked about conversion of ODEs to standard
(first-order) form, but we also noted that some solvers
handle higher-order equations like ÿ = f (t, y) directly.
It is even more advantageous to handle high order
directly for BVPs, but it complicates the interface, so
it is not done in Matlab.
Many codes also assume the BCs to be separated; i.e.,
each component of g involves unknowns at only one
end point at a time.
We also discuss how to convert problems with non-
separated BCs to ones with separated BCs.
4
It is not always clear what BCs make sense and where
they can be applied (cf. the pendulum problem of
Section 1.2).
e.g., any solver can fail even when a good initial guess
at the solution and parameters are provided.
5
3.2 BVPs
The facts of life for BVPs are much different than they
are for IVPs.
y ′′ + y = 0 (2)
6
A useful way to analyze such problems is to let y(x; s)
be the solution of the ODE (2) with initial values
y(a; s) = ya and y ′(a; s) = s.
7
Thus the BC
8
Sturm–Liouville Eigenproblems
y ′′ + λy = 0, 0 ≤ x ≤ π, (3)
y(0) = 0, y(π) = 0.
9
Note 4. This is a nonlinear BVP because the
unknown λ multiplies the unknown y(x).
10
Existence and uniqueness of solutions for nonlinear
algebraic equations are generally hard to establish.
λ = k2, k = 1, 2, . . . .
11
Nonlinear BVPs
y ′′ + |y| = 0
12
The second solution has the form y(x; s) = s sin x.
1.5
0.5
y
−0.5
−1
−1.5
−2
0 0.5 1 1.5 2 2.5 3 3.5 4
x
13
In general, models of physical situations described by
BVPs may not have unique solutions!
14
3.3 BCs
15
• All obvious physical constraints have been imposed,
yet there are not enough BCs. In this case you
should look for other conditions like a conservation
of integrals or normalizing condition.
16
3.3.1 BCs at singular points
uxx + uyy + ey = 0.
u′
u + k + eu = 0,
′′
0 ≤ r ≤ 1,
r
17
We expect this problem to be an artifact related to the
co-ordinate system and not something fundamental.
2
We have seen this as a method for dealing with singularities in IVPs.
18
For this example, we expect a smooth solution with
even symmetry, so we can expand in a Taylor series of
the form
u′′(0) 2 u(4)(0) 4
u(r) = u(0) + r + r + ....
2 4!
k
(u′′(0) + . . .) + (u′′(0)r + . . .) + eu(0)+... = 0.
r
u(0)
e
u′′(0) = − ,
k+1
eu(0) 2
u(r) ≈ u(0) − r .
2(k + 1)
19
This is good enough to approximate u(r) on an interval
[0, δ] for sufficiently small δ.
20
It can be more difficult to determine the behaviour of
solutions at a singular point.
y(x) ∼ axb
21
Substituting this into the ODE, we find that
22
For this to have a limit as x → 0 we must have
2b − 1 = 0 or b = 1/2.
2
√
From this limit we find −1 = −a (1/2) or a = ± 2.
23
3.3.2 BCs at infinity
y ′′′ + 2y ′′ − y ′ − 2y = 0.
24
However consider the BCs
25
The essence of the matter is that the two solution
parts that decay exponentially cannot be distinguished
from each other numerically by their values at x = b.
y′ = Jy + q(x).
m
X
y(a) − p(a) = αj vj ,
j=1
26
and the general solution to the ODEs is
m
X
y(x) = p(x) + αj eλj (x−a)vj .
j=1
m
X
y(b) − p(b) = βj vj ,
j=1
27
Roughly speaking, components that decay rapidly from
left to right must be determined by the BCs at the left
end point, and vice versa for components that increase
from left to right (and hence decay from right to left).
28
Travelling wave solutions of Fisher’s
equation
U ′′ + cU ′ + U (1 − U ) = 0.
U (−∞) = 1, U (∞) = 0.
29
However, it turns out there are an infinite number of
solutions: if U (z) is a solution, then so is U (z + γ) for
any constant γ.
U ′(z) ∼ βU (z),
√
where β = (−c + c2 − 4)/2, and near the point (1, 0)
30
a solution exists with
U (z) ∼ 1 + peαz ,
and hence
U ′(z) ∼ αpeαz .
To approach (1, 0) as z → −∞ we require Re(α) > 0.
Substituting this into the ODE, we find that
31
hence
α2 + cα ∼ 1 + peαz ∼ 1,
as z → −∞.
√
Thus α = (−c ± c 2 + 4)/2,4 and only α = (−c +
√
c2 + 4)/2 has Re(α) > 0.
U ′(z)
→ α,
U (z) − 1
U ′(−Z)
− α = 0.
U (−Z) − 1
32
Because U (z) → 0 as z → ∞, U (z)(1−U (z)) ≈ U (z),
and so we can look at
U ′′ + cU ′ + U = 0,
having solution
U (z) ∼ qeβz ,
where β satisfies β 2 + cβ + 1 = 0.
More
√ analysis indicates we must use β = (−c +
c2 − 4)/2; essentially we work with the more slowly
decaying part of the solution — the faster decaying one
is then guaranteed to have vanished by the endpoint
we choose.
U (Z)
− 1 = 0.
eβZ
33
Other kinds of asymptotic behaviour
Consider
′ −x2
y = λxy, y(0) = 1, y ∼ e as x → ∞.
−x2
λ = −2, y(x) = e .
34
Algebraic decay
Consider
1
y(x) = .
λx + 1
35
e.g., if we require y(x) ∼ 1/x as x → ∞, then there is
a unique solution with λ = 1.
1 1
λb = 1 − , yb(x) = .
b x + 1 − x/b
36
3.4 Numerical Methods for BVPs
Consider
37
The exact solution to the IVP is
We note that
∂y
max = 0.1 sinh(10x) ≈ 1.3 × 1042.
x∈[0,10] ∂s
10(yb − cosh(100))
s= .
sinh(100)
38
Shooting can be effective if the resulting IVPs are not
too unstable; if they are, codes may blow up before
reaching x = b.
39
The idea is that if f (t, y) is Lipschitz, then there is a
bound for the stability of the IVP involving eL(b−a) ; so
reducing the effective length (b−a) leads to exponential
improvement in stability!
40
The nonlinear algebraic equations are of course solved
by a variant of Newton’s method.
41
A simple but important numerical method is the
trapezoidal rule
∆xi
yi+1 − yi = [f (xi, yi) + f (xi+1, yi+1)],
2
for i = 0, 1, . . . , N − 1.
42
In an IVP, all the information that specifies a solution
is given at a single point, and the solution evolves from
that point in a specific direction, discarding some or
all of the past solution values.
43
To understand this structure better, assume for now
that the ODEs and BCs are linear;6 i.e., let
y′ = J(x)y + q(x),
Bay(a) + Bby(b) = β.
The trapezoidal rule on [xi, xi+1] is
where, for i = 0, 1, . . . , N − 1,
2 2
Si = − I − J(xi ), Ri = I − J(xi+1 ), vi = q(xi) + q(xi+1).
∆xi ∆xi
6
In any event, these linear problems are the building blocks used in the
iteration to solve nonlinear problems.
44
This is handled easily in Matlab by treating this as a
general sparse matrix.
Bay(a) = β a, Bby(b) = β b,
45
Higher-order RK methods for BVPs
s
X
yi,j = yi + ∆xi aj,k f (xi,k , yi,k ),
k=1
46
and then forming
s
X
yi+1 = yi + ∆xi bj f (xi,j , yi,j ).
j=1
47
Finite-difference formulas only provide solutions at
mesh points; hence we consider continuous extensions
for these methods as we did in the IVP context.
48
The Matlab function bvp4c uses a Simpson formula
as its basic discretization; it is a three-point Lobatto
method of order 4, so its natural continuous extension
is C 1[a, b] and also order 4.
49
The spline is determined by requiring that S(x) be
continuous on [a, b], satisfy the BCs, and collocate
the ODEs at the midpoint and endpoints of each
subinterval
50
Enright and Muir implement a family of IRK formulas
with continuous extensions in a Fortran code called
MIRKDC.
51
On initial guesses ...
52
On error control ...
53
An obvious difference is that when solving BVPs, the
entire mesh is (generally) changed, whereas only one
step at a time is changed when solving IVPs.
54
The idea is as follows: Suppose we can compute a
function F (x; h) that involves a parameter h, and we
want the limiting value F (x; 0).7
If we know that
7
It is assumed that you cannot simply substitute h = 0 into F (x; h).
55
Solving this equation for φ(x)hp provides a computable
estimate of the error of the more accurate result:
h 1 h
e x; ∼ p F (x; h) − F x; .
2 2 −1 2
56
If the BVP is well-conditioned, then small perturbations
to the problem result in small perturbations to the
solution, so a solution that is accurate by backward
error analysis is also accurate in the usual sense.
57
bvp5c takes advantage of a remarkable relation
between the true error and the (scaled) residual in
its error control:
√
8 5
ke(x)k∞,i = ∆xikr(x)k∞,i + O(∆x6 ),
125
∆xi kr(x)k∞,i ≤ τ
58
Shooting as residual control
59
3.5 Solving BVPs in Matlab
60
Example 3.5.1
61
Example 3.5.2
4
sin (x) π π
ǫy ′ = sin2(x) − λ , y − = 1, y = 1,
y 2 2
62
This must be done even if the unknown parameters do
not explicitly appear in either the ODEs or the BCs.
See ch3ex2.m
63
Example 3.5.3
3
y
y1′ = 3 y1 + y2 − 1 − 1.3 ,
3
1
y2′ = − (y1 − 0.7 + 0.8y2 ),
3
64
In such cases it is reasonable to assume we have (say)
y1(0) = y0; for concreteness we assume y1(0) = 0.
The only widely used solver that can handle this kind of
problem directly is the multiple shooting code D02SAF
from the NAG library.8
65
Then the BVP becomes
y13
dy1
= 3T y1 + y2 − − 1.3 ,
dx 3
dy2 T
= − (y1 − 0.7 + 0.8y2 ),
dx 3
subject to
See ch3ex3.m
66
Example 3.5.6
67
It is quite common to study how a solution behaves as
a function of parameters in the problem.
68
It is easy to find a solution for R = 100 using even
a constant initial guess; to do the same thing when
R = 10, 000 is very difficult!
See ch3ex6.m
69
We might use the code
syms y y1 y2 y3 y4 y5 y6 y7 R A P F
y = [ y1; y2; y3; y4; y5; y6; y7 ];
P = 0.7*R;
F = [ y2; y3; R*(y2^2 - y1*y3 - A); y5;
-R*y1*y5 - 1; y7; -P*y1*y7 ];
dFdy = jacobian(F,y),
dFdA = jacobian(F,A)
70
Vectorization reduces the run time to 8.02s.
71
Example 3.5.7
72
The idea is to “continue” from the solution of the easy
problem to the solution of the problem you really want
to solve.
73
3. The exact choice of the sequence of µ values
can make the difference between success and
failure. Theory and software to determine a suitable
sequence of µ values exist, but it seems there are
still many open questions.
y1′ = y2,
y2′ = y3,
3−n
y3′ = − y1y3 − ny22 + 1 − y42 + sy2,
2
y4′ = y5,
3−n
y5′ = − y1y3 − (n − 1)y2 y4 + s(y4 − 1),
2
74
We split the ODEs into the linear and nonlinear parts
and introduce a parameter δ to control the influence
of the nonlinear parts:
y2 0
y3 0
3−n
′
2 2
y = 1 + sy2 + δ − 2 y1y3 − ny2 − y4
y5 0
− 3−n
s(y4 − 1) 2 y1 y3 − (n − 1)y2y4
See ch3ex7.m
75
Example 3.5.8
′ C−1
v = ,
n
vC − min(x, 1)
C′ = ,
η
v(0) = 0, C(λ) = 1.
76
The quantity of most interest is the (dimensionless)
emergent osmolarity defined by
1
Os = .
v(λ)
1
Os ∼ ,
1−K
where
λ sinh(κ/λ)
K= ,
κ cosh(κ)
and κ is a parameter such that
λ2
η= 2
.
nκ
77
Numerical methods have less than their classical order
of convergence when the ODEs (and hence their
solutions) are not smooth.
dy1 y2 − 1
= ,
dx n
dy2 y1y2 − x
= ,
dx η
78
Then we introduce unknowns y3(x) = v(x) and
y4(x) = C(x) for the interval x ∈ [1, λ]; this leads
to the ODEs
dy3 y4 − 1
= ,
dx n
dy4 y3y4 − 1
= ,
dx η
x−1
ξ= .
λ−1
79
d d
Noting that dx = (λ−1) dξ , the ODEs on [1, λ] become
dy3 (λ − 1)(y4 − 1)
= ,
dξ n
dy4 (λ − 1)(y3y4 − 1)
= ,
dξ η
See ch3ex8.m
80
This problem can also be solved directly with bvp4c
and bvp5c as a multi-point BVP with much less
mathematical preparation but a little more accounting.
See threebvp.m
81