0% found this document useful (0 votes)
44 views

Lecture - 3

This document discusses truncation errors that occur when using numerical approximations rather than exact mathematical procedures. It introduces the Taylor series as a way to express functions in an approximate polynomial form. The Taylor series allows predicting a function value at one point based on its value and derivatives at another point. Higher-order terms in the Taylor series capture more curvature and improve the approximation, with the complete series yielding an exact result. The remainder term accounts for neglected higher-order terms.

Uploaded by

OK DUDE
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Lecture - 3

This document discusses truncation errors that occur when using numerical approximations rather than exact mathematical procedures. It introduces the Taylor series as a way to express functions in an approximate polynomial form. The Taylor series allows predicting a function value at one point based on its value and derivatives at another point. Higher-order terms in the Taylor series capture more curvature and improve the approximation, with the complete series yielding an exact result. The remainder term accounts for neglected higher-order terms.

Uploaded by

OK DUDE
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Meng 2054

Numerical Methods for Engineers

Lecture – 3
Truncation Errors and the Taylor Series

By; Dawit K.
Department of Mechanical Engineering
Jimma Institute of Technology

Dept. of Mechanical Engineering, JIT 1


3.1. Introduction
 Truncation errors are those that result from using an approximation in
place of an exact mathematical procedure.
 For example, in Lecture. 1 we approximated the derivative of velocity of a
falling parachutist by a finite-divided-difference equation of the form

 A truncation error was introduced into the numerical solution because


the difference equation only approximates the true value of the
derivative.
 In order to gain insight into the properties of such errors, we now turn
to a mathematical formulation that is used widely in numerical methods
to express functions in an approximate fashion—the Taylor series.
3.2. The Taylor Series
 the Taylor series provides a means to predict a function value at one
point in terms of the function value and its derivatives at another point.
 In particular, the theorem states that any smooth function can be
approximated as a polynomial.
1. the zero-
zero-order approximation
 Is given by the first term in the series:
 indicates that the value of f at the new point is the same as its value at
the old point.
 This result makes intuitive sense because if xi and xi+1 are close to each
other,
 it is likely that the new value is probably similar to the old value.
 provides a perfect estimate if the function being approximated is, in fact,
a constant.
2. the first-
first-order approximation
 is developed by adding another term to yield

 The additional first-order term consists of a slope f ’(xi) multiplied by


the distance between xi and xi+1.
 the expression is in the form of a straight line and is capable of
predicting an increase or decrease of the function between xi and xi+1.
 Although Eq. (4.3) can predict a change, it is exact only for a straight-
line, or linear, trend.
3. second-
second-order approximation
 a second-order term is added to the series to capture some of the
curvature that the function might exhibit:
4. the complete Taylor series expansion
 Is developed by adding additional terms, in a similar manner

 is an infinite series, an equal sign replaces the approximate sign that was
used in Eqs. (4.2) through (4.4).
 A remainder term is included to account for all terms from n + 1 to
infinity:

 where
 the subscript n connotes that this is the remainder for the nth-order
approximation and
 ξ is a value of x that lies somewhere between xi and xi+1.
5. the complete simplified Taylor series
 Is obtained by defining a step size h = xi+1 − xi
 Expressed as:

 where the remainder term is now

Example
 Use zero- through fourth-order Taylor series expansions to approximate
the function
 from xi = 0 with h = 1. That is, predict the function’s value at xi+1 = 1.
Solution.
 Because we are dealing with a known function, we can compute values
for f (x) between 0 and 1.
 The results (Fig. 3.1) indicate that the function starts at f (0) = 1.2 and
then curves downward to f (1) = 0.2.
 Thus, the true value that we are trying to predict is 0.2.
zero-
zero-order approximation
 The Taylor series approximation with n = 0 is f(xi+1) ~= 1.2
 Thus, as in Fig. 3.1, the zero-order approximation is a constant.
 Using this formulation results in a truncation error of Et = 0.2 − 1.2 =−1.0
at x = 1.
firs-
firs-order approximation
 For n = 1, the first derivative must be determined and evaluated at x = 0:
FIGURE 3.1
The approximation of f (x) =−0.1x4 − 0.15x3 − 0.5x2 − 0.25x + 1.2 at x =1 by zero-order,
first-order, and second-order Taylor series expansions.
 Therefore, the first-order approximation is:

 which can be used to compute f (1) = 0.95.


 Consequently, the approximation begins to capture the downward
trajectory of the function in the form of a sloping straight line (Fig. 3.1).
 This results in a reduction of the truncation error to Et = 0.2 − 0.95
=−0.75
second-
second-order approximation
 For n = 2, the second derivative is evaluated at x = 0:

 Therefore

 and substituting h = 1, f (1) = 0.45.


 The inclusion of the second derivative now adds some downward
curvature resulting in an improved estimate, as seen in Fig. 3.1.
 The truncation error is reduced further to 0.2 − 0.45 =−0.25.
 Additional terms would improve the approximation even more.
 In fact, the inclusion of the third and the fourth derivatives results in
exactly the same equation we started with:

 where the remainder term is

 because the fifth derivative of a fourth-order polynomial is zero.


 Consequently, the Taylor series expansion to the fourth derivative yields
an exact estimate at xi+1 = 1:
3.3. The Remainder for the Taylor Series Expansion
 Suppose that we truncated the Taylor FIGURE 3.2
series expansion after the zero-order Graphical depiction of a zero-order
term to yield Taylor series prediction and remainder.

 A visual depiction of this zero-order


prediction is shown in Fig. 3.2.
 The remainder, or error, of this
prediction, which is also shown in the
illustration, consists of the infinite
series of terms that were truncated:
 It is obviously inconvenient to deal with the remainder in this infinite
series format.
 One simplification might be to truncate the remainder itself, as in

 Although lower-order derivatives usually account for a greater share of


the remainder than the higher-order terms,
 this result is still inexact because of the neglected second- and higher-
order terms.
 An alternative simplification that transforms the approximation into an
equivalence is based on a graphical insight.
 As in Fig. 3.3, the derivative mean-value theorem states that if a function
f (x) and its first derivative are continuous over an interval from xi to
xi+1, then there exists at least one point on the function that has a slope,
designated by f ’(ξ), that is parallel to the line joining f (xi) and f (xi+1).
 The parameter ξ marks the x value FIGURE 3.3
where this slope occurs (Fig. 3.3). Graphical depiction of the derivative
mean-value theorem.
 A physical illustration of this theorem
is that, if you travel between two
points with an average velocity, there
will be at least one moment during
the course of the trip when you will
be moving at that average velocity.
 By invoking this theorem it is simple
to realize that, the slope f ’(ξ) is
equal to the rise R0 divided by the
run h, or
f ’(ξ) = Ro/h
 which can be rearranged to give:
R0 = f ‘(ξ )h
 Thus, we have derived the zero-order version of the remainder.
 The higher-order versions are merely a logical extension of the reasoning
used to derive the above Eqn..
 The first-order version is

 For this case, the value of ξ conforms to the x value corresponding to


the second derivative that makes the above Eqn. exact.
3.4. Using the Taylor Series to Estimate Truncation Errors
 Her we will see how the Taylor series expansion can actually be applied
to numerical methods.
 Recall the example of the falling parachutist.
 the objective was to predict velocity as a function of time.
 That is, we were interested in determining v(t).
 v(t) can be expanded in a Taylor series:

 Now let us truncate the series after the first derivative term:

 The above equation can be solved for


 The first part of the above Eqn. is exactly the same relationship that was
used to approximate the derivative in Example 1.2.
 However, because of the Taylor series approach, we have now obtained
an estimate of the truncation error associated with this approximation of
the derivative.
 Using the remainder Eqn. of complete Taylor series expansion and the
above Eqn. yields
Or

 Thus, the first part of Eqn. has a truncation error of order ti+1 − ti.
ti.
 In other words, the error of our derivative approximation should be
proportional to the step size.
 Consequently, if we halve the step size, we would expect to halve the
error of the derivative.
 Example: The Effect of Nonlinearity and FIGURE 3.4
Plot of the function f (x) = xm
Step Size on the Taylor Series
for m = 1, 2, 3, and 4.
Approximation
 Given the plot of the function f(x) = xm
for m = 1, 2, 3, and 4 over the range from
x = 1 to 2. for m = 1 the function is linear,
and as m increases, more curvature or
nonlinearity is introduced into the
function.
 Employ the first-order Taylor series to
approximate this function for various
values of the exponent m and the step
size h.
 The given function can be approximated by a first-order Taylor series
expansion, as in

 which has a remainder

You might also like