Vous êtes sur la page 1sur 6

ERRORS AND APPROXIMATIONS

When a computational procedure is involved in solving scientific-mathematical problem errors will be


often involved in the process.
Floating Point: In computing, floating point is a method of representing an approximation of a real
number in a way that can support a trade off between range and precision. A number is, in general,
represented approximately to a fixed number of significant digits and scaled using an exponent; the base
for the scaling is normally two, ten, or sixteen. A number that can be represented exactly is of the
following form:

significant base exp onent


Example: 1.2345 12345 104

Floating point operations lack several math properties.


Floating point operations are commutative
They are not associative or distributive:
Floating point addition is not associative

2
2
2
2
2
2
Example: 5.72 10 4.65 10 6.19 10 5.72 10 4.65 10 6.19 10

2
2
2
As LHS: 5.72 10 4.65 10 6.19 10

10.37 102 6.19 102


1.04 103 6.19 102 1.66 103
2
2
2
RHS: 5.72 10 4.65 10 6.19 10

5.72 102 10.84 102


5.72 102 1.084 103 1.65 103
Floating point multiplication is not associative
The distributive law between multiplication and addition does not necessarily hold.
Example: If a + b = a, then b 0 may not true for floating point operations.

Machine epsilon: Machine epsilon gives an upper bound on the relative error due
to rounding in floating point arithmetic. This value characterizes computer
arithmetic in the field of numerical analysis, and by extension in the subject of
computational science. The quantity is also called macheps or unit roundof, and
it has the symbols Greek epsilon
Error: It is the deviation in a true value to the approximate value.
Types of errors:
Absolute errors: If X is the true value of a quantity and X ' is its approximate value, then

'
Absolute error E a X X
Relative error: If X is the true value of a quantity and X ' is its approximate value, then

Relative error E r

X X'
X

Percentage error: If X is the true value of a quantity and X ' is its approximate value, then
Percentage error E p

X X'
100
X

Classification of errors:
Inherent errors: These errors are already present in statement of a problem before its solution. Such
error arises due to given limitations of the calculators or the computers. This error can be minimized
by taking the good data by high precision computational aids.

Rounding errors: These errors are arises from the process of rounding off the numbers during the
computation.
Rules of round off: To round off a number upto nth significant digits
If n 1 digit is less than 5, then no change in nth digit.
th

If n 1 digit is greater than 5, then ad one in nth digit.


th

If n 1 digit is exactly 5, then if nth digit is even then unchanged otherwise add one in nth
digit.
Truncation errors: These errors are caused by using approximate results or on replacing an infinite
process by a finite one.
Example: A number 3.5236 gives 3.524 which is a roundoff upto 3 decimal place whereas the truncation
upto 3 decimal place gives 3.523
th

Question: Round off the numbers 865250 and 37.46235 to four significant figures and compute E a , E r
, E p in each case.
Solution:
a) Number rounded off to four significant figures 865200
Absolute error Ea X X 1 865250 865200 50
Relative error Er

X X'
50

5.778 105
X
865250

X X'
100 5.778 103
X
b) Number rounded off to four significant figures 37.46
Absolute error Ea X X 1 37.46253 37.46 0.00253

Percentage error E p

Relative error Er

X X'
0.00235

6.27 105
X
37.46235

Percentage error E p

X X'
100 6.27 103
X

Error in approximation of a function: Let y f x1 , x 2 be function of two variables x1 , x2 . If


x1 , x 2 be the error in x1 , x2 respectively then the error in y is y is given by

y y f x1 x1 , x 2 x 2

f
f
f x1 , x 2 x1
x 2

x2
1


x1

x 2
2!
x1
x 2

f
f
y x1
x 2
x1
x 2
y
y
x1
x 2
x1
x 2

Relative error E r

y x1 y x 2 y

y
y x1
y x 2

f x1 , x 2 higher deg ree terms of x1 , x 2

(by Taylors series expansion)


(higher degree terma are zero)

In general the error y in the function y f x1 , x 2 , x3 ,......x n corresponding to the errors xi in xi


(i=1,2n) is given by
y
y
y
y x1
x 2
............. x n
x1
x 2
x n
Question: If u

4x 2 y 3
and errors in x, y , z be 0.001, compute the relative maximum error in
z4

when x y z 1

2 2
u 8 xy 3 u 12 x y u
16 x 2 y 3

,
4 ,

y
z4
x
z
z
z5
u
u
u
u x y z
x
y
z
3
2 2
8 xy
12 x y
16 x 2 y 3
4 x

z
z
z4
z5
Since x, y , z may be positive or negative, we take the absolute values of the terms on the right side,

Solution: Since

which gives

u max

8 xy 3
12 x 2 y 2
16 x 2 y 3

z
z4
z4
z5

8 0.001 12 0.001 16 0.001 0.036


Hence the maximum relative error

u max
u

0.036
0.009
4

Error in series approximation: Taylors series for f x at


f x f a x a f a x a f ' a

where Rn x

x a
2!

xa

f ' ' a ..........

x a n

f n , a x ,
n!
If the series is convergent, Rn x 0 as

with a remainder after n terms is

x a n 1
n 1!

n 1

a Rn x

and hence if f x is approximated by the first n terms


of this series, then the maximum error will be given by the remainder term Rn x
Question: Find the number of terms of the exponential series such that their sum gives the value of e x
correct to six place of decimal at x 1
x
Solution: We have e 1 x

Where Rn x

x 2 x3
x n 1
..........
R x
2! 3!
n 1 ! n

xn
e , 0 x
n!

Hence maximum absolute error (at x )

xn x
xn
e and the maximum relative error
n!
n!

1
n!
For six decimal places at x 1 , we have
1 1 6
10 or n ! 2 106 which gives n 10
n! 2
Hence Er max at x 1 is

Hence we need 10 terms of the series in order that its sum is correct to six places of decimal.
Theorems:

If the first significant figure of a number is r and the number is correct to n significant figures, then
the relative error is less than

Er

1
r 10n 1

If the relative error of any number is not greater than


significant figures.

Er

1
then the number is certainly correct to n
2 10n

1
2 10n

If a number is correct to n decimal places, then error

Ea

1
2 10n

If X A is the approximate value of X after truncation to m digits, then

X T X A 10n m
If X A is the approximate value of X after truncation of X after m digits, then

XT X A
10 m1
XT
If X A is the approximate value of X after rounding off to m digits, then

X T X A 0.5 10n m
If X A is the approximate value of X after rounding off to m digits, then

X T X A 0.5 10n m
Propagation of error:: Let e n represents the growth of error after n steps of a computation process,
then
If e n n , growth of error is linear
n
If e n , growth of error is exponential.
If 1 , the exponential error grows indefinitely as n
If 0 1 , exponential error decreases to zero.
Errors in Quadrature Formulas:
Trapezoidal rule:
Expand y f x around x x0 by Taylors series, we get

y y0 x x0 y

'
0

x0 h

ydx

x0

y0 h

x0 h

x0

x x0

y0'' ...........

2!

y0 x x0 y

'
0

x x0

2!

y0'' ........... dx

h 2 ' h3 ''
y0 y0 ...........
2!
3!

For x x0 h and y y1 , we have y1 y0 hy0'

h 2 '' h3 '''
y0 y0 ...........
2!
3!

1
h y0 y1
2

h2
h2 '
h3 ''
y0 y0 hy0' y0'' ........... hy0
y0
y0 .......
2!
2!
2.2!

Area of first trapezium in the interval x0 , x1 is A1

1
h
2

Hence error in the interval x0 , x1

x1

ydx A

x0

1 3 ''
h3 ''
1

h
y

.......

y0 ..........
0

12
3! 2.2!
h3 ''
Hence the error in x0 , x1 is
y0
12
h3 ''
Similarly error in x1 , x2 is
y1 and so on.
12
h3
The total error E y0'' y1'' ...... yn'' 1
12
''
''
''
''
Assuming that y X is the largest of n quantities y0 , y1 ,......, yn 1 , we have

b a h y '' X
nh3 ''
E
y X

12
12
2

Hence the error in trapezoidal rule is of order h 2

1
rule:
3
Expand y f x around x x0 by Taylors series, we get
Simpsons

y y0 x x0 y

'
0

x0 2 h

ydx

x0

x0 2 h

x0

x x0

2!

y0 x x0 y

y0'' ...........
'
0

x x0

2!

y0'' ........... dx

4h 2 ' 8h3 '' 16h 4 ''' 32h5 iv


y0
y0
y0
y0 ...........
2!
3!
4!
5!
h 2 '' h3 '''
For x x0 h and y y1 , we have y1 y0 hy0'
y0 y0 ...........
2!
3!
2
4h '' 8h3 '''
For x x0 2h and y y2 , we have y2 y0 2hy0'
y0
y0 ...........
2!
3!
1
Area of first trapezium in the interval x0 , x2 is A1 h y0 4 y1 y 2
3
2


1
h
4h 2 '' 8h3 '''
h y0 4 y0 hy0' y0'' ......... y0 2hy0'
y0
y0 .....

2
2!
2!
3!



4h3 '' 2h 4 ''' 5h5 iv
2hy0 2h 2 y0'
y0
y0
y0 .........
3
3
18
2 y0 h

Hence error in the interval x0 , x2

x2

ydx A

x0

h5
4 5 5 iv
h y0 ....... y0iv
90
15 18
h5 iv
Hence the error in x0 , x2 is
y0
90
h5 iv
Similarly error in x2 , x4 is
y2 and so on.
90
h5 iv
The total error E
y0 y2iv ...... y2iv n 1
90

iv
iv
iv
iv
Assuming that y X is the largest of n quantities y0 , y2 ,......, y2 n 1 we have

b a h y iv X
nh5 iv
E
y0 X

90
180
4

Hence the error in trapezoidal rule is of order h 4


Simpsons

1
rule:
3

In the same procedure we get error in x0 , x3 is

3h5 iv
y
80

Vous aimerez peut-être aussi