Numerical analysis#

What is numerical analysis?#

We will see throughout this module that we can solve the same problem using different numerical methods. Given that we can write down a variety of numerical methods, it is important to understand what errors are made when applying each one. Since none of these methods will generally give exact answers, if we have two numerical methods for solving the same problem, we need to understand the size of the errors to know which method is superior.

The analysis of numerical methods, their errors and other properties, forms the subject of numerical analysis, which is an important and vigorous topic in mathematics and computation.

Taylor–Maclaurin series#

Suppose we have a function \(f(x)\) with derivative \(f'(x)\). Given a point \(x = a\) and we wish to approximate \(f(a + h)\) for nearby points \(x = a + h\) (with \(h\) small), then we can approximate:

Linear approximation: \(f(a + h) \simeq f(a) + h f'(a)\)

Quadratic approximation: \(f(a + h) \simeq f(a) + h f'(a) + \frac{h^2}{2} f''(a)\)

For better approximations, we use the Taylor-Maclaurin series:

\[f(a + h) = f(a) + h f'(a) + \frac{h^2}{2!}f''(a) + \frac{h^3}{3!}f'''(a) + \ldots + \frac{h^n}{n!} f^{(n)}(a) + \ldots\]

Taylor’s theorem#

If the function \(f(x)\) is differentiable at least \(n+1\) times at a point \(x = a\), then values of \(f\) near to \(a\) are given by:

\[f(a + h) = f(a) + h f'(a) + \frac{h^2}{2}f''(a) + \ldots + \frac{h^n}{n!} f^{(n)}(a) + O(h^{n+1})\]

The notation \(O(h^{n+1})\) means a quantity that tends to zero like a constant times \(h^{n+1}\) when \(h\) tends to zero. It is a convenient way to give the key information needed about the ‘error term’.

Rule of thumb: If the error term is \(\varepsilon = O(h^2)\), then if we halve \(h\) the error \(\varepsilon\) is multiplied by a quarter. A scheme with \(O(h^2)\) error is superior to one with \(O(h)\) error, when halving \(h\) only halves the error.