Beruflich Dokumente
Kultur Dokumente
Introduction
Course Contents
Curve fitting
Least square regression
Interpolation
Polynomial Interpolation
Chapter Outline
1.1
Introduction
1.2
1.3
1.4
Errors
Numerical Methods
Numerical Methods:
Algorithms that are used to obtain numerical solution of a
mathematical problem.
Why do we need them?
No analytical solution exists
An analytical solution is difficult to obtain or not practical.
Mathematical Models
Equation that expresses the features of system or process in mathematical
terms.
A mathematical model is a functional relationship of the form
=f
independent
forcing
variables, parameters, functions
Dependent
variable
Mathematical Models
Example :Newtons Second Law of Motion
F=ma
F = net force (kgm/s2 or N)
m = mass of the object (kg)
a = acceleration (m/s2)
6
Mathematical Models
Example :Model for falling parachute,
dv
=
dt
c
g
v
m
F = ma
v=
a=
mg
tanh(
c
with
e x - e-x
tanh (x) = x
e + e-x
Air
Resistance
gc
t)
m
Gravity
Falling Parachutist
8
v(t ) =
68.1* 9.81
9.81* 0.25
tanh(
t)
0.25
68.1
V= 51.6938 m/s
v (t ) = 51.6938 tanh(0.18977 t )
v (0) = 0
v () = 51.6938 m/s
10
dv / dt v / t
v (t i +1 ) v (t i )
c
= g v (t i )
t i +1 t i
m
0.25
v(2)] = 36.4137 m/s
68.1
0.25
v(t )]
68.1
T, sec
V m/s
0.00
19.6200
36.4137
46.2983
50.1802
10
51.3123
12
51.6008
51.6938 12
13
Errors
Why errors are a concern?
15
0
2
4
6
8
10
12
Absolute
Error
(m/s)
0
0.8908
3.3019
4.2221
3.2227
1.8909
0.9833
0
16
17
precise but inaccurate or vice versa. For Example, the radar guns
used by police may measure the speed of five vehicles traveling at
100 km/h as 96, 99, 105, 102, and 103 km/h, while the new laser
speed detectors measure the same speeds as 100 km/h, 100, 99,
100, and 101 km/h. The first set of readings are accurate but not
very precise while the second set of readings are accurate and more
precise.
18
value
Precision (or reproducibility). How close is a computed or measured
value to previously computed or measured values.
Inaccuracy (or bias). A systematic deviation from the actual value.
Imprecision (or uncertainty). Magnitude of scatter.
19
20
Error Definition
True Error
Error
= E=
True Value Approximation
t
Significance: It gives you a feeling of the size of the error but how
significant is the error
Units: The true error will change depending on the units used. The
error of the approximation 2.4 MV of an actual voltage of
2.573243 MV is 0.17 MV, whereas the error of the approximation
2400000 V to an actual voltage of 2573243 V is 170000 V.
21
Error Definition
Relative Error
compare the error relative to the correct value. Thus, we define the
relative error to be the ratio between the true error and the value of
the correct value
t =
Error Definition
If we cannot solve the problem analytically to get the true value, how
to calculate its true error?
We normalize the error to approximate value.
Numerical methods use iterative approach to compute answers. A
present approximation is made on the basis of a previous approximation.
Percent relative error,
Error Definition
Absolute Relative Approximate Error
Stopping Criterion
a s ( percent tolerance )
24
Error Definition
Result is correct/almost exact after the iteration to at least n
s = (0.5 * 10 2-n )%
a s
s =
(0.5 10 2 3 ) =
0.05%
25
Example
ex
x2 x3
xn
=1 + x +
+
+ .... +
n!
2
3!
s =
(0.5 10 2 3 ) =
0.05%
We add terms until a falls below s, for example for x=0.5, then
2
3
n
0.5
0.5
0.5
e0.5 =1 + 0.5 +
,
+
+ .... +
2
3!
n!
(2)
e x (k ) e x (k 1) x k 1 / (k 1)!
.
=
m
x
k
x
e (k )
m=0 m !
m
x
e x =
m=0 m !
m
k is term No
0.51 /1!
100% 0.5
/1.5 33.3%
=
=
m
2
0.5
m =0 m !
Terms
Results
a %
1.5
33.3
1.625
7.69
1.645833333
1.27
1.648437500
0.158
1.648697917
0.0158
26
Significant Figures
Significant digits of a number are those that can be used with confidence,
e.g., the number of certain digits plus one estimated digit.
53,800 How many significant figures?
5.38 x 104
5.380 x 104
5.3800 x 104
3
4
5
27
Significant Figures
Zeros are sometimes used to locate the decimal point not significant
figures.
0.00001753
0.0001753
0.001753
4
4
4
28
29
30
Types of Errors
Overflow: Any number larger than the largest number that can be
round-offs will be made. Each of these plays the role of an input error
for the remainder of the computation, impacting the eventual output.
Algorithms for which the cumulative effect of all such errors are
limited, so that a useful result is generated, are called stable
algorithms. When accumulation is devastating and the solution is
overwhelmed by the error, such algorithms are called unstable.
31
Taylor Series
A mathematical formulation that used widely in numerical methods to
predict a function value in approximate fashion.
32
f ' ' ( xi )
( xi +1 x1 ) 2
2!
and so on
f ' ' ( xi )
( xi +1 xi ) 2
2!
f ( n ) ( xi )
3
xi ) + .......... +
( xi +1 xi ) n + Rn
n!
f ( xi +1 ) f ( xi ) + f ' ( xi )( xi +1 xi ) +
+
( 3)
( xi )
( xi +1
3!
where Rn
is a remainder term
33
34
35
36
f ' ' ( xi )
( xi +1 x1 ) 2
2!
and so on
f ' ' ( xi )
( xi +1 xi ) 2
2!
f ( n ) ( xi )
3
xi ) + .......... +
( xi +1 xi ) n + Rn
n!
f ( xi +1 ) f ( xi ) + f ' ( xi )( xi +1 xi ) +
+
( 3)
( xi )
( xi +1
3!
where Rn
is a remainder term
37
f n + 1 ( )
( xi + 1 x1 )n + 1
( n + 1)!
Rn = O( hn +1 )
f ' ' ( xi ) 2
f ( xi +1 ) f ( xi ) + f ' ( xi ) h +
h
2!
f ( 3) ( xi ) 3
f ( n ) ( xi ) n
+
h + .......... +
h + Rn
3!
n!
38
series expansion.
However, R=O(hn+1), (n+1)th order, the order of truncation error is
hn+1.
O(h), halving the step size will halve the error.
O(h2), halving the step size will quarter the error.
39
Example
Use Taylor Series to approximate f(x) = cos(x) at xi =/4 on the basis
of value of xi+1 = /3
The correct value f ( / 3) = 0.5
Zero-order approximation is f( /3) f(/4) = 0.707106781
& relative error
t
0.5 0.707106781
=
100% 41.4%
0.5
First-order approximation is
f ( / 3) cos( / 4) + (- sin(/4) (/3 - /4) = 0.521986659
t = 4.41%
40
Example
Use Taylor Series to approximate f ( x) = Cos x at xi = / 4
on the basis of value of xi +1 = / 3
Order
n
f ( n ) ( x)
f ( / 3)
Cos x
0.707106781
-41.4
-Sin x
0.521986659
-4.4
-Cos x
0.497754491
0.449
Sin x
0.499869147
0.0262
Cos x
0.500007551
-0.00151
-Sin x
0.500000304
-0.0000608
-Cos x
0.499999988
0.00000244
41