Professional Documents
Culture Documents
Numerical Methods - Exercises: Introductory Lecture
Numerical Methods - Exercises: Introductory Lecture
Relative error
xx x
x x
Definition of errors
Estimation of errors
Usually we write
x x x x 1
Error of basic arithmetic operations
Let f x, y x y.
Using eqs. (1) and (2) we obtain
absolute and relative error of addition and subtraction
x y x x y y
x y x y
x y x y x x y y
Solution:
Estimations of absolute errors of x and y are
ε(x)= ε(y)=0,5.10-5.
Then | Δ(x-y)| <= 10-5= ε(x-y).
Let f x, y xy .
Then the absolute and relative errors of multiplication are
xy x y
xy y x x y
xy x y
Let f x, y x / y.
Then the absolute and relative errors of division are
x 1
x x / y x x y
x 2 y
y y y x/ y x y y
Exercise 1.2:
Suppose that z=1,23456 is approximation of numbers ζ obtained by rounding this
number to 5 decimal places.
Determine the estimation of errors of [z/(x-y)], where x and y are numbers from
Exercise1.1
Solution:
From Exercise 1.1 we already know the error of denominator.
We also know, that ε(z)=0,5.10-5.
To obtain estimation of error, we just have to do substitution :
z 1 z
z x y
x y x y x y
2
1 1 5 1, 23456 105
10 2, 2 10 2
0, 00024 2 0, 000242
Whereas the input values x, y and z have error of order 10-5, the result has error
of order 10-2!
One should avoid subtracting two nearly equal numbers!
Propagation of errors
3.55 x 2.73
8.24 + 5.33
124.53 - 124.52
4.27 x 3.13
base 2
p precision p 1
emin , emax exponent range emin 0 emax
Suppose that the number of digits kept in computer is p. Assuming p=3, add 1,24
and 0,0221.
Solution:
(a + b) + c ≠ a + (b + c)
a = 6.31 x 101, b = 4.24 x 100, c = 2.47 x 10-1
Exercises:
2. Computation of integral
n0
Exercise 1.4
n0
Solution:
Since sum corresponds to geometric series with common ratio q=0,9, we can
calculate value of the summation as s = 1/(1-0.9) = 10. Partial sums will be
computed using two different approaches:
sk 1 0,9 0,92 0,9k forward summation,
p x x 2 x 1150
in point x = 33. Let‘s 100
x x .
3
Conditionality of numerical problems and numerical stability of algorithms
p x x 2 x 1150
100
in point x = 33. Let‘s x x .
3
Solution:
Problem is ill-conditioned.
Functional analysis
Metric space
A metric space is an ordered pair ( X , d ) where X is a set and
d is a metric on X , such that for any x, y, z X , the following
holds:
1. d ( x, y ) 0 2. d ( x, y ) 0 x y 3. d ( x, y ) d ( y , x )
4. d ( x, z ) d ( x, y ) d ( y, z )
Convergence: If there is some distance esuch that
no matter how far you go out in the sequence,
you can find all subsequent elements which are closer to
the limit than e
x, y M d F x , F y d x, y ; 0,1
d ( , xn1 ) d F ( ), F ( xn1 ) d ( , xn )
[d ( , xn ) d ( xn , xn1 )] d ( , xn1 ) d ( , xn )
d ( xn , xn1 ) (1 )d ( , xn )
1
d xn , xn1 d , xn
5 yx f ( x) 0 f ( x) x3 9 x 2 26 x 24
g ( x3 ) 4 g ( x) x g ( x) f ( x) x
g ( x2 ) 3 g ( x) x3 9 x 2 27 x 24
g ( x1 ) 2
g ( x1 ) x1
1
g ( x2 ) x2 fixed points
1 2 3 4 5 6 g ( x3 ) x3
x1 x2 x3
d y1 , y2
1
d x1 , x2
so the derivative of g ( x) must be from interval 1 g '( x) 1
6
g ( x) x3 9 x 2 27 x 24
1 2 3 4 5 6