Professional Documents
Culture Documents
9/18/2017 1
GEM 501E
9/18/2017 2
Error Analysis and
Interpolation
9/18/2017 3
Approximate Numbers
a0 : exact value
a : approximate value (Ex: 1/3 and 0.33)
a a0 a
is the absolute error of a
9/18/2017 4
Approximate Numbers
In the error analysis the relative error may be
defined as follows:
a
a
A0
, A0 0
Relative error is related with the number of
significant (meaningful) digits. For the previous
example:
0.0045 %0.45
0.0926
a
20.7426
9/18/2017 5
Significant Digits
The absolute error of a number, which is
correctly given, cannot be larger than the
half of the value of the last digit.
9/18/2017 6
Absolute errors (uncertainties)
0.02 e0.005
3.1245 e0.00005
2.8 e0.05
5.0 e0.05
2. e0.5
123 not defined
9/18/2017 7
Arithmetic operations with
approximate numbers
The absolute error of the sum (or difference) of
multiple approximate numbers is the sum of the
absolute error of each number
S a1 a2 an
s a1 a2 an
If all ais have the same sign, the relative error of the
sum S (s) cannot be larger than the largest of the
relative errors of these terms:
min ai s max ai , i 1,2,, n
9/18/2017 8
Arithmetic operations with
approximate numbers
The relative error of the difference of two positive
numbers is larger than the relative errors of these
numbers
z m x n y
9/18/2017 9
Errors in the calculation of function values
Relative error:
f ( x)
y x ln f ( x) x
f ( x)
9/18/2017 10
Errors in the calculation of function values
9/18/2017 11
Errors in the calculation of function values
Besides these rounding errors other rounding errors
can occur due to the use of binary system.
This can be partly minimised with the use of double
precision in the computational analyses.
9/18/2017 12
Errors in the calculation of function
values
Example
If the uncertainties in y and a are given as 0.1 and
1, respectively, calculate the absolute error of the
function, f=y cos(a) for y=3.0 and a=40 (degrees).
n
f
1deg=0.017rad y x
i 1 xi
i
9/18/2017 13
Conditionedness in Functions
Let us define the maximum relative change in a function f(x) due to a small
change in the value of x:
Example:
co
9/18/2017 14
Conditionedness in Functions
Example:
If f(x)=ex cox (What does this mean?)
Example:
around = 1 it is ill-
conditioned
9/18/2017 15
Numerical Instability
Numerical instability is a measure of how a rounding error is effective on the
result of a calculation.
Example:
Let us perform the calculation with 6-digit arithmetic
Caution: The co of the function is around 0.5. This can be validated by assigning
an arbitrary value to x. However, we are not dealing with this but the effect of
the rounding in the mathematical operations on the result!
If we treat the function as F(t)=a-t, when ta, the result goes to zero. The
conditionedness of the function F(t) can be obtained as |t/t-a)|. When t a the
conditionedness goes to infinity which means that a small change in t will make
a large difference in the result.
9/18/2017 16
Truncation errors
Arises from the use of finite series instead of
infinite ones
Infinite: Finite:
9/18/2017 17
Truncation errors
Let us recall Taylor expansion and error formula
i 0 i!
f n 1
Rn x x x0
n 1
; x0 x or x x0 ;
n 1 !
9/18/2017 18
Discretisation Errors
GCI (grid convergence index)
>1.3 is advised.
9/18/2017 19
Discretisation Errors
GCI (grid convergence index)
The extrapolated values can be calculated.
9/18/2017 20
Discretisation Errors
GCI (grid convergence index)
Sample Calculations
9/18/2017 21
INTERPOLATION
Exact Approaches
9/18/2017 22
INTERPOLATION
-Exact Approaches-
The problem is to find a P(x) function that exactly
satisfies the values of f(x) at the discrete points xi
(P(xi)=f(xi)).
9/18/2017 23
INTERPOLATION
-Exact Approaches-
Basically, the exact approaches have three
different versions:
Newtons divided-difference polynomials
Lagrange polynomials
Finite-difference polynomials (for equidistant
nodes)
9/18/2017 24
INTERPOLATION
-Exact Approaches-
-Divided-difference polynomials-
o f x Pn x Rn x
o Pn x f x0 x x0 f x1 , x0 x x0 x x1 f x2 , x1 , x0
x x0 x x1 x x2 f x3 , x2 , x1 , x0
x x0 x x1 x xn 1 f xn , xn 1 , , x1 , x0
o Rn x x x0 x x1 x xn f x, xn , xn 1 , , x1 , x0
x0 x xn
n f n 1
Rn x x xi , x, xn , xn 1 , , x0
o
i 0 n 1 !
9/18/2017 25
INTERPOLATION
-Exact Approaches-
-Divided-difference polynomials-
f x1 f x0
o
f x1 , x0 f x0 , x1
x1 x0
f x2 , x1 f x1 , x0
o f x2 , x1 , x0 f x1 , x0 , x2 f x0 , x2 , x1
x2 x0
o f x , x , , x f xn , xn 1 , , x1 f xn 1 , xn 2 , , x1 , x0
n 1
xn x0
n 0
9/18/2017 26
INTERPOLATION
-Exact Approaches-
-Lagrange Polynomials-
f x Pn x Rn x
n
Pn x Li x f xi
i 0
Li x
x x0 x x1 x xi 1 x xi 1 x xn
xi x0 xi x1 xi xi 1 xi xi 1 xi xn
L x
xx
n
j
i
x x
j 0 i j
f n 1
j i
n
Rn x x xi , x, x0 , x1 , , xn
i 0 n 1 !
9/18/2017 27
INTERPOLATION
-Exact Approaches-
-Lagrange Polynomials-
Lagrange polynomials are in fact obtained from divided-
difference polynomials. For example:
P2 x f x0 x x0 f x1 , x0 x x0 x x1 f x2 , x1 , x0
P2 x
9/18/2017 28
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials-
Forward differences
Backward differences
Central differences
9/18/2017 29
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials - Forward Differences-
E f xi f xi h f ( xi 1 )
f x f xi 1 f xi
The relationship with the shift
operator and the forward
difference operator is defined
E 1
n n in this manner.
9/18/2017 30
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials - Forward Differences-
f x Pn x Rn x
with
x x0
h
1 1 2 1 2 n 1
Pn f 0 f 0 2 f 0 3 f 0 n f 0
2! 3! n!
n
!
Pn x0 h i f 0
i 0 i !i!
1 2 n 1 2 n
Rn x0 h h n 1 f ( n 1) ( ) n 1 f 0
n 1! n 1!
9/18/2017 31
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials Backward Differences-
E f xi f xi h f ( xi 1 )
1 E
n
1 n operator is defined in
this manner.
9/18/2017 32
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials Backward Differences-
f x Pn x Rn x
with
x x0
h
1 1 2 n 1
Pn f 0 f 0 2 f0 n f0
2! n!
f n 1
Rn 1 n h n 1 ; x n x0
(n 1)!
n ( f 0 )
Rn 1 n
(n 1)!
9/18/2017 33
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials Central Differences-
E f xi f xi h f ( xi 1 )
9/18/2017 34
INTERPOLATION
-Exact Approaches-
-Finite-Difference Polynomials Central Differences-
Different formulations may be used.
For instance, by using Gauss forward central difference polynomial:
f x Pn x Rn x
with
x x0
h
1 1 1
f f x0 f x0 h 2 f x0
2
3 f x0 h 2
2! 3!
n ( f1/ 2 )
Rn 1 (n 1) n is even
(n 1)!
n ( f 0 )
Rn 1 1 (n 1) n is odd
(n 1)!
9/18/2017 35
INTERPOLATION
- Approximate Approaches- Least Squares
The squares of the error should be calculated:
2
N 2 N
n
E Pn xi f xi a j xi f xi
j
i 0 i 0 j 0
The coefficients aj of the polynomial that makes the error minimum is to
be found:
E
0
a j
9/18/2017 36
INTERPOLATION
- Piecewise Approaches- Spline Interpolation
Third-order polynomials are to be
produced for all sections
(hi=ti+1-ti)
and we obtain:
9/18/2017 37
INTERPOLATION
- Piecewise Approaches- Spline Interpolation
An equation system is obtained and the second derivatives zis can be
found.
9/18/2017 38