Course conventions: errors, stopping and notation
The agreements used in every lesson, exercise, assignment and exam of the course: what ε and δ mean, when an iteration stops, which norm is meant, how iterations are counted, and how to round by hand.
Last updated:
Every method in this course is run until it is accurate enough, and “accurate enough” can be written in several ways.
This page fixes the way we write it, so a lesson, a practice question, an assignment and an exam all mean the same thing.
When a question needs something different, it says so in the question.
Two measures: ε and δ
An iteration produces numbers that should approach a solution we do not know.
Two quantities tell us how close we are, and they answer different questions:
| Symbol | Name | Question it answers | Typical formula |
|---|---|---|---|
| step (estimated error) | Did the method stop moving? | ||
| residual | Does the answer solve the problem? |
The threshold we compare them with is a tolerance. A question might say “stop when ” and then ask for and for .
The two are different numbers, and one can be small while the other is large.
Here is bisection for on :
| new bracket | ||||
|---|---|---|---|---|
| 0 | none yet | none yet | none yet | (the start) |
| 1 | 1.5 | 0.5 | 0.25 | |
| 2 | 1.25 | 0.25 | 0.4375 | |
| 3 | 1.375 | 0.125 | 0.1094 | |
| 4 | 1.4375 | 0.0625 | 0.0664 |
At the step is already half as large as at , but the residual grew.
A small step does not promise a small residual, and a small residual does not promise a small step when is nearly flat.
This is why we always check both.
For Newton’s method on the same function, from , the same two columns are:
| 1 | 1.416667 | 0.083333 | 0.006944 |
| 2 | 1.414216 | 0.002451 | 0.000006 |
| 3 | 1.414214 | 0.000002 |
When does the iteration stop?
- Weak inequality. An iteration stops at the first for which the quantity is at most the tolerance: . The reason is the meaning of a tolerance: we require the approximation to be at most away, and a value exactly equal to the tolerance satisfies that requirement. If a question means “strictly smaller”, it writes explicitly.
- What we report. The answer is the value in the row where the condition first holds: (in bisection ), with that row’s and . In the bisection table above, with tolerance , we stop at and report .
- Both conditions. If a question gives two conditions, we stop when both hold, unless it says “either”. Each condition has its own threshold: for the step and for the residual, both weak. A rule such as “stop when the bracket is at most wide and ” is therefore written and with .
- Not below the gap. A tolerance cannot be smaller than the gap between stored numbers near the iterates: below it, no stored number can satisfy the condition and the loop may never end. Choose tolerances above times the size of the numbers involved, as explained in a tolerance cannot be smaller than the gap.
A program that runs a method also needs guards, because the stopping condition may never be met:
- An iteration cap. Count the steps and stop after
max_iterof them, even if the tolerance has not been reached, and report that the cap was reached instead of returning the last iterate as an answer. A cycling or slowly converging iteration would otherwise run forever. - A check that decreases. If grows from step to step, or a step lands outside the range where the problem makes sense, the method is not converging.
- A fall-back to bisection. When a bracket is known, a fast step that leaves the bracket, or fails the check above, is replaced by a bisection step; bisection always shrinks the bracket.
Counting iterations
- counts the iterations performed. In Newton’s method and fixed-point iteration the starting point is and the first iteration produces , so is the first row, and the table has one row per iteration. The one exception is the secant method: it starts from two points, and , and its first iteration produces , so it is indexed by the point it produces ( = iterations + 1) and its first row is .
- In bisection and regula falsi row is the start: the given bracket , with no approximation yet. Iteration takes , computes (in bisection ) and , and the new bracket is if , and otherwise; is always an end of it. Row shows , and the new bracket . iterations means .
- Every table has the columns , the iterate, and , plus whatever the method needs (for example and ).
ε in bisection
In bisection we use , with the left end of the bracket from which was computed.
Since is the midpoint of , this is half of that width, and it equals the width of the new bracket.
It is also the largest possible distance from to the root, so it is an honest bound on the error:
.
Since the bracket is halved at every iteration, and so .
The iteration stops at the first with . Since is the number of iterations, the condition is , and is the smallest integer with
At least one iteration is performed, so when . For and the quotient is , , and iterations, as in the table above.
For and the quotient is , , so iterations.
When the quotient is exactly a power of 2 no extra step is needed:
for and the quotient is , , so iterations are enough:
the last midpoint is at most from the root, as the tolerance requires.
Absolute and relative
The absolute and relative errors of an approximation to a value are
In an iteration we do not know , so we estimate the error from the step and, when a relative version is needed, divide by an iterate in place of the true value.
Two versions are common (dividing by the newer or by the older iterate), so a question that asks for a relative step always writes the formula.
A relative error is meaningless when the denominator is close to zero; then we use the absolute one.
Norms
When the iterate is a vector, and are norms of vectors.
- Vectors. without a subscript means the Euclidean norm .
- Matrices. without a subscript means , the largest factor by which stretches a vector in the 2-norm ( is the largest absolute eigenvalue). It is hard to compute by hand, so a question that needs a number written by hand names an easier norm: (largest column sum of absolute values), (largest row sum), or the Frobenius norm .
For these are , and , and . The 2-norm never exceeds the Frobenius norm.
Rate of convergence
If is the error and the limit
exists, the method has order . Order 1 is linear convergence (with ), order 2 is quadratic.
Bisection and regula falsi are linear, Newton’s method is quadratic near a simple root, and the secant method has order .
Hand calculation and rounding
- Keep every digit your calculator shows while you work; round only when you write the final answer.
- If a question asks for decimal places or digits, give exactly that many. A table entry is written with enough digits to see the stopping condition clearly.
- A rounded number can flip a stopping decision when the margin is small (for example against a tolerance of ). When this happens, show the unrounded value.
Notation
- Iterates are ; the exact solution of the problem at hand is , or when it is a minimizer or a fixed point; is the derivative.
- A “step” is one move of the method (one row of the table); an “iteration” is the same thing. We use them interchangeably.
- Tolerances are written when it could be confused with , and otherwise as a number in the question.
Why two measures and not one?
A step can be tiny because the method has found the root, or because it has slowed down on a flat part of .
The residual can be tiny because the root is found, or because is nearly flat there, so even a distant point has .
Checking both guards against both mistakes, and for vectors the same pair is written with norms.
Check yourself
1. Newton’s method gives and (take the digits as exact).
Compute . Does the method stop at for a tolerance of ?
And for ?
Solution 1
. The rule is and , so the method stops at and reports .
For a tolerance of it would not stop, since .
2. For compute , and the Frobenius norm.
Solution 2
Column sums of absolute values: and , so .
Row sums: and , so . Frobenius: .
Continue learning
- Glossary for the terms used here.
- Bisection and regula falsi, where these tables are used first.
- Newton and the secant method.