Docsity

Measuring Errors - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Measuring Errors - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Measuring Errors

Why measure errors?

1) To determine the accuracy of numerical

results.

2) To develop stopping criteria for iterative

algorithms.

Example—True Error

The derivative, f^ ′(^ x ) of a function f^ ( x ) can be

approximated by the equation,

h

f x h f x f x

If

x

f x e

  1. 5

( )= 7 and^ h =^0.^3

a) Find the approximate value of f '(^2 )

b) True value of f '(^2 )

c) True error for part (a)

Example (cont.)

Solution:

a) For x^ =^2 and h =^0.^3

f f f

f ( 2. 3 )− f ( 2 )

  1. 5 ( 2. 3 ) 0. 5 ( 2 ) e − e =
= =^10.^263

Relative True Error

• Defined as the ratio between the true error,

and the true value.

Relative True Error ( ∈ t^ ) =^

True Error

True Value

Example—Relative True Error

Following from the previous example for true error,

find the relative true error for

x f x e

  1. 5

( )= 7 at f '(^2 )

with h =^0.^3

Et =− 0. 722

From the previous example,

True Value

TrueError ∈ t =

Relative True Error is defined as

  1. 5140

− 0. 722 = (^) =− 0. 075888

as a percentage,

∈ t =− 0. 075888 × 100 % =− 7. 5888 %

Example—Approximate Error

For

x

f x e

  1. 5

( )= 7 at x^ =^2 find the following,

a) f^ ′(^2 ) using h =^0.^3

b) f^ ′(^2 ) using h =^0.^15

c) approximate error for the value of f^ ′(^2 ) for part b)

Solution:

a) For

h

f x h f x f x

x = 2 and h = 0. 3

f f

f

Example (cont.)

f ( 2. 3 )− f ( 2 )

Solution: (cont.)

  1. 5 ( 2. 3 ) 0. 5 ( 2 ) e − e =

  2. 3

  3. 107 − 19. 028

b) For x^ =^2 and h =^0.^15

  1. 15

( 2 0. 15 ) ( 2 ) ( 2 )

' f f f

  • − ≈

f ( 2. 15 )− f ( 2 )

Relative Approximate Error

• Defined as the ratio between the

approximate error and the present

approximation.

Relative Approximate Error (

Approximate Error

Present Approximation

∈ a ) =

Example—Relative Approximate Error

For

x

f x e

  1. 5

at x^ =^2 , find the relative approximate

error using values from h^ =^0.^3 and h =^0.^15

Solution:

From Example 3, the approximate value of f ′(^2 )=^10.^263

using h^ =^0.^3 and f^ ′(^2 )=^9.^8800 using h =^0.^15

= a E (^) Present Approximation – Previous Approximation

How is Absolute Relative Error used as a

stopping criterion?

If |∈^ a^ |≤∈ s where ∈ s^ is a pre-specified tolerance, then

no further iterations are necessary and the process is

stopped.

If at least m significant digits are required to be

correct in the final answer, then

| | 0. 5 10 %

2 m a

− ∈ ≤ ×

Table of Values

For

x

f x e

  1. 5

at x^ =^2 with varying step size, h

0.3 10.263 N/A 0

h f^ ′(^2 ) a

∈ m