Formula sheet
A reference sheet for Applied Numerical Analysis: the notation, formulas, conditions, error estimates and stopping rules of the units published so far, in course order.
Last updated:
This sheet lists the notation, formulas and procedures of the published units, in course order.
It does not teach and it has no worked examples: each section links to the lessons that explain its items, and to the glossary for the concepts.
Conventions common to all units
The full text of these agreements is in the course conventions.
| Symbol | Meaning |
|---|---|
| the iterate after steps; is the starting point | |
| or | the exact solution (a root, or a fixed point) |
| the error of the iterate | |
| the step (estimated error) | |
| the residual | |
| the tolerances for the step and for the residual |
In bisection the step is , with the midpoint of and its left end.
Stopping rule. Stop at the first for which
Both inequalities are weak: the approximation must be at most the tolerance away, so equality is enough.
A question that means “either” or “strictly smaller” says so (the rule is written explicitly).
The reported answer is of that row, with its and .
Order of convergence. With , the method has order if
| Order | Name | Behavior of the error |
|---|---|---|
| , | linear | |
| quadratic |
The number of correct digits of an approximation with error is .
Absolute and relative error of an approximation to a value :
Norms (norm). Without a subscript, is the Euclidean norm and is the 2-norm:
where is the largest absolute value of an eigenvalue.
Norms that can be computed by hand:
| Norm | Definition |
|---|---|
| the largest column sum of absolute values | |
| the largest row sum of absolute values | |
| (Frobenius) |
Always .
Course opening
The course opening introduces no formulas.
Numbers and errors in the computer
Floating-point number (floating point), in the order the fields are stored:
With the stored fields, for a normal number:
| Symbol | Meaning |
|---|---|
| the sign cell: 0 for positive, 1 for negative | |
| , | the true exponent and the stored exponent field; for normal numbers , and the rule for every stored number is in the unified formula below |
| the constant added to before it is stored | |
| , | the fraction digits and the whole number they spell |
| the number of fraction cells | |
| the significand: the leading 1 (not stored) and the fraction |
The IEEE 754 formats:
| Format | Cells | Bias | |
|---|---|---|---|
| binary16 | 1 / 5 / 10 | 15 | |
| binary32 | 1 / 8 / 23 | 127 | |
| binary64 | 1 / 11 / 52 | 1023 |
One formula for every stored number, with the hidden cell:
| Exponent field | Fraction field | Meaning |
|---|---|---|
| all zeros | zero | the number zero ( and ) |
| all zeros | not zero | a subnormal number: , |
| all ones | zero | infinity () |
| all ones | not zero | NaN (not a number) |
| anything else | any | a normal number: , |
Range of binary64:
| Quantity | Value |
|---|---|
| largest finite number | about |
| smallest positive normal number | |
| smallest positive subnormal number |
Gaps and rounding (machine epsilon is the gap between 1 and the next stored number).
The gap between adjacent stored numbers with the same exponent , and the relative gap of a normal number:
Rounding to the nearest stored number, written , with the tie going to the number whose last fraction cell is 0 (ties to even), gives
Significant digits. Rounding to significant digits gives
Kinds of error and comparison:
| Term | Meaning |
|---|---|
| round-off error | the error of keeping a finite number of digits or cells: |
| truncation error | the error of replacing an infinite process (a series, a limit) by a finite one |
| catastrophic cancellation | the loss of leading digits when two nearly equal numbers are subtracted |
| comparison tolerance | two numbers count as equal when |
Lessons: binary representation and floating point, rounding and machine epsilon, errors and the Patriot failure.
Nonlinear equations in one variable
The problem is to find a root of .
Intermediate value theorem and bracket. If is continuous on and , then
The sign test is sufficient and not necessary for a root to exist in .
Bisection
(Bisection, counts the iterations performed; row is the starting bracket .)
- if , then ;
- otherwise ;
- if , then is a root and we stop.
is always an end of the new bracket . Row shows , and .
Needs: continuous on and (a bracket). It does not fail inside a bracket.
Error: the bracket width is and the step is
which bounds the distance from to the root.
Number of iterations ( at the stop): the smallest integer with , that is
with no extra step when the quotient is exactly a power of 2.
At least one iteration is performed: when .
Order: linear ( for the error bound ). Stop: the rule of the conventions.
Regula falsi
(Regula falsi: the point where the chord through and crosses zero.)
counts the iterations performed (row is the starting bracket), and the side where the sign changes is kept, as in bisection.
Needs: a bracket. Order: linear. Risk: one end can stay fixed, so the bracket width does not tend to 0 (it still bounds the error, but it is not a useful stopping test).
Stop: the rule of the conventions.
Newton–Raphson
(Newton–Raphson method: the tangent at crosses zero at .)
Needs: , with , and a start near the root. Order: quadratic near a simple root.
Risks: a nearly flat slope throws the next point far away; the iteration can cycle or diverge.
Stop: and by the rule of the conventions.
Secant method
(Secant method: Newton with the slope through the two latest points.)
Needs: two starting points and values of only.
Order: . Risk: there is no bracket, so it can diverge.
Stop: as for Newton.
Fixed-point iteration
(Fixed-point iteration.) A fixed point of is a number with
A root of becomes a fixed point of, for example, ; one equation can be written as in many ways.
Near
| Value of | Behavior |
|---|---|
| converges (from a close start), linearly, with factor | |
| the iterates move away from | |
| this test does not decide; the iteration can cycle | |
| faster than linear |
Each step gains correct digits.
Newton as a fixed point: , with , which is at a root where .
Slope frozen at : , a fixed-point iteration with .
Stop: and by the rule of the conventions.
Inverse quadratic interpolation
(Inverse quadratic interpolation: as a quadratic function of through three points, evaluated at .) For the points , , with distinct values :
In the next step the oldest point is dropped and the new one is added.
Needs: three starting points and values of only. Order: about , the real root of .
Risks: it fails when two of the values are equal, there is no bracket, and badly spread points can send the next point far away.
Stop: the rule of the conventions.
Brent’s method
Brent’s method keeps a bracket with at every step.
It tries an inverse quadratic interpolation step or a secant step, and replaces a candidate that is not well inside the bracket or does not shorten the step enough by a bisection step.
The methods side by side
| Method | Convergence | Needs | Main risk |
|---|---|---|---|
| Bisection | linear, for the bound | a bracket | slow |
| Regula falsi | linear | a bracket | an end gets stuck |
| Secant | order | two starts | may diverge |
| Slope fixed once | linear | one slope | slow if the slope changes |
| Inverse quadratic | order | three starts | equal values, a wild parabola |
| Newton–Raphson | order | and a good start | flat slope, cycles, divergence |
| Brent | guaranteed by the bracket | a bracket | a more complex program |
Lessons: bisection, regula falsi, Newton and the secant method, fixed point and inverse quadratic interpolation, choosing a method.