Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

12) Convergence classes

Last time

  • Forward and backward error

  • Computing volume of a polygon

  • Rootfinding examples

  • Use Roots.jl to solve

  • Introduce Bisection

Today

  1. Limitations of bisection

  2. Convergence classes

  3. Intro to Newton methods

Recap From last time:

Stability demo: Volume of a polygon

Loading...
pvolume(Y) = 9.249999989226126

31285.71436703205
  • Why don’t we even get the second digit correct? These numbers are only 108 and ϵmachine≈10−16\epsilon_{\text{machine}} \approx 10^{-16} so shouldn’t we get about 8 digits correct?

Rootfinding

Given f(x)f(x), find xx such that f(x)=0f(x) = 0.

We’ll work with scalars (ff and xx are just numbers) for now, and revisit later when they vector-valued.

Solve for xx

  • f(x;b)=x2−bf(x; b) = x^2 - b

    • x(b)=±bx(b) = \pm \sqrt{b}

  • f(x;b)=tan⁡x−bf(x; b) = \tan x - b

    • x(b)=arctan⁡bx(b) = \arctan b

  • f(x)=cos⁡x+x−bf(x) = \cos x + x - b

    • x(b)=?x(b) = ?

We aren’t given f(x)f(x), but rather an algorithm f(x) that approximates it.

  • Sometimes we get extra information, like fp(x) that approximates f′(x)f'(x)

  • If we have source code for f(x), maybe it can be transformed “automatically”

We saw:

Iterative bisection algorithm

bisect_iter (generic function with 1 method)
56

Let’s plot the error

∣bisectk(f,a,b)−r∣,k=1,2,…\lvert \texttt{bisect}^k(f, a, b) - r \rvert, \quad k = 1, 2, \dotsc

where rr is the true root, f(r)=0f(r) = 0.

Loading...

We saw that the error ek=xk−x∗e_k = x_k - x_* after kk bisections satisfies the bound

∣ek∣≤c2−k.|e^k| \le c 2^{-k} .

2. Convergence classes

  • A convergent rootfinding algorithm produces a sequence of approximations xkx_k such that

    lim⁡k→∞xk→x∗\lim_{k \to \infty} x_k \to x_*

    where f(x∗)=0f(x_*) = 0. For analysis, it is convenient to define the errors ek=xk−x∗e_k = x_k - x_*. We say that an iterative algorithm is qq-linearly convergent if

    lim⁡k→∞∣ek+1∣/∣ek∣=ρ<1.\lim_{k \to \infty} |e_{k+1}| / |e_k| = \rho < 1.

    (The qq is for “quotient”.) A smaller convergence factor ρ\rho represents faster convergence.

  • A slightly weaker condition (rr-linear convergence or just linear convergence - the “r” here is for “root”) is that

    ∣ek∣≤ϵk|e_k| \le \epsilon_k

    for all sufficiently large kk when the sequence {ϵk}\{\epsilon_k\} converges qq-linearly to 0.

Loading...
Loading...

Poll 12.1: Convergence class of the bisection method

Is the Bisection Method:

  • A = q-linearly convergent

  • B = r-linearly convergent

  • C = neither

Remarks on bisection

  • Specifying an interval is often inconvenient

  • An interval in which the function changes sign guarantees convergence (robustness)

  • No derivative information is required

  • If bisection works for f(x)f(x), then it works and gives the same accuracy for f(x)σ(x)f(x) \sigma(x) where σ(x)>0\sigma(x) > 0.

  • Roots of even degree are problematic

  • A bound on the solution error is directly available

  • The convergence rate is modest - one iteration per bit of accuracy

Newton-Raphson Method

Much of numerical analysis reduces to Taylor series, the approximation

f(x)=f(x0)+f′(x0)(x−x0)+f′′(x0)(x−x0)2/2+⋯⏟O((x−x0)3)f(x) = f(x_0) + f'(x_0) (x-x_0) + f''(x_0) (x - x_0)^2 / 2 + \underbrace{\dotsb}_{O((x-x_0)^3)}

centered on some reference point x0x_0.

In numerical computation, it is exceedingly rare to look beyond the first-order approximation

f~x0(x)=f(x0)+f′(x0)(x−x0).\tilde f_{x_0}(x) = f(x_0) + f'(x_0)(x - x_0) .

Since f~x0(x)\tilde f_{x_0}(x) is a linear function, we can explicitly compute the unique solution of f~x0(x)=0\tilde f_{x_0}(x) = 0 as

x=x0−f(x0)/f′(x0).x = x_0 - f(x_0) / f'(x_0) .

This is Newton’s Method (aka Newton-Raphson or Newton-Raphson-Simpson) for finding the roots of differentiable functions.

An implementation

[1] x=1  f(x)=-0.45969769413186023  f'(x)=-1.8414709848078965
[2] x=0.7503638678402439  f(x)=-0.018923073822117442  f'(x)=-1.6819049529414878
[3] x=0.7391128909113617  f(x)=-4.6455898990771516e-5  f'(x)=-1.6736325442243012
[4] x=0.739085133385284  f(x)=-2.847205804457076e-10  f'(x)=-1.6736120293089505
[5] x=0.7390851332151607  f(x)=0.0  f'(x)=-1.6736120291832148
(0.7390851332151607, 0.0, 5)