Professional Documents
Culture Documents
Amer Rasheed
Lecture 1
Numerical Analysis
Math344, Math541
Course Evaluations
Course Outlines
Recommended Books
Motivations
ex 2x2 + 3 = 0.
How to find integral
Z Z
2
sin xdx, ex dx
Motivations
How to fit a polynomial (function) to given data
How to find rate of change, derivative, in the following data
x y
1 10
2 12
3 15
4 17
5 21
Motivations
d2 y dy
+ y = sin y.
dx2 dx
u 2u
+ k 2 = u3 .
t x
Brief History
Modern Techniques
Error Analysis
Absolute Error and Relative Error
Ep = p p
p p Ep
Rp = = , p 6= 0.
p p
Error Analysis
Absolute Error and Relative Error
Error Analysis
Absolute Error and Relative Error
Lets say that two students measure two objects with a meter stick. One
student measures the height of a room and gets a value of 3.215 me-
ters 1mm (0.001m). Another student measures the height of a small
cylinder and measures 0.075 meters 1mm (0.001m). Clearly, the ove-
rall accuracy of the ceiling height is much better than that of the 7.5cm
cylinder. The comparative accuracy of these measurements can be de-
termined by looking at their relative errors
0.001
Rceiling = 100 = 0.0003%
3.125
0.001
Rcylinder = 100 = 0.01%
0.075
Error Analysis
Absolute Error and Relative Error
|p p| 10d
|p| 2
or
10d
|Rp |
2
Error Analysis
Absolute Error and Relative Error
Truncation Errors
2 x4 x6 x2n
e x = 1 + x2 + + + + + ...
2! 3! n!
might be replaced with the finite number of terms while approximating
2
integral of ex numerically.
Truncation Errors
Given that
Z 1/2
2
ex dx = 0.544987104184 = p, (true value)
0
x4 x6 x8
P8 (x) = 1 + x2 + + +
2! 3! 4!
After calculations, we get
Z 1/2
P8 (x)dx = 0.544986720817 = p , (approx. value)
0
Truncation Errors
since
106
|Rp | = 7.03442 107
2
The approximation p agrees with the true value p to six significant
digits.
dk .dk+1 dk+2 . . .
Example
22
= = 3.142857142857142857
7
Loss of Significance
Loss of Significance
Example 1
Compare the results of calculating f (500) and g(500) using 6-digits
rounding off calculations with the true value 11.174755300747, where
f (x) = x x+1 x
x
g(x) =
x+1+ x
After computations
Loss of Significance
Example 2
Compare the results of calculating f (0.01) and g(0.01) using 6-digits
rounding off calculations with the true value 0.50167084168057542,
where
ex 1 x
f (x) =
x2
1 x x2
g(x) = + +
2 6 24
After computations
Loss of Significance
Example 3
For polynomial evaluations, the rearrangement of terms would
sometimes produce better results
P (x) = x3 3x2 + 3x 1
Q(x) = ((x 3)x + 3) x 1
Use 3-digits rounding arithematic to compute P (2.19) and Q(2.19).
Compare with true value 1.685159.
After computations
Propagation of Errors
p + q = (p + p ) + (q + q )
p + q = (p + q ) + (p + q )
Thus for addition, the error in the sum is the sum of errors of the
addends.
Amer Rasheed (MATH344) Department of Mathematics 26 / 36
Propagation of Errors Error Propagation in Product
Propagation of Errors
Error Propagation in Product
pq = (p + p )(q + q )
pq = p q + p q + q p + p q
pq p q = p q + q p + p q
pq p q p q q p p q
= + +
pq pq pq pq
p q
Suppose that 1, 1 and Rp Rq 0
p q
Propagation of Errors
pq p q p q q p p q
= + +
pq pq pq pq
pq p q q p
= +
pq q p
pq p q
= Rp + Rq (1)
pq
Thus the relative error in the product is the sum of relative errors in p
and q .
Propagation of Errors
Order of Approximation
|f (h) p(h)|
< M, for sufficiently small h
|hn |
or
|f (h) p(h)| < M |hn |
we say that p(h) approximates f (h) with order of approximation O(hn )
and write
f (h) = p(h) + O(hn )
The term O(hn ) is pronounced as oh of hn
Order of Approximation
Properties of O(hn )
Order of Approximation
Theorem
Assume that
Taylors Theorem
Theorem
Assume that f C n+1 [a, b]. If both x0 and x0 + h lie in [a, b]. Then
n
X f k (x0 )
f (x0 + h) = hk + O(hn+1 ).
k!
k=0
Example
Taylors expansion of O(h4 ) about x0 = 0 of ex is
h2 h3
eh = 1 + h + + + O(h4 )
2! 3!
Order of Approximation
Example
h2 h3
eh = 1 + h + + + O(h4 )
2! 3!
h2 h4
cos h = 1
+ + O(h6 )
2! 4!
Determine the order of approximations of their SUM and PRODUCT.
Order of Convergence
The order of convergence of a sequence is analogous to the order of
approximation.
Definition : Assume that lim xn = x and {rn }
n=1 is a sequence with
n
lim rn = 0. We say that {xn }
n=1 converges to x with the order of
n
convergence O(rn ), if there exists a constant K > 0 such that
|xn x|
< K, for sufficiently large n
|rn |
or
|xn x| < K|rn |
This is indicated by writing
xn = x + O(rn )
Order of Convergence
Example
Let
cos n 1
xn = & rn =
n2 n2
As
cos n 1
0 & 0
n2 n2
and
|xn x| cos n/n2
= = | cos n| 1, n
|rn | 1/n2
cos n 1
Thus the sequence 2
converges with O( 2 ).
n n
Amer Rasheed (MATH344) Department of Mathematics 36 / 36