UCES
Course: Methods and Analysis in UCES
Applied Area: probability, heat diffusion, differential equations
Model: Taylor polynomials, Error as a function of the degree
Assessment: higher order error estimates for numerical integration, derivatives, differential equations
Prerequisites:
Objectives:
General Information: In the previous sections in this chapter we have stressed first and second order algorithms. The order of these methods were a consequence of the mean value and extended mean value theorems. The purpose of this lecture is to show how one can extend these concepts to nth order schemes, provided the functions have a sufficient number of continuous derivatives.
Contact Person: R. E. White, NCSU, white@math.ncsu.edu
Revision Date: 8-3-94
Copyright ©1994, R. E. White. All rights reserved.
In previous sections we learned two ways to form polynomial
approximation of complicated functions: Lagrange interpolation by
requiring
We have also made approximations based on the mean value and extended value theorems. The second form of the mean value theorem's conclusion is
The extended mean value theorem concludes
for some c between a and x, provided f''(x) is continuous on [a,b]. Here we view f(x) as being approximated by a first order polynomial
In order to extend this to a quadratic polynomial, we need to extend the mean value theorems.
The extended mean value result follows in a natural manner from integration by parts and the integral form of the mean value theorem.
In order to extend this, apply integration by parts to the integral in the second line, and again apply the integral form of the mean value theorem.
Thus, for some c between x and a and provided the third derivative is continuous,
This gives us a quadratic polynomial approximation of f(x)
This process can be continued provided there are a enough continuous derivatives.
We will present here and return later in the assessment section three applications of Taylor polynomials to higher order numerical methods of integration, derivatives and numerical solution of differential equations.
Application to Probability. The normal probability distribution involves the exponential function evaluated at a quadratic. The probability that an outcome of an experiment is between a and b is given by
is the standard deviation and µ is the mean. If
the mean score of a chemistry exam is 500 and the standard deviation is 100,
find the probability that a random student's score is between 450 and 550.
This leads to the following integral
We could use a numerical integration method. Also, we can approximate the integrand by a Taylor polynomial and integrate it. What are the errors is such approximations?
Application to Heat Diffusion. Fourier's heat law states that the amount of heat flowing through a surface is proportional to the product of change in time, surface area and the derivative of the temperature. The means the heat coming in and out of small segment of a wire can be approximated by
t KAux (x + h) -
t KAux (x).
In the numerical calculations both derivatives will be approximated by finite differences
t KA(ui+1 - ui )/h -
t KA(ui-1 - ui )/h.
What are the size of the errors when one numerically approximates the derivatives ux and uxx ?
Application to Differential Equations. One advantage of the second order accurate Euler-Trapezoid method for numerical solution of differential equations is increased accuracy with the same mesh size. In order to establish this, we used the extended mean value theorem. This suggests that higher order approximations of the solution might generate better methods. We will be more precise later and will illustrate a fourth order accurate method for Newton's law of cooling.
The two versions of the mean value theorem gave error estimates for constant
and linear polynomial approximations that satisfied
Definition. The nth degree Taylor polynomial is
Example. Let f(x) = ex and a = 0.
Also inspection of the graphs indicates that the approximations get better as the degree increases. These give reasonable approximation of f(x) provided x is "near" a = 0. If we are interested in the approximation for larger, say x near 10, then we should choose a = 10:
![]() |
| Figure: exp(x), 1, 1 + x, 1 + x + x2 /2 |
Example. Let f(x) = cos(x) and a = 0. It is easy to see that
![]() |
| Figure: cos(x), 1, 1 - x2 /2, 1 - x2 /2 + x4 /24 |
The following very important theorem will allow us to estimate the errors as a function of n and a. It can be viewed as an extension of the mean value theorems.
Taylor Polynomial Error Theorem. If f(i)(x) for i=0,1,...,n+1 are continuous [a,b], then for each x in [a,b] there is some c between a and x such that
Moreover, if Mn+1 = max |f(n+1) (x)| where x is in [a,b], then
Mn+1 /(n+1)!
|x - a|n+1.
Proof. This proof is similar to the extended mean value theorem and uses the integral form of the mean value theorem. As in the extended mean value theorem continue to do the integration by aparts to obtain
By the integral form of the mean value theorem there is some c between a and x such that
Example. Estimate the error for the third degree Taylor polynomial
approximation of ex on [0,1]. So, n = 3 and choose a = 0 so that
M3+1/(3+1)!
|x - 0|3+1 < 3/24 |x|4 < 1/8.
If x is in the interval [0,.5], then the error would be bounded by (1/8)(1/16).
In the above we were given n and asked to estimate the error. Often the error tolerance is given, and one must find n so that the error is less than this tolerance. Find n so that the error for the above approximation will be less than 10-6 .
| |Error| | Mn+1/(n+1)!
|x - a|n+1 |
e1/(n+1)!
|x|n+1 | |
| < 3/(n+1)! < 10-6. |
Thus, we need to choose n so that 3 106 < (n+1)! By trial computations n = 9 works.
The evaluation of Taylor polynomials is straightforward. The following algorithm attempts to avoid any extra calculations. In most cases, it is the evaluation of the derivatives that is most costly. The reader should consider some of the Maple procedures for doing derivatives. Also the coefficients are computed and stored. There are other types of approximations which have the form of quotients of polynomials, and they vary according to the interval the variable is in.
choose n, a and x sumtp = f(a) ifac = 1 xi = 1 for i = 1, n ifac = ifac*i xi = xi*(x - a) ai = f(i)(a)/ifac sumtp = sumtp + ai*xi endloop.
Maple has some very nice symbolic procedures than can significantly reduce the amount of paper work in dealing with Taylor series. Below we illustrate the Maple procedures series, int, convert and evalf.
Maple Procedures for Taylor Polynomials.
> p6:=series(exp(-x*x/2),x=0,6);
> p8:=series(exp(-x*x/2),x=0,8);
> I8:=int(p8,x);
> Ip8:=convert(I8,polynom);
> evalf(subs(x=.5,Ip8)) - evalf(subs(x=0,Ip8));
We now return to the three applied problems and show how the Taylor polynomials can be used to develop higher order numerical schemes.
Higher Order Numerical Integration. Consider the probability integral
Let P3 (x) be the Taylor polynomial for ex with a = 0.
Now consider
The error in the integration is estimated by
So, the integration error is small and we can have confidence in the approximate answer of
Higher Order Numerical Derivatives. The second
order derivative has a second order accurate finite difference approximation
provided the fourth order derivative in continuous. More precisely, we can
show for
Apply the error theorem with n = 4, a replaced by x and x replaced by
Add these two equations and divide by h2 to get
Higher Order Numerical Solution Differential
Equations. Consider the differential equation
Since u is a solution of the differential equation, one can compute the higher order derivatives by using the chain rule
If f(t,u) is complicated, then these calculations will become costly. However, for simpler cases it is very powerful.
Consider the Newton's law of cooling where
| u(t + h) = u(t) + | f(u(t)) h + (-c)1 f(u(t)) h2 /2 + (-c)2 f(u(t)) h3 /6 |
| + (-c)3 f(u(t)) h4 /24 + (-c)4 f(C) h5 /120. |
This suggests the following algorithm
Since the error in Taylor's theorem is of order 5, the discretization error might have an error of order 4. This is the case provided the solution has 5 continuous derivatives.
| K (h = 50/K) | Euler Error = E | E/h | Tay. Error = TE | TE/(h4 ) |
| 10 (5.000) | 1.9710 | .3942 | 1.7951 10-5 | .2873 10-7 |
| 20 (2.500) | 0.9664 | .3866 | 0.1084 10-5 | .2775 10-7 |
| 40 (1.250) | 0.4786 | .3829 | 0.0066 10-5 | .2703 10-7 |
| 80 (0.625) | 0.2382 | .3811 | 0.0004 10-5 | .2621 10-7 |
x))1/2 . Use problem
two to approximate the integral.