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.

Convergence of Algorithms

Open in Colab

Many numerical algorithms converge to a solution, meaning they produce better and better approximations to a solution. We’ll let x∗x_\ast denote the true solution, and xkx_k denote the kkth iterate of an algorithm. Let ϵk=∣xk−x∗∣\epsilon_k = |x_k - x_\ast| denote the error. An algorithm converges if

lim⁡k→∞ϵk=0\lim_{k\to\infty} \epsilon_k = 0

In practice, we typically don’t know the value of x∗x_\ast. We can either truncate the algorithm after NN iterations, in which case we estimate ϵ~k=∣xk−xN∣\tilde{\epsilon}_k = |x_k - x_N|

Alternatively, we can monitor the difference δk=∣xk−xk−1∣\delta_k = |x_k - x_{k-1}|. If the algorithm is converging, we expect δk→0\delta_k \to 0 as well, and we can stop the algorithm when δk\delta_k is sufficiently small.

In this class, we aren’t going to worry too much about proving that algorithms converge. However, we do want to be able verify that an algorithm is converging, measure the rate of convergence, and generally compare two algorithms using experimental convergence data.

Rate of Convergence

There are a variety of ways in which the rate of convergence is defined. Mostly, we’re interested in the ratio ϵk+1/ϵk\epsilon_{k+1} / \epsilon_k. We say the convergence of ϵ\epsilon is of order qq if

lim⁡k→∞ϵk+1ϵkq<C\lim_{k\to \infty} \frac{\epsilon_{k+1}}{\epsilon_k^q} < C

for some constant C>0C> 0.

  • q=1q = 1 and C∈(0,1)C \in (0,1) is called linear convergence

  • q=2q = 2 is called quadratic convergence

Larger values of qq indicate faster convergence.

Additionally, we have the following terms:

  • q=1q = 1 and C=1C = 1 is called sublinear (slower than linear) convergence

  • q>1q > 1 is superlinear (faster than linear) convergence

Clearly, if q=1,C>1q= 1, C > 1, or if q<1q < 1, the sequence actually diverges.

Measuring the Rate of Convergence

Let’s say we have a sequence ϵk→0\epsilon_k \to 0. How might we measure qq?

Assume we look at large enough kk so that the sequence is converging. Note that this potentially may not happen for many iterations.

Let’s look at the ratio ϵk+1/ϵkq≈C\epsilon_{k+1} / \epsilon_{k}^q \approx C. Taking the logarithm, we have

log⁡ϵk+1−qlog⁡ϵk≈log⁡C\log \epsilon_{k+1} - q \log \epsilon_{k} \approx \log C

This means that if q=1q = 1, the line log⁡ϵk\log \epsilon_k has slope log⁡C\log C.

If q>1q > 1, then log⁡ϵk\log \epsilon_k will go to −∞-\infty at an exponential rate.

<Figure size 432x288 with 1 Axes>
<Figure size 432x288 with 1 Axes>
<Figure size 432x288 with 1 Axes>
<Figure size 432x288 with 1 Axes>

Estimating q

There are a variety of ways to estimate qq. A rough, but easy estimate comes from finding the slope of the sequence log⁡∣log⁡(ϵk+1/ϵk)∣=log⁡∣log⁡ϵk+1−log⁡ϵk∣\log|\log(\epsilon_{k+1}/\epsilon_k)| = \log|\log \epsilon_{k+1} - \log \epsilon_k|. Because ϵk\epsilon_k shrinks exponentially (asymptotically) with base 1/q1/q. The slope of the line will be log⁡q\log q, from which we can estimate qq.

1.0
2.0
0.9466399163308074

Exercises

  1. Generate a converging sequence with q=1.5q = 1.5, and estimate qq using the above method

  2. Generate sublinear sequences with ϵk=1/k\epsilon_k = 1/k (as above) for lengths 50, 100, 500, 1000, 5000, and 10000. How does our estimate of qq change with the length of the sequence?

<Figure size 432x288 with 1 Axes>
0.9466399163308074
0.9720402367424485
0.994118748919332
0.9970337839193604
0.9994017352310425
0.9997004753046203