Professional Documents
Culture Documents
(Chapter 4) Shooting Method
(Chapter 4) Shooting Method
(Chapter 4) Shooting Method
Shooting Method
4.1 Introduction
The shooting method is an alternative numerical method for solving
boundary value problems (BVPs). The basic idea is to convert the
BVP into two initial value problems (IVPs) that can be solved using
the technique developed in Chapter 1.
For linear BVPs, the shooting method takes a linear combination
of solution to two IVPs. The specific form of the IVPs and the com-
bination of its solution is specified by the type of boundary conditions
given.
The shooting method for nonlinear BVPs lead to an iterative process
for which the secant method or Newton’s method can be used.
On the other hand, if v(xN ) = 0, the solution u(x) satisfies both of the
boundary conditions.
The system of two first order initial value problem, can be solved
by using single step method.
Example 4.1 Solve the following boundary value problem using linear
shooting method. Use Euler method to solve the corresponding initial
value problems.
y 00 + xy 0 − 3y = 4.2x, 0 ≤ x ≤ 1,
y(0) = 0, y(1) = 1, and h = 0.25.
Example 4.2 Use the linear shooting method to approximate the solu-
tion of the following boundary value problem. Solve the corresponding
initial value problem using midpoint method.
y 00 = 4(y − x), 0 ≤ x ≤ 1,
y(0) = 0, y(1) = 2, and h = 0.25.
Example 4.3 Solve the following boundary value problem using linear
shooting method. Use Heun’s method to solve the corresponding initial
value problems.
y 00 = 2y 0 + y + xex − x, 0 ≤ x ≤ 2,
y(0) = 0, y(2) = −4, and h = 1.
Example 4.4 Write the linear shooting method algorithm to solve the
following boundary value problem.
π
y 00 = y 0 + 2y cos x, 0 ≤ x ≤ ,
π 2
π
y(0) = −0.3, y = −0.1, and h = .
2 16
Use optimal RK2 method to solve the corresponding initial value prob-
lems.
Example 4.5 Write the linear shooting method algorithm to solve the
following boundary value problem. Use the fourth order Runge-Kutta
52 CHAPTER 4. SHOOTING METHOD
If v 0(xN ) 6= 0, then
θ − u0(xN )
s= . (4.11)
v 0(xN )
Then the solution of the original two point boundary value problems is
given by
h θ − u0(x ) i
N
y(x) = u(x) + v(x),
v 0(xN ) (4.12)
x0 ≤ x ≤ xN .
Example 4.6 Use the linear shooting method to approximate the so-
lution of the indicated boundary value problems. Write out the initial
value problems that must be solved, then solve the initial value prob-
lems using Euler method.
(ii) y 00 = y 0 + 2y + cos x, 0 ≤ x ≤ 1,
y(0) = −0.3, y 0(1) = 0.3, and h = 0.25.
Example 4.7 Write the linear shooting method algorithm to solve the
following boundary value problem. Use midpoint method to solve the
corresponding initial value problems.
y 00 = −2y 0 − 4y, 0 ≤ x ≤ 1,
y(0) = 2, y 0(1) = 2, and h = 0.2.
(ii) (IVP2),
v 00 = p(x) v 0 + q(x) v, x0 ≤ x ≤ xN ,
(4.16)
v(x0) = 1, v 0(x0) = 0.
(iii) (IVP3),
w00 = p(x) w0 + q(x) w, x0 ≤ x ≤ xN ,
(4.17)
w(x0) = 0, w0(x0 ) = 1.
Let u(x), v(x) and w(x) are the solutions of the initial value prob-
lems (4.15), (4.16) and (4.17) respectively. Now let
Example 4.8 Solve the following boundary value problems using lin-
ear shooting method. Use Euler’s method to solve the corresponding
initial value problems.
(i) y 00 − xy 0 − y = x2, 0 ≤ x ≤ 1,
0 0
y (0) = 0, y (1) = 1, and h = 0.25.
π
(ii) y 00 = y + sin(3x), 0≤x≤ ,
2
π π
y(0) + y 0(0) = −1, y 0 = 1, and h = .
2 8
4.3. NONLINEAR SECOND ORDER BVP 55
Example 4.9 Use the linear shooting method to approximate the so-
lution of the indicated boundary value problems. Write out the initial
value problems that must be solve. Then solve these initial value prob-
lems using midpoint method.
(i) y 00 = y + x, 0 ≤ x ≤ 1,
y(0) + y 0(0) = 0.5, y(1) − 2y 0(1) = 0, and h = 0.25.
(ii) y 00 + xy 0 + y = x2, 0 ≤ x ≤ 1,
0
y(0) + y (0) = 0, y(1) + y 0 (1) = 1, and h = 0.25.
(iii) y 00 − y = 1, 0 ≤ x ≤ 1,
1
y(0) − y 0 (0) = 1, y(1) + y 0 (1) = 1, and h = 0.25.
2
where u(x) represent y(x). Then convert the differential equation (4.24)
to a system of first order differential equation. Let
u0 = v, u(x0) = α,
(4.25)
v 0 = f(x, u, v), v(x0) = s.
56 CHAPTER 4. SHOOTING METHOD
or
φ(s) = v(xN , s) − θ = 0. (4.27)
We can use secant or Newton’s method to improve the value of shooting
direction, s.
where s0 and s1 are initial guesses and we define φ(s) from equation
(4.26) or (4.27).
If we have nonlinear differential equation (4.23) with boundary con-
ditions (4.2), then we can rewrite equation (4.28) as
dφ d[v(xN , s) − β]
φ0(s) = =
ds ds (4.38)
dv(xN , s) ∂v(xN , s)
= = .
ds ∂s
∂u(xN , s) ∂v(xN , s) ∂u(x, s)
We need to estimate and . Let z1(x) =
∂s ∂s ∂s
∂v(x, s)
and z2(x) = . Then
∂s
dz1 d ∂u
z10 (x) = =
dx dx ∂s (4.39)
∂ du ∂v
= = = z2(x),
∂s dx ∂s
and
dz2 d ∂v
z20 (x) = =
dx dx ∂s
∂ dv ∂f(x, u, v)
= =
∂s dx ∂s (4.40)
∂f ∂u ∂f ∂v
= · + ·
∂u ∂s ∂v ∂s
∂f ∂f
= z1(x) + z2(x) .
∂u ∂v
Furthermore,
∂u(x0, s) ∂α
z1(x0 ) = = = 0, (4.41)
∂s ∂s
and
∂v(x0, s) ∂s
z2 (x0) = = = 1. (4.42)
∂s ∂s
So that we need to solve the following initial value problem to estimate
the value of z1(xN ) or z2(xN ).
y 00 = 2y 3 , 0 ≤ x ≤ 1,
3y(0) − 9y 0(0) = 2, y(1) = 0.25, and h = 0.25.
y 00 + 2y 2 − 8x2 y 3 = 0, 0 ≤ x ≤ 1,
y(0) + y 0(0) = 1, y(1) = 0.5, and h = 0.2.
62 CHAPTER 4. SHOOTING METHOD