Interactive Educational Modules in
Scientific Computing

Shooting Method for Boundary Value Problems

This module illustrates the shooting method for numerically solving boundary value problems for ordinary differential equations. A general boundary value problem (BVP) consists of an ordinary differential equation (ODE) with side conditions specified at more than one point. This module illustrates the solution of second-order scalar ODEs of the form u″ = f(t, u, u′) on an interval [a, b] with boundary conditions u(a) = α and u(b) = β. The shooting method replaces the given BVP by a sequence of initial value problems (IVPs) for the same ODE with initial conditions u(a) = α and u′(a) = x, where x is a guessed initial slope that is successively refined until the desired boundary condition at b is satisfied. Let u(b; x) be the value at b of the solution produced by a given IVP solver for initial conditions u(a) = α and u′(a) = x. The shooting method employs an iterative method for solving nonlinear equations to find an initial slope x* such that u(b; x*) = β. The solution to this final IVP then coincides with the solution to the original BVP.

The user begins by selecting from the menu provided an ODE and a specific solution to be sought (if there is more than one). Boundary values u(a) = α and u(b) = β are indicated by black dots on the graph. Next the user specifies the order of the Runge-Kutta method to be used as the IVP solver and the number of steps to take in traversing the interval [a, b]. The user also selects either the bisection method or safeguarded secant method as the nonlinear equation solver. The user next clicks Initialize to begin the process of solving the BVP. As part of initialization, predetermined starting guesses x0 and x1 for the nonlinear equation solver are used to bracket the solution to the BVP so that β is between u(b; x0) and u(b; x1), as can be seen from the solutions to the corresponding IVPs drawn on the graph. Such an interval bracketing the solution x* of the nonlinear equation is maintained throughout the solution process. Each iteration is performed by clicking Take Shot, which plots the IVP solution for the chosen initial slope and updates the bracketing interval. The default initial slope (shown by an arrow in the graph) for each iteration is determined by the selected nonlinear equation solver, but the user can adjust the slope within the bracketing interval, if desired, using the slider provided. Progress toward convergence of the iterations can be observed from the IVP solutions plotted in the graph (which go from blue to red as the solution to the BVP is approached) as well as from the printed residual. The meaning of the residual depends on the nonlinear equation solver selected: for the bisection method it is the width of the current bracketing interval, and for the secant method it is u(b; x) − β, where x is the initial slope for the most recent iteration. The initial slope x and the value of u(b; x) for each iteration are printed in the table below.

To compare approximate solutions obtained using different method orders or different numbers of steps, see the alternative Shooting Method module.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 10.3.

Developers: Evan VanderZee and Michael Heath