Preface


This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0330. It is primarily for students who have very little experience or have never used Mathematica before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel.

Finally, the commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts. This means that you can copy and paste all comamnds into Mathematica, change the parameters and run them. You, as the user, are free to use the scripts to your needs for learning how to use the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the second course APMA0330
Return to Mathematica tutorial for the first course APMA0340
Return to the main page for the course APMA0340
Return to the main page for the course APMA0330
Return to Part IV of the course APMA0330

Shooting Method


The idea of shooting method is to reduce the given boundary value problem to several initial value problems. Roughly speaking, we 'shoot' out trajectories in different directions until we find a trajectory that has the desired boundary value. We start with the Dirichlet boundary value problem for a linear differential equation of second order:

\[ y'' (x) = p(x)\,y' + q(x)\,y + r(x) \qquad \mbox{subject} \quad y(a) = \alpha, \quad y(b) = \beta \]
over interval [a,b]. In this case, the solution to the boundary value problem is usually given by a linear combination of two functions, u(x) and v(x) that are solutions to the initial value problems.
\[ y (t) = u(t) + \frac{\beta - u(b)}{v(b)} \, v(t) , \]
where u(t) is a solution to the initial value problem
\[ u'' (t) = p(t)\,u' + q(t)\,u + r(t) \qquad \mbox{subject} \quad u(a) = \alpha, \quad u'(a) = 0; \]
and v(t) is a solution to another initial value problem:
\[ v'' (t) = p(t)\,v' + q(t)\, v , \qquad \mbox{subject} \quad v(a) = 0, \quad v'(a) = 1. \]

Theorem. Consider the Dirichlet boundary value problem for the linear second order differential equation

\[ y'' (x) = p(x)\,y' + q(x)\, y + r(x) , \qquad \mbox{subject} \quad y(a) = A, \quad y(b) = B, \]
where A and B are some given real numbers. The coefficients of the differential equation, p(x), q(x), and r(x) are continuous on the given interval [a,b]. If there is exists a positive constant L so
\[ \begin{split} q(x) >: 0 \quad \mbox{for all } x \in [a,b], \\ \left\vert p(x) \right\vert < L = \max_{a \le x \le b}\, \left\{ \, |p(x) | \, \right\} . \end{split} \]
Then the linear boundary value problem
\[ y'' (x) = p(x)\,y' + q(x)\, y + r(x) , \qquad \mbox{subject} \quad y(a) = A, \quad y(b) = B \]
has a unique solution \( y = \phi (x) \) over \( a \le x \le b . \)

Example. Consider a harmonic oscillator subject to the Dirichlet boundary conditions

\[ y'' + y =0 , \qquad \mbox{subject} \quad y(0) = A, \quad y(\pi ) = B. \]
This problem has infinite many solutions because if y(x) is its solution, then z(x) = y(x) + K sin (x) is also a solution for arbitrary constant K. Therefore, the conditions of the above theorem are violated. Indeed, since \( p(x) \equiv 0 , \) there does not exist a positive constant L (it is zero).

Example. Consider the Dirichlet boundary value problem

\[ \frac{{\text d}^2 w}{{\text d} r^2} + \frac{1}{r}\,\frac{{\text d} w}{{\text d} r} - \frac{w}{r^2} =0 , \qquad \mbox{subject} \quad w(3) = 6, \quad w'(8) = 2. \]
Since the formula for the given boundary value problem is known to be
\[ w (r) = u(r) + \frac{2 - u(8)}{v(8)} \, v(r) , \]
we need to find u(r), the unique solution to the initial value problem
\[ \frac{{\text d}^2 u}{{\text d} r^2} + \frac{1}{r}\,\frac{{\text d} u}{{\text d} r} - \frac{u}{r^2} =0 , \qquad \mbox{subject} \quad u(3) = 6, \quad u'(3) = 0, \]
and v(r), which is the solution to IVP:
\[ \frac{{\text d}^2 v}{{\text d} r^2} + \frac{1}{r}\,\frac{{\text d} v}{{\text d} r} - \frac{v}{r^2} =0 , \qquad \mbox{subject} \quad v(3) = 0, \quad v'(3) = 1. \]
The given differential equation is the Euler one, so its general solution is
\[ u(r) = A\,r + \frac{B}{r} \qquad \mbox{and} \qquad v(r) = a\, r + \frac{b}{r}. \]
To find the values of constants, we substitute their forms into the initial conditions:
\[ \begin{split} u(3) = A\, 3 + \frac{B}{3} =1, \quad u' (3) = A - \frac{B}{9} =0 , \\ v(3) = a\,3 + \frac{b}{3} =0, \quad a- \frac{b}{9} =1 . \end{split} \]
Therefore,
\[ u(r) = r + \frac{9}{r} \qquad \mbox{and} \qquad v(r) = \frac{1}{2}\, r - \frac{9}{2\,r}. \]
Since u(8) = 73/8 and v(8) = 55/16, we find the required solution
\[ w (r) = r + \frac{9}{r} + \frac{2 - 73/8}{55/16} \left( \frac{1}{2}\, r - \frac{9}{2\,r} \right) = \frac{2}{55\,r} \left( 504 - r^2 \right) , \]

 

 

Differential Equations of higher order

Fundamental Sets of Solutions

General Solutions

Complex Roots

Reduction of order

Variation of Parameters

Method of Undetermined Coefficients

Operator Methods

Numerical Solutions

Spring Problems

Pendulum

Electric Circuits

Boundary Value Problems

Shooting Method

Finite Difference Schemes

Applications

 

Return to Mathematica page

Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)