{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Tutorial 11 - Boundary value problems" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Boundary value problems of ordinary differential equations, finite difference method, shooting method, finite element method." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from scipy import linalg, integrate, optimize" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Shooting method" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The [shooting method](https://en.wikipedia.org/wiki/Shooting_method) has its origin in artillery. When firing a cannon towards a target, the first shot is fired in the general direction of the target. If the cannon ball hits too far to the right, the cannon is pointed a little to the left for the second shot, and vice versa. This way, the cannon balls will hit ever closer to the target. Consider the following boundary value problem,\n", "\n", "$$\n", "\\tag{1} \\label{eq:shooting_bvp}\n", "y^{\\prime \\prime}(x) = f(x, y(x), y^{\\prime}(x)), \\quad x \\in [a, b], \\quad y(a) = \\alpha, \\quad y(b) = \\beta.\n", "$$\n", "\n", "Let $ y(x; \\gamma) $ denote the solution of the initial value problem\n", "\n", "$$\n", "\\tag{2} \\label{eq:shooting_ivp}\n", "y^{\\prime \\prime}(x) = f(x, y(x), y^{\\prime}(x)), \\quad x \\in [a, b], \\quad y(a) = \\alpha, \\quad y^{\\prime}(a) = \\gamma.\n", "$$\n", "\n", "Define the function $ F(\\gamma) $ as the difference between $ y(b; \\, \\gamma) $ and the specified boundary value $ \\beta $,\n", "\n", "$$\n", "F(\\gamma) = y(b; \\, \\gamma) - \\beta.\n", "$$\n", "\n", "If $ \\gamma^{*} $ is a root of $ F(\\gamma) $ then the solution $ y(x; \\gamma^{*}) $ of initial value problem $ \\eqref{eq:shooting_ivp} $ is also a solution of boundary value problem $ \\eqref{eq:shooting_bvp} $. The usual methods for finding roots may be employed here, such as the [bisection method](https://en.wikipedia.org/wiki/Bisection_method) or [Newton-Raphson method](https://en.wikipedia.org/wiki/Newton%27s_method)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "