{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 07 - Nonlinear equations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Root finding, bisection method, secant method, false position method, Newton-Raphson method." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "from scipy import linalg, optimize\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Bisection method" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The [bisection method](https://en.wikipedia.org/wiki/Bisection_method) is applicable for numerically solving the equation $ f(x) = 0 $ for $ x \\in \\mathbb{R} $, where $ f $ is a continuous function defined on an interval $ [a, b] $ and where $ f(a) $ and $ f(b) $ have opposite signs. In this case $ a $ and $ b $ are said to bracket a root. \n", "\n", "At each step the method divides the interval $ [a, b] $ in two by computing the midpoint $ c = (a + b) \\ / \\ 2 $ of the interval. Unless $ c $ is itself a root (which is very unlikely, but possible) there are now only two possibilities: either $ f(a) $ and $ f(c) $ have opposite signs and bracket a root, or $ f(c) $ and $ f(b) $ have opposite signs and bracket a root. The method selects the subinterval that is guaranteed to be a bracket as the new interval to be used in the next step. The process is continued until the interval is sufficiently small. When implementing the method on a computer, there can be problems with finite precision, so there are often additional convergence tests or limits to the number of iterations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "