0% found this document useful (0 votes)
108 views16 pages

Ch. 4 Roundoff and Truncation Errors

This chapter discusses roundoff and truncation errors in numerical methods. It defines accuracy as how closely an approximation agrees with the true value, and precision as how closely approximations agree with each other. Roundoff errors occur due to limitations of representing numbers digitally in computers. Truncation errors occur because exact formulations are approximated. Taylor series can be used to estimate truncation errors. The chapter provides examples of estimating values using Taylor series expansions and calculating errors.

Uploaded by

Fh H
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views16 pages

Ch. 4 Roundoff and Truncation Errors

This chapter discusses roundoff and truncation errors in numerical methods. It defines accuracy as how closely an approximation agrees with the true value, and precision as how closely approximations agree with each other. Roundoff errors occur due to limitations of representing numbers digitally in computers. Truncation errors occur because exact formulations are approximated. Taylor series can be used to estimate truncation errors. The chapter provides examples of estimating values using Taylor series expansions and calculating errors.

Uploaded by

Fh H
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Chapter 4 Roundoff and Truncation Errors

CHAPTER OBJECTIVES
The primary objective: Major sources of errors in numerical methods.
Specific objectives:
1. Understanding about accuracy and precision.
2. Quantify error.
3. Error estimation to decide when to terminate an iterative calculation.
4. Understanding how roundoff errors occur (Limitation of digital computers to represent numbers).
5. Recognizing that truncation errors occur (Exact mathematical formulations are represented by
approximations.)
6. Knowing how to use the Taylor series to estimate truncation errors.
7. Understanding how to write forward, backward, and centered finite-difference approximations of
first and second derivatives.
8. Recognizing that efforts to minimize truncation errors can sometimes increase roundoff errors.

4.1.1 Accuracy and Precision


Accuracy:
How closely an approximation agrees with the true value.

Precision:
How closely individual approximation agree with each other approximation.

FIGURE 4.1
An example from marksmanship illustrating the concepts of accuracy and precision:
(a) inaccurate and imprecise, (b) accurate BUT imprecise, (c) inaccurate BUT precise, and (d) accurate AND
precise.
4.1.2 Error Definitions

This error do the order of magnitude of the error.


For example
Case A Case B
Error of 1 cm Error of 1 cm
Tower height Pipe diameter
The design height is 300 m The design is 1 cm diameter
The real tower is 299.99 m The real pipe is 2 cm diameter
There is 1 cm error There is 1 cm error

Conclusion: Conclusion:
The 1 cm error is considered a small an acceptable The 1 cm error is considered BIG and UNACCEPTABLE
error. error.

Case A Case B
Error of 1 cm Error of 1 cm
Tower height Pipe diameter
The design height is 300 m The design is 2 cm diameter
The real tower is 299.99 m The real pipe is 1 cm diameter
There is 1 cm error There is 1 cm error

Conclusion: Conclusion:
The 1 cm error is considered BIG and
error. UNACCEPTABLE error.

Stopping criterion
Chapter 4 Roundoff and Truncation Errors

EXAMPLE 4.1 Error Estimates for Iterative Methods


Problem Statement. In mathematics, functions can often be represented by infinite series. For example, the
exponential function can be computed using:

Thus, as more terms are added in sequence, the approximation becomes a better and better estimate of the
true value of ex. Equation (E4.1.1) is called a Maclaurin series expansion.
Starting with the simplest version, ex = 1, add terms one at a time in order to estimate e0.5. After each new
term is added, compute the true and approximate percent relative errors with Eqs. (4.3) and (4.5),
respectively. Note that the true value is e0.5 = 1.648721 . . . . Add terms until the absolute value of the
approximate error estimate a falls below a prespecified error criterion s conforming to three significant
figures (n = 3).

Solution.
True value of e0.5 = 1.648721
Stopping criterion

Term Approximation Status

1st - Next

2nd Next

3rd Next

4th Next

5th Next

STOP
4.2 ROUNDOFF ERRORS

Example:

4.3 TRUNCATION ERRORS


4.3.1 The Taylor Series

Taylor theorem states that:


any smooth function can be approximated as a polynomial.

Complete Taylor series expansion

2nd term 4th term


1st order 3rd order

1st term 3rd term


Zero order 2nd order

2nd term 4th term


1st order 3rd order

1st term 3rd term


Zero order 2nd order

h: Distance or difference between xi and xi+1.


EXAMPLE 4.3 Approximation of a Function with a Taylor Series Expansion
Problem Statement. Use Taylor series expansions with n = 0 to 6 to approximate f (x) = cos x at xi+1
the basis of the value of
f(x) and its derivatives at xi

Approximate using Taylor series expansions with n = 0 to 6

Taylor series expansion

n = 0 to 6

Order

6
Chapter 4 Roundoff and Truncation Errors

PROBLEMS
4.10 The following infinite series can be used to approximate ex:

(a) Prove that this Maclaurin series expansion is a special case of the Taylor series expansion
(Eq. 4.13) with xi = 0 and h = x.
(b) Use the Taylor series to estimate f(x) = e x at xi+1 = 1 for xi = 0.25. Employ the zero-, first-,
second-, and third-order

Solution
(a) The Taylor series expansion

Thus, the Taylor series

Become

For

We get

It is proven.
(b) Taylor series

True value

Order

3
4.11 The Maclaurin series expansion for cos x is

Starting with the simplest version, cos x = 1, add terms one at a time to estimate .
After each new term is added, compute the true and approximate percent relative errors.
Use your pocket calculator or MATLAB to determine the true value. Add terms until the
absolute value of the approximate error estimate falls below an error criterion conforming
to two significant figures.

True value

Order Status

1 Next

2 Next

3 STOP
Chapter 4 Roundoff and Truncation Errors

PROBLEMS
4.12 Perform the same computation as in Prob. 4.11, but use the Maclaurin series

Solution

True value

Order Status

1 Next

2 STOP
4.13 Use zero- through third-order Taylor series expansions to predict f (3) for

using a base point at x = 1. Compute the true percent relative error t for each
approximation.

Solution
The Taylor series expansion

True value

Order

3
4.15 Use zero- through fourth-order Taylor series expansions to predict f(2) for f(x) = ln x
using a base point at x = 1. Compute the true percent relative error t for each
approximation. Discuss the meaning of the results.

Solution
The Taylor series expansion

True value

Order

3
4

The error decrease very slowly


4.18 If |x|< 1 it is known that

Repeat Prob. 4.11 for this series for x = 0.1.

Solution

True value

Order Status

1 Next

2 Next

3 STOP
Chapter 4 Roundoff and Truncation Errors

PROBLEMS
4.19 To calculate a planet s space coordinates, we have to solve the function

Let the base point be a = xi Determine the highest-order Taylor


series expansion resulting in a maximum error of 0.015 on the specified interval. The error is
equal to the absolute value of the difference between the given function and the specific
Taylor series expansion. (Hint: Solve graphically.)

Solution
Determine the highest-order Taylor series.
Maximum error of 0.015.

In Taylor series, increase in difference, h, will increase the error.

The largest error will be at the end of the interval, which is

Find the derivatives

True value

Order Taylor series Error < 0.015

1
2

The highest-order Taylor series expansion with maximum error of 0.0099 is the 4th order.

4.3.4 Numerical Differentiation


Taylor series expansion

By removing reminder, we get


EXAMPLE 4.4 Finite-Difference Approximations of Derivatives
Problem Statement. Use forward and backward difference approximations of O(h) and a
centered difference approximation of O(h2) to estimate the first derivative of

at x = 0.5 using a step size h = 0.5. Repeat the computation using h = 0.25. Note that the
derivative can be calculated directly as

and can be used to compute the true value as f

Solution
Use forward difference

You might also like