0% found this document useful (1 vote)
1K views10 pages

Math 130 Numerical Solution To Ce Problems

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

MATH 130 NUMERICAL SOLUTION TO CE PROBLEMS

PRELIM

LESSON 2.1: ERRORS

DESIRED LEARNING OUTCOMES:


1. To understand the concept of error
2. To know the effective use of numerical methods

I. INTRODUCTION

Numerical Methods yield approximate results, results that are close to the exact analytical
solution. We cannot exactly compute the errors associated with numerical methods.
- Only rarely given data are exact, since they originate from measurements. Therefore,
there is probably error in the input information.
- Algorithm itself usually introduces errors as well
- The output information will then contain error from both of these sources.

Definition of Terms:

Numerical errors arise from the use of approximation to represent exact mathematical operations
and quantities.

Round-off errors result when numbers having limited significant figures are used to represent
exact numbers

Truncation errors is the discrepancy introduced by the fact that numerical methods may employ
approximations to represent exact mathematical operations and quantities.

Accuracy refers to how closely a computed or measured value to the true value.

Precision refers to how closely individual computed or measured values to previously computed
or measured values

Inaccuracy (also called bias) is defined as systematic deviation from the actual (true) value.

Imprecision (also called uncertainty), refers to the magnitude of the scatter.


Figure 3.2 Concepts of accuracy and
precision

Significant figure

Number of significant figures indicates precision. Significant digits of a number are those that
can be used with confidence

Example: 7.84 x 10^4 – 3 SF = 78,400 = 7.840x10^4 4-SF = 7.8400 x10^4 5-SF


0.0001988 - 4 SF

II. ERROR CONCEPTS

Relationship between the exact, or true, result and the approximation can be formulated
as:

True value = approximation + error

Rearranging:

Et = true value – approximation


Et exact value of the error (true error)

true error
True fractional relative error =
true value

can also be express as:

εt = true error x 100% ( true percent relative error)


true value

For numerical methods, the true value will be known only when we deal with functions that can
be solved analytically (simple systems). In real world applications, we usually not know the true
answer a priori. For these situations, an alternative is to normalize the error using the best
available estimate of the true value. Then,

εa = approximate error x 100%


approximation

Certain numerical methods use an iterative approach to compute answers. A present


approximation is made on the basis of a previous approximation.

εa = Current approximation – previous approximation x 100% (+ / - )


Current approximation

computations is repeated until

εa < εs
if the following criterion is met, we can assured that the result is correct to at least n significant
figures

εs = (0.5 x 102-n)%

Example 3.2. in mathematics, functions can be often represented by infinite series. Example, the
exponential function can be computed using:

𝑥2 𝑥3 𝑥𝑛
ⅇ𝑥 = 1 + 𝑥 + + …+
2 3! 𝑛!
Thus, as more terms are added in sequence, the approximation becomes a better and better
estimate of the true value ⅇ 𝑥 . Starting with the simplest version, ⅇ 𝑥 = 1, add terms one at a time
to estimate ⅇ 0.5 . after each term is added, compute the true and approximate percent relative
errors εa and εt, respectively. Note that the true value is ⅇ 0.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.

Solution:

εs = (0.5 x 102-3)% = 0.05%


Thus, we add terms to the series until εa falls below this level. The first estimate is simply equal to
𝑥2 𝑥3 𝑥𝑛
ⅇ 𝑥 = 1 + 𝑥 + 2 + 3! … + 𝑛! With a single term. Thus, the first estimate is equal to 1. The
second estimate is then generated by adding the second term, as in

ⅇ𝑥= 1 + x

Or for x = 0.5,

ⅇ 0.5 = 1 + 0.5 = 1.5

Thus true percent relative error

εt = 1.648721−1.5
1.648721
x 100%

= 9.02%

Thus approximate estimate error

εa = 1.5−1
1.5
x 100% = 33.3%

Because εa is not less than the required value εs, we would continue the computation by adding
another term x2/2! And repeating the error calculations. The process is continued until εa < εs.
In summarized form,
Thus, after six terms are included, the approximate error falls below εs = 0.05% and the
computation is terminated. However, rather than three significant figures, the result is accurate to
five! That is, they ensure that the result is at least as good as they specify.

III. ROUND-OFF ERRORS

Numbers such as π, e, √7 cannot be expressed by a fixed number of significant figures.


Because computers use a base-2 representation, they cannot precisely represent certain
exact base-10 numbers.

Number system is merely a convention for representing quantities. Decimal or base-10 is


number system we are most familiar with. A base is the number used as the reference for
constructing the system. Base-10 system uses the 10 digits – 0, 1 to 9 – to represent
numbers.

Numbers on the computer are represented with a binary, or base-2 system.


The most straightforward approach, called the signed magnitude method, employs the fi rst bit of
a word to indicate the sign, with a 0 for positive and a 1 for negative. The remaining bits are used
to store the number. For example, the integer value of 2173 would be stored on a 16-bit
computer, as in Fig. 3.6.

Fractional quantities are typically represented in computers using floating-point form. The
number is expressed as a fractional part, called mantissa or significand, and an integer part,
called an exponent or characteristic, as in

m•be

where m – mantissa, b = the base of the number system being used, and e = the exponent.
For instance, the number 156.78 could be represented as 0.15678 x 10 3 in a floating-point
base-10 system.

Floating-point representation allows both fractions and very large numbers to be expressed on
the computer.

IV. TRUNCATION ERRORS

Truncation errors are those that result from using an approximation in place of an exact
mathematical procedure.

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. A useful way to gain insight into Taylor series is to
build it term by term. For example,

f(xi+1) >= f(xi)

This relationship, called the zero-order approximation 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.
However, if the function changes at all over the interval, additional terms of the Taylor series are
required to provide a better estimate. For example, the first-order approximation is developed by
adding another term to yield

f (xi+1) >= f (xi) + f ‘(xi)(xi+1 - xi) (4.3)

The additional first-order term consists of a slope f (xi) multiplied by the distance between
xi and xi+1. Thus, the expression is now 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.
Therefore, a second-order term is added to the series to capture some of the curvature that the
function might exhibit:

𝑓"(𝑥𝑖)
f (xi+1) >= f (xi) + f ‘(xi)(xi+1 - xi)+ (xi+1 - xi)2 (4.4)
2!

In a similar manner, additional terms can be included to develop the complete Taylor series
expansion: It is often convenient to simplify the Taylor series by defining a step size h = xi+1 - xi
and expressed as:
𝑓"(𝑥𝑖) 𝑓3 (𝑥𝑖) 𝑓𝑛 (𝑥𝑖)
f (xi+1) = f (xi) + f ‘(xi)h + h2 + h3 + …. hn + Rn (4.7)
2! 3! 𝑛!

where the remainder term is expressed as:

𝑓(𝑛+1)(𝜉)
Rn = hn+1
(𝑛+1)!
𝜉 is a value of x that lies between xi and xi+1

Example:

PROBLEM: Use zero through fourth-order Taylor series expansions to approximate the function

𝑓 (𝑥 ) = −0.1𝑥 4 − 0.5𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2

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 (in figure 4.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

The Taylor series approximation with n = 0 (using eq. 4.2)


𝑓 (xi + 1) ≅ 1.2
Thus, as in above figure, the zero-order approximation is a constant. Using this formulation
results in a truncation error of

Et = true value – approximation

Et = 0.2 - 1.2 = -1.0

At x = 1.
For n=1, the first derivative must be determined and evaluated at x = 0:

𝑓′(𝑥 ) = −0.4𝑥 3 − 0.45𝑥 2 − 1.0𝑥 − 0.25


𝑓′(0) = −0.4(0)3 − 0.45(0)2 − 1.0(0) − 0.25
= -0.25

Therefore, the first-order approximation is (using eq. 4.3)

f (xi11) = 1.2 - 0.25h


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 (in Fig.4.1). this
results in a reduction of the truncation error to

Et = 0.2 - 0.95 = 0.75

For n = 2, the second derivative is evaluated at x = 0:

𝑓′′(0) = −1.2(0)2 − 0.9(0) − 1.0(0)


= - 1.0

𝑓"(𝑥𝑖)
Therefore, according to eq. 4.4 (f (xi+1) >= f (xi) + f ‘(xi)(xi+1 - xi) + (xi+1 - xi)2 )
2!
f (xi+1) = 1.2 - 0.25h - 0.5h2

and substituting h=1, f(1) = 0.45. the inclusion of the second derivative now adds some
downward curvature resulting in an improved estimate. The truncation errors 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:

𝑓 (𝑥 ) = −0.1𝑥 4 − 0.5𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2

Where the remainder term is


𝑓(𝑛+1)(𝜉)
Rn = hn+1
(𝑛+1)!

𝑓5 (𝜉)
Rn = h5
5!
=0

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:

𝑓 (1) = −0.1(1)4 − 0.5(1)3 − 0.5(1)2 − 0.25(1) + 1.2

V. ASSIGNMENT N0. 3

INSTRUCTION: Write your solution in 1 whole coupon bond (any size). Write your name,
course and section at the upper left; date at upper right and title (Assignment No. 1) at center top.
All solution must be hand written and submit it through LMS Moodle / Canvas Platform.
(Deadline will be 1st week after posting of this lesson)

1. Convert the following base-2 numbers to base-10: a) 101101, b) 101.011 and c) 0.01101
2. Convert the following base-8 numbers to base-10: 71,263 and 3.147
3. Use zero- through third-order Taylor series expansions to predict f (3) for
f (x) = 25x3 - 6x2 + 7x - 88
using a base point at x = 1. Compute the true percent relative error εt for each
approximation.

Congratulations you completed the Lesson, you can now proceed to


Lesson 3.

You might also like