Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

1.

1 Measuring Errors
A. Introduction to errors
1. Numerical method-is a method a numerical method is a
mathematical tool designed to solve numerical problems.
Here we use approximation that’s why we are prone to
committing errors
 Types of Errors
A. True Error ( Et )
B. Relative True Error ( Et )
C. Approximate Error ( Ea )
D. Relative Approximate Error ( Ea )
_________________________________________________________________________

1.1 True Error ( Et )-The difference between the expected


value and the obtained value of the variable
Et =Expected Value− Approximate value
Et =x E −x a
Example:
Given the function f(x)=7e0.5x calculate the true error
in approximating f’(2) at h=0.3
' f ( x +h )−f (x )
f ( x )=
h
f’(2) at h=0.3
' f ( 2+ 0.3 )−f (2)
f ( 2 )=
0.3
' f ( 2.3 )−f (2)
f ( 2 )=
0.3
0.5 (2.3 ) 0.5 (2)
' 7e −7 e
f ( 2 )=
0.3
' 22.107−19.028
f ( 2 )=
0.3
f ( 2 ) ≅ 10.2646 “APPROXIMATE VALUE”
'
The exact value can be calculated using derivatives.
' 0.5 x ' 0.5x ' 0.5x
f ( x )=7 e f ( x )=7 × 0.5× e f ( x )=3.5 e

So, the true value of f’(2) is:


f ' ( x )=3.5 e 0.5x f ' ( x )=9.5140 “EXACT VALUE”

True Error is calculated as:


Et =Expected Value− Approximate value Et =9.5140−10.2646
Et =−.07506 “TRUE ERROR”
Et =|−0.7506|
Et =0.75 06 “ABSOLUTE TRUE ERROR”
Et =0.7506 ×100
Et =75 .06 % “PERCENT TRUE ERROR”
1.2 Relative True Error ( Et )- is a measure of the
uncertainty of measurement compared to the size
of the measurement.
Expected Value−Approximate value x −x
Et = Et = E a
Expected Value xE
Example:
Given the function f(x)=7e0.5x calculate the true error
in approximating f’(2) at h=0.3
f ' ( 2 ) ≅ 10.2646 “APPROXIMATE VALUE”
f ( x )=9.5140 “EXACT VALUE”
'

x E −x a
Et =
xE
9.5140−10.2646
Et =
9.5140
Et =−0.78894 “RELATIVE TRUE ERROR”
Et =0.78894 “ABSOLUTE RELATIVE
TRUE ERROR”
Et =78.894 % “PERCENT RELATIVE
TRUE ERROR”

1.3 Approximate Error- Often times the true value is


unknown to us, especially in numerical computing.
In this case we will have to quantify errors using
approximate values only. When an iterative
method is used, we get an approximate value at the
end of each iteration. The approximate error (Ea) is
defined as the difference between the present
approximate value and the previous approximation
(i.e. the change between the iterations).

Approximate Error ( Ea )= present approximation – previous approximation


Ea =x new−x old
Approximate Error
Relative approximate error=
present approximation
xa
Ea =
x new
Example:
Given the function f(x)=7e0.5x calculate the true error
in approximating f’(2) at h=0.3 and then f’(2) at h=0.5
then evaluate
a) Approximate error
' f ( x +h )−f (x )
f ( x )=
h
f’(2) at h=0.3
f ( 2+ 0.3 )−f (2)
f ' ( 2 )=
0.3
' f ( 2.3 )−f (2)
f ( 2 )=
0.3
0.5(2.3 ) 0.5 (2)
' 7e −7 e
f ( 2 )=
0.3
' 22.107−19.028
f ( 2 )=
0.3
f ( 2 ) ≅ 10.2646 “PREVIOUS
'

APPROXIMATION”
' f ( x +h )−f (x )
f ( x )=
h
f’(2) at h=0.5
NOTE: The lower the value of ‘h’
the better our approximation is.
' f ( 2+ 0.5 )−f (2)
f ( 2 )=
0.5
' f ( 2.5 )−f (2)
f ( 2 )=
0.5
0.5(2.5 ) 0.5 (2)
7e −7 e
f ' ( 2 )=
0.5
' 24.432−19.028
f ( 2 )=
0.5
f ( 2 ) ≅ 9.6639 “PRESENT
'

APPROXIMATION”
Ea =x new−x old
Ea =9.6639−10.2646 Ea =−6307

b) Relative approximate error


xa
Ea =
x new
−6307
Ea = E =−0.0653
9.6639 a
2.0 Maclaurin Series
Transcendental Algebraic
function Function
Definition: Definition:
transcendental an algebraic
function is an function is
analytic a function that can
function that be defined as
does not satisfy a the root of
polynomial a polynomial
equation equation.
Logarithm polynomial function
exponential (with rational function
any non-trivial base)
trigonometric
hyperbolic
functions
We need to convert the transcendental function f(x)
to a polynomial function P(x).

ASSUMPTIONS:
f(0), f’(0), f’’(0), f’’’(0),…,fn(0) – known values

First Trial:
P(x) is an approximation of
First condition: f(0)=P(0)
the value of f(x) therefore
we can assume that
Example:
f(x)=5 f(x)=5
f(0)=5

-f(0) is constant or a
Second Trial: Function: coefficient.
Condition: P(x)=f(0)+f’(0)x
-Well put f’(0)x so
f(x)=P(x) P(0)= f(0) + f’(0)(0) =0
we could get f’(x).
f’(x)=P’(x) P(0)= f(0)
P’(x)=f(0)+f’(0)x
P’(0)=f(0)+f’(0)x -derivative of a
P’(0)=0+f’(0) constant f(0) is

Third Trial: Function:


f(x)=P(x) P(x)=f(0)+f’(0)x+½f’’(0)x2
f’(x)=P’(x) P(0)= f(0) + f’(0)(0)+ ½f’’(0)
f’’(x)=P’’(x) (0)2
P(0)= f(0)
P’(x)=f(0)+f’(0)x+½f’’(0)x
P’(0)= 0 + f’(0)+ f’’(0)(x)
P’(0)= 0 + f’(0)(0)+ f’’(0)(0)
P’’(0)= 0+ f’’(0)
P’(0)= f’(0)
P’’(0)= f’’(0)

Fourth Trial:
f(x)=P(x)
f’(x)=P’(x)
f’’(x)=P’’(x)
f’’’(x)=P’’’(x)
Function:
1 1
P(x)=f(0)+f’(0)x+ 2 f’’(0)x2+ 3∙ 2 f’’’(0)x3

1 1
P(0)=f(0)+f’(0)(0)+ 2 f’’(0)(0)2+ 6 f’’’(0)(0)3

P(0)=f(0)

2 1
P’(0)=f(0)+f’(0)+ 2 f’’(0)(x)2+ 6 f’’’(0)(x)3
2 1
P’(0)=f(0)+f’(0)+ 2 f’’(0)(0)2+ 6 f’’’(0)(0)3

P’(0)=f’(0)

Notice that there is a pattern in our function:


EXPANDED
1 1
P(x)=f(0)+f’(0)x+ 2 f’’(0)x2+ 3∙ 2 f’’’(0)x3
1 1 1 1
P(x)=f(0)+f’(0)x+ 2 f’’(0)x2+ 3∙ 2 f’’’(0)x3+ 4 ∙ 3 ∙2 fIV(0)x4+ 5∙ 4 ∙3 ∙ 2
n n
5 f (0) x
f (0)x +
V
n!

NOTATION FORM
∞ n n
f ( 0) x
P ( x )=∑
n=0 n!

Example#2
Find the Maclaurin series for:
f(x)=sin(x) x=0
f(x) ≅ P(x)

1 1 1 1
P(x)=f(0)+f’(0)x+ 2 f’’(0)x2+ 3∙ 2 f’’’(0)x3+ 4 ∙ 3 ∙2 fIV(0)x4+ 5∙ 4 ∙3 ∙ 2
f n (0) x n
f (0)x +
V 5
n!
When n=0 When n=1 When n=2
f(x)=sin(x) f(x)=sin(x) f'(x)=cos(x)
f(x)=sin(0) f'(x)=cos(x) f''(x)=-sin(x)
f''(x)=-sin(0)
f(x)=0 f'(x)= cos(0)
f''(x)=0
f'(x)=1

When n=3 When n=4 When n=5


f''(x)=-sin(x) f'''(x)=-cos(x) fIV(x)=-sin(x)
f'''(x)=-cos(x) fIV(x)=sin(x) fV(x)=cos(x)
f'''(x)=-cos(0) fIV(x)=sin(0) fV(x)=cos(0)
f'''(x)=-1 fIV(x)=0 fV(x)=1
When n=6 When n=7 When n=8
fV(x)=cos(x) fVI(x)=-sin(x) fVII(x)=-cos(x)
fVI(x)=-sin(x) fVII(x)=-cos(x) fVIII(x)=sin(x)
fVI(x)=-sin(0) fVII(x)=-cos(0) fVIII(x)=sin(0)
fVI(x)=0 fVII(x)=-1 fVIII(x)=0
Pattern: 0,1,0,-1,0,1,0,-1,0,
0, 1, 0, -1, 0, 1

1 1 1 1
P(x)=f(0)+f’(0)x+ 2 f’’(0)x2+ 3∙ 2 f’’’(0)x3+ 4 ∙ 3 ∙2 fIV(0)x4+ 5∙ 4 ∙3 ∙ 2
f n (0) x n
f (0)x +
V 5
n!

x 3 x5 x 7 x 9 x 11
sin ( x ) ≅ x− + − + − +… EXPANDED FORM
3 ! 5 ! 7! 9 ! 11 !

You might also like