MTH 451/551
Lecture 1
0 What is numerical analysis?
This is a course on numerical analysis (specifically numerical calculus, which focuses specifically on calculus topics such as integration and differentiation). Numerical analysis is concerned with finding (or approximating) solutions to problems numerically, rather than symbolically. To give a simple example that illustrates this distinction, we could ask:
What are the roots of this polynomial?
We could solve this problem “symbolically” or “analytically” using standard techniques such as the quadratic formula or completing the square. We would find that the solution is
| (1) |
We could then use, for example, a calculator to see that the roots are approximately
| (2) |
Numerical analysis takes a different approach to questions like these. There are many questions in mathematics, physics, and engineering that arise quite naturally, and that do not admit a closed-form solution. This means that we could not write a formula for the exact roots as in (1). In fact, it is a famous theorem that a general formula (in terms of basic arithmetic operations and roots) for the roots of polynomials of degree five or higher does not exist. So, instead of searching for the exact solution, we try to find the approximate solution (2) directly. It turns out that there are some very good computer algorithms for finding these approximate solutions for very many mathematics problems, and that these algorithms give us solutions to many problems for which finding a symbolic solution would be impossible. Numerical analysis transforms large classes of problems from “come up with a clever substitution or apply complicated transformations” to “run a deterministic computer algorithm”. The utility of such methods is enormous in many fields of science and engineering.
Numerical analysis is about developing and understanding computer algorithms to numerically solve mathematics problems of relevance to science and engineering.
1 Polynomial Approximation and Taylor’s Theorem
[Textbook reference: §1.1]
As described above, the goal of numerical calculus is to numerically approximate the solution to calculus problems, such as computing derivatives or integrals of given functions. One of the most useful tools to this end will be polynomial approximation. We know how to differentiate and integrate polynomials (just apply the power rule). So, if, given a function , we can find a polynomial that is very close to (in some sense of “close”), then differentiating or integrating could give us a good approximation of the derivatives or integrals of . Here, differentiation and integration are essentially stand-ins for many other operations that we might want to perform on , and which we know how to do for polynomials like . Recall that a polynomial is a function given by
The largest number such that is called the degree of the polynomial.
It turns out that (under some conditions), functions (and their derivatives and integrals) can be approximated very well by polynomials. The key result is called Taylor’s Theorem, which we will state shortly. We consider a real-valued function . Here, is the domain of , which just means that it’s the interval on which the function is defined. We allow and , so depending on the function, may be defined on all of . We are interested in continuous functions. A function is continuous at if
A function is continuous on if it is continuous at for all . This means that doesn’t have any “jumps” or “gaps”. Its graph can be drawn without lifting the pencil off of the page. We also assume that is differentiable, meaning that its derivative exists. We use the notation
If is also differentiable, then we say is twice differentiable, and write
Generalizing, may be times differentiable, with th derivative . We usually want to be times continuously differentiable, meaning that, not only does exist, but that is also continuous. For example, we would say that is continuously differentiable if exists and is continuous. To express that is times continuously differentiable, we write
We are now ready to state Taylor’s Theorem.
Theorem 1 (Taylor’s Theorem).
Suppose that is times differentiable at . There is a unique polynomial of degree for which for , and it can be expressed as
| (3) |
Now suppose that and . Then for each there is a between and such that
| (4) |
Furthermore, may be chosen so that is continuous on .
The polynomial is called the Taylor polynomial of order for at . The degree of is at most (but it may sometimes be less than , so “degree” and “order” may be different).
Example 1 (Approximation by Taylor polynomials).
Let , which is infinitely differentiable on . The derivatives of can be computed:
The Taylor polynomials of order for at , for , , and , are
Using (4) with , we see that, for example,
for some between and . This gives us an expression for the error. It tells us how far the polynomial approximation can be from . Graphs of these polynomials over are pictured below, together with , as well as the errors and the absolute errors .
The plots above show Taylor polynomials of order 0, 1, and 2, centered at , for the function (left), as well as errors (center) and absolute errors (right).
In the next example, we will use the following theorem.
Theorem 2 (Integral Mean Value Theorem).
Let , with bounded on and . If does not change sign on , then there is an such that
Example 2 (The midpoint rule for approximating ).
Suppose that and . Let . This is the first-order Taylor polynomial of at the midpoint of . We call this function the linearization of at , since is a linear approximation to . Using (4), we obtain
We can compute
The first term is given by
The second term is
We could also see that this integral is zero since the function is antisymmetric (odd) about the midpoint of the interval .
Using the Integral Mean Value Theorem (Theorem 2), we can compute
for some . This gives the approximation
The quantity is the basic midpoint rule approximation of . If the interval we’re integrating over is very small, then the error will also be small (as long as the second derivative of is not too large).
The midpoint rule for approximating integrals is the first numerical analysis algorithm we have seen in this class. If we want to approximate the integral of over the interval , then the midpoint rule gives us the approximation , which can be computed easily as long as we have some way to evaluate . This is an example of numerical quadrature, which is the term used for methods to approximate integrals. We will discuss much more about quadrature later in this course.
In the above example, the error scaled like . The width of the interval is , and we considered what happens as the intervals become smaller. We often use the symbol to denote a small parameter, such as the interval width. That makes the following form of Taylor’s Theorem often convenient.
Theorem 3 (Taylor’s Theorem with ).
Suppose that for some . For all , , there is between and such that
Example 3 (Difference approximations of ).
Suppose that for some , and let . Applying Taylor’s Theorem with and , we find that there are and such that
Rearranging the first of these and dividing by gives the forward difference approximation of ,
Similarly, rearranging the second and dividing by gives the backward difference approximation,
In both cases, the error scales like . This means that halving (the distance between the points) gives a result that is about twice as accurate (the error is roughly half).
Instead of picking one direction, we can use the symmetric centered difference approximation,
To study its error, we need a higher-order Taylor polynomial. Now suppose that . Applying Taylor’s Theorem with and , there are and such that
| (5) | ||||
| (6) |
Subtracting (6) from (5), the and terms cancel, and dividing by gives
Now the error scales like . Halving reduces the error by about a factor of four. The centered difference uses the same number of evaluations of as the forward and backward differences, but it is much more accurate when is small.
This is the second example of a basic numerical method that we have seen in this course. If we have a function that we can evaluate, then we can approximate the derivative using two evaluations of . So far, we have seen a method to approximate integrals (quadrature; specifically, the midpoint method), and a method to approximate derivatives (difference quotients, often called finite differences).
Finally, we introduce some notation. Suppose is a quantity of interest that we wish to approximate by . We write to mean that approximates . The signed error of the approximation is and the absolute error is . The relative error is (note that this is not defined if ). The advantage of the relative error is that it is scale invariant, meaning that if both and are scaled by the same nonzero number, then the relative error does not change, as can be seen as follows. Let , and for . Then,