System Oflinear Equations
System Oflinear Equations
System Oflinear Equations
B. Iterative methods
1. Gauss-Jacobi Method
2. Gauss-Seidel Method
3. Relaxation Method
Matrix Decomposition
A. Crout’s / Cholesky’s Method
a11 a12 a13
A a 21 a 22 a 23
a 31 a 32 a 33
A L U
L11 0 0 1 U 12 U 13
L L 21 L32 0 U 0 1 U 23
L31 L32 L33 0 0 1
Matrix Decomposition
B. Doolittle Method
a11 a12 a13
A a 21 a 22 a 23
a 31 a 32 a 33
A L U
1 0 0 U 11 U 12 U 13
L L21 1 0 U 0 U 22 U 23
L31 L32 1 0 0 U 33
Matrix Decomposition
From,
Ax C
After decomposition
LU x C
Let
y U x equation 1
then,
Ly C equation 2
Matrix Decomposition
From the matrix equation 2 evaluate for the variables of
matrix [y] by using forward substitution. Substitute the
values of the matrix [y] to the initial assumption in
equation 1 and determine the values of the unknown
variables in matrix [x] by reverse substitution.
Matrix Decomposition
Example 1: Determine the unknown mesh currents using
Crout’s Method.
-11 = 6 I1 – 2 I2 – 3 I3
12 = –2 I1 + 5 I2 – 2 I3
13 = –3 I1 – 2 I2 + 8 I3
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Example 2: Determine the unknown mesh currents using
Doolittle Method.
-11 = 6 I1 – 2 I2 – 3 I3
12 = –2 I1 + 5 I2 – 2 I3
13 = –3 I1 – 2 I2 + 8 I3
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Iterative Methods
Gauss-Jacobi Method
Steps:
1. Rearrange the order of equations in a manner that the
dominant coefficient for each unknown variable lies in
the main diagonal of the system of linear equations.
2. Obtain the iterative formula for each variable by
transposing the dominant variable and dividing the
equation by the dominant coefficient.
3. Begin the iteration by substituting initial values (0’s) to
the variables and obtain the new values. The process is
repeated by substituting the variables on the next
iteration until the terminating condition is satisfied.
Iterative Methods
Note: Since all variables are within a linear equation then
all variables must satisfy the terminating condition
otherwise continue the iteration.
I
h
f (a) f (b) I
h
f ( x0 ) f ( x1 )
2 2
Numerical Integration
Multiple Application Trapezoidal Rule
One way to further increase the accuracy of the
trapezoidal rule is to divide the integration interval from
a to b into a number of segments and apply the
approximation method to each segment. The areas of
individual segments can then be added to yield the
integral for the entire interval. The resulting equations are
call multiple-application, or composite, integration
formulas.
Numerical Integration
Graphical Depiction
Numerical Integration
There are n + 1 equally spaced base points and
consequently there are n segments of equal width:
ba
h
n
where:
h = equal spacing between segments and discrete points
n = number of segments (trapezoids) with n+1 discrete
data points
b = upper value limit
a = lower value limit
Numerical Integration
In general,
h n 1
I f ( x 0 ) 2 f ( x i ) f ( x n )
2 i 1
b a 0.8 0
h 0.4
n 2
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0) 3 900(0) 4 400(0) 5 0.2
x1 0 0.4 0.4
f ( x1 ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.456
x2 b 0.4 0.4 0.8
f ( x2 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8) 5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) 0.4 0.2 22.456 0.232 1.0688
2 2
Solution
Multiple Application Trapezoidal Rule: at n = 3:
b a 0.8 0
h 0.2667
n 3
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
x1 0.2667
f ( x1 ) 0.2 25(0.2667) 200(0.2667) 2 675(0.2667)3 900(0.2667) 4 400(0.2667)5 1.4327
x2 0.5333
f ( x2 ) 0.2 25(0.5333) 200(0.5333) 2 675(0.5333)3 900(0.5333) 4 400(0.5333)5 3.4872
x3 b 0.8
f ( x3 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) 0.2667 0.2 21.4327 3.4872 0.232 1.3696
2 2
Solution
Multiple Application Trapezoidal Rule: at n = 4:
b a 0.8 0
h 0.2
n 4
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
x1 0.2
f ( x1 ) 0.2 25(0.2) 200(0.2) 2 675(0.2)3 900(0.2) 4 400(0.2)5 1.2880
x2 0.4
f ( x2 ) 0.2 25(0.4) 200(0.4) 2 675(0.4)3 900(0.4) 4 400(0.4)5 2.4560
x3 0.6
f ( x3 ) 0.2 25(0.6) 200(0.6) 2 675(0.6)3 900(0.6) 4 400(0.6)5 3.4640
x4 b 0.8
f ( x4 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) f ( x4 )
2
I
0.2
0.2 21.2880 2.4560 3.4640 0.232 1.4848
2
Solution
Multiple Application Trapezoidal Rule: at n = 6:
b a 0.8 0
h 0.1333
n 6
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
x1 0.1333
f ( x1 ) 0.2 25(0.1333) 200(0.1333) 2 675(0.1333)3 900(0.1333) 4 400(0.1333)5 1.3102
x2 0.2667
f ( x2 ) 0.2 25(0.2667) 200(0.2667) 2 675(0.2667)3 900(0.2667) 4 400(0.2667)5 1.4327
x3 0.4
f ( x3 ) 0.2 25(0.4) 200(0.4) 2 675(0.4)3 900(0.4) 4 400(0.4)5 2.4560
x4 0.5333
f ( x4 ) 0.2 25(0.5333) 200(0.5333) 2 675(0.5333)3 900(0.5333) 4 400(0.5333)5 3.4872
x5 0.6667
f ( x5 ) 0.2 25(0.6667) 200(0.6667) 2 675(0.6667)3 900(0.6667) 4 400(0.6667)5 2.8749
x6 b 0.8
f ( x6 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) f ( x4 ) f ( x5 ) f ( x6 )
2
I
0.1333
0.2 21.3102 1.4327 2.4560 3.4872 2.8749 0.232 1.5703
2
Solution
Multiple Application Trapezoidal Rule: at n = 8:
b a 0.8 0
h 0.1
n 8
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0) 5 0.2
x1 0.1
f ( x1 ) 0.2 25(0.1) 200(0.1) 2 675(0.1) 3 900(0.1) 4 400(0.1)5 1.2890
x2 0.2
f ( x2 ) 0.2 25(0.2) 200(0.2) 2 675(0.2) 3 900(0.2) 4 400(0.2)5 1.2880
x3 0.3
f ( x3 ) 0.2 25(0.3) 200(0.3) 2 675(0.3) 3 900(0.3) 4 400(0.3)5 1.6070
x4 0.4
f ( x4 ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.4560
x5 0.5
f ( x5 ) 0.2 25(0.5) 200(0.5) 2 675(0.5)3 900(0.5) 4 400(0.5) 5 3.3250
Solution
Multiple Application Trapezoidal Rule: at n = 8:
x6 0.6
f ( x6 ) 0.2 25(0.6) 200(0.6) 2 675(0.6)3 900(0.6) 4 400(0.6) 5 3.4640
x7 0.7
f ( x7 ) 0.2 25(0.7) 200(0.7) 2 675(0.7) 3 900(0.7) 4 400(0.7) 5 2.3630
x8 b 0.8
f ( x8 ) 0.2 25(0.8) 200(0.8) 2 675(0.8) 3 900(0.8) 4 400(0.8) 5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) f ( x4 ) f ( x5 ) f ( x6 ) f ( x7 ) f ( x8 )
2
I
0.1
0.2 21.2890 1.2880 2.4560 2.4560 3.3250 3.4640 2.3630 0.232 1.6008
2
Numerical Integration
Truncation Error (Trapezoidal Rule)
(b a) 3
Et 2
f"
12n
h n 1 n2
I f ( x0 ) 4 f ( xi ) 2 f ( x j ) f ( xn )
3 i odd j even
I
0.4
10.256 1.3675
3
Solution
n4
b a 0.8 0
h 0.2
n 4
xi 0;
f ( xi ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
xi 0 0.2 0.2;
f ( xi ) 0.2 25(0.2) 200(0.2) 2 675(0.2) 3 900(0.2) 4 400(0.2)5 1.288
xi 0.2 0.2 0.4;
f ( xi ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.456
xi 0.4 0.2 0.6;
f ( xi ) 0.2 25(0.6) 200(0.6) 2 675(0.6) 3 900(0.6) 4 400(0.6)5 3.464
xi 0.6 0.2 0.8;
f ( xi ) 0.2 25(0.8) 200(0.8) 2 675(0.8) 3 900(0.8) 4 400(0.8)5 0.232
sum 0.2 (4 *1.288) (2 * 2.456) (4 * 3.464) 0.232 24.352
I
0.2
24.352 1.6235
3
Solution
n6
b a 0.8 0
h 0.1333
n 6
xi 0;
f ( xi ) 0.2 25(0) 200(0) 2 675(0) 3 900(0) 4 400(0)5 0.2
xi 0 0.1333 0.1333;
f ( xi ) 0.2 25(0.1333) 200(0.1333) 2 675(0.1333)3 900(0.1333) 4 400(0.1333)5 1.3102
xi 0.1333 0.1333 0.2667;
f ( xi ) 0.2 25(0.2667) 200(0.2667) 2 675(0.2667)3 900(0.2667) 4 400(0.2667) 5 1.4327
xi 0.2667 0.1333 0.4;
f ( xi ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4) 5 2.456
xi 0.4 0.1333 0.5333;
f ( xi ) 0.2 25(0.5333) 200(0.5333) 2 675(0.5333)3 900(0.5333) 4 400(0.5333)5 3.4872
xi 0.5333 0.1333 0.6667;
f ( xi ) 0.2 25(0.6667) 200(0.6667) 2 675(0.6667)3 900(0.6667) 4 400(0.6667) 5 2.8749
xi 0.6667 0.1333 0.8;
f ( xi ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8) 5 0.232
sum 0.2 (4 *1.3102) (2 *1.4327) (4 * 2.456) (2 * 3.4872) (4 * 2.8749) 0.232 36.8361
I
0.1333
36.8361 1.6372
3
Solution
n8
b a 0.8 0
h 0.1
n 8
xi 0;
f ( xi ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
xi 0 0.1 0.1;
f ( xi ) 0.2 25(0.1) 200(0.1) 2 675(0.1)3 900(0.1) 4 400(0.1) 5 1.289
xi 0.1 0.1 0.2;
f ( xi ) 0.2 25(0.2) 200(0.2) 2 675(0.2) 3 900(0.2) 4 400(0.2)5 1.288
xi 0.2 0.1 0.3;
f ( xi ) 0.2 25(0.3) 200(0.3) 2 675(0.3)3 900(0.3) 4 400(0.3)5 1.607
xi 0.3 0.1 0.4;
f ( xi ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.456
Solution
xi 0.4 0.1 0.5;
f ( xi ) 0.2 25(0.5) 200(0.5) 2 675(0.5)3 900(0.5) 4 400(0.5)5 3.325
xi 0.5 0.1 0.6;
f ( xi ) 0.2 25(0.6) 200(0.6) 2 675(0.6) 3 900(0.6) 4 400(0.6)5 3.464
xi 0.6 0.1 0.7;
f ( xi ) 0.2 25(0.7) 200(0.7) 2 675(0.7) 3 900(0.7) 4 400(0.7)5 2.363
xi 0.7 0.1 0.8;
f ( xi ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
sum 0.2 (4 *1.289) (2 *1.288) (4 *1.607) (2 * 2.456) (4 * 3.325) (2 * 3.464) (4 * 2.363) 0.232 49.184
I
0.1
49.184 1.6395
3
Numerical Integration
Truncation Error (Simpson’s 1/3 Rule)
(b a) 5 4
Et 4
f
180n
f ""( x)
0
0.8 0
48000
21600(0.8) (0.8) 2
f ""( x) 2
0.8
f ""( x) 2400
at n 8
b a 0.8 0
5 5
E ( h) 4
f " " 4
(2400) 0.0011
180n 180(8)
I I (h) E (h) 1.6395 0.0011 1.6406
Numerical Integration
Simpson’s 3/8 Rule
In a similar manner the approximation can be improved
by using a third order polynomial function fitting four
discrete points,
b b
I f ( x)dx f 3 ( x)dx
a a
n 3 x a 0 x b 0.8
b a 0.8 0
h 0.2667
n 3
x f ( x)
0 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
0 0.2667 0.2667 0.2 25(0.2667) 200(0.2667) 2 675(0.2667) 3 900(0.2667) 4 400(0.2667)5 1.4327
0.2667 0.2667 0.5333 0.2 25(0.5333) 200(0.5333) 2 675(0.5333)3 900(0.5333) 4 400(0.5333)5 3.4872
0.5333 0.2667 0.8 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
Simpson' s 3 / 8 Rule
I f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
3h
8
30.2667
I (0.2) 3(1.4327) 3(3.4872) (0.232) 1.5192
8
Solution
n 6 x a 0 x b 0.8
b a 0.8 0
h 0.1333
n 6
x f ( x)
0 0.2 25(0) 200(0) 2 675(0) 3 900(0) 4 400(0)5 0.2
0 0.1333 0.1333 0.2 25(0.1333) 200(0.1333) 2 675(0.1333) 3 900(0.1333) 4 400(0.1333) 5 1.3102
0.1333 0.1333 0.2667 0.2 25(0.2667) 200(0.2667) 2 675(0.2667) 3 900(0.2667) 4 400(0.2667)5 1.4327
0.2667 0.1333 0.4 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4) 5 2.456
0.4 0.1333 0.5333 0.2 25(0.5333) 200(0.5333) 2 675(0.5333) 3 900(0.5333) 4 400(0.5333)5 3.4872
0.5333 0.1333 0.6667 0.2 25(0.6667) 200(0.6667) 2 675(0.6667) 3 900(0.6667) 4 400(0.6667) 5 2.8749
0.6667 0.1333 0.8 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
Simpson' s 3 / 8 Rule
I f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) 2 f ( x3 ) 3 f ( x4 ) 3 f ( x5 ) f ( x6 )
3h
8
30.1333
I (0.2) 3(1.3102) 3(1.4327) 2(2.456) 3(3.4872) 3(2.8749) (0.232) 1.6329
8
Numerical Integration
Truncation Error (Simpson’s 3/8 Rule)
(b a ) 5 4
Et 4
f
80n
f ""( x) 0
0.8 0
48000
21600(0.8) (0.8) 2
f ""( x) 2
0.8
f ""( x) 2400
at n 3 a 0 b 0.8
b a 0.8 0
5 5
E ( h) 4
f " " 4
(2400) 0.1214
80n 80(3)
I I (h) E (h) 1.5192 0.1214 1.6405
Solution
f ( x) 0.2 25 x 200 x 2 675 x 3 900 x 4 400 x 5
f ' ( x) 25 400 x 2025x 2 3600 x 3 2000 x 4
f " ( x) 400 4050 x 10800 x 2 8000 x 3
f " ' ( x) 4050 21600 x 24000 x 2
f "" ( x) 21600 48000 x
f ""( x) 0
0.8 0
48000
21600(0.8) (0.8) 2
f ""( x) 2
0.8
f ""( x) 2400
at n 6 a 0 b 0.8
b a 0.8 0
5 5
E ( h) 4
f " " 4
(2400) 0.0076
80n 80(6)
I I (h) E (h) 1.6329 0.0076 1.6405
Numerical Integration
Romberg Integration
Romberg integration is one technique that is designed to
attain efficient numerical integrals of functions. It similar
to the previous technique in a sense, that it is based on
successive application of the trapezoidal rule. However
through mathematical manipulations, accurate results are
attained for less effort.
Richardson’s Extrapolation
It is an error correction technique that is used to
improve the results of numerical integration on the basis
of the integral estimates themselves.
Numerical Integration
The method uses two estimates of an integral to
compute a third integral (more accurate approximation).
The estimate and error associated with a multiple
application trapezoidal rule can be represented generally
as
I I (h) E (h)
Where:
I = the exact value of the integral
I(h) = the approximation from an n-segment application of
the trapezoidal rule with step size (h = (b – a)/n)
E(h) = The truncation error
Numerical Integration
Improved estimate of the integral
I I (h2 )
1
I (h2 ) I (h1 )
2 1
k
Where:
I(h1) = integral estimate at spacing (step size) h1. (less
accurate)
I(h2) = integral estimate at spacing (step size) h2. (more
accurate)
h2 = h1/2 (extrapolation condition)
k = extrapolation order (minimum value of k = 2)
Numerical Integration
Graphical Depiction of Romberg Integration
b a 0.8 0
h 0.4
n 2
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0) 3 900(0) 4 400(0) 5 0.2
x1 0 0.4 0.4
f ( x1 ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.456
x2 b 0.4 0.4 0.8
f ( x2 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8) 5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) 0.4 0.2 22.456 0.232 1.0688
2 2
Solution
Multiple Application Trapezoidal Rule: at n = 4:
b a 0.8 0
h 0.2
n 4
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
x1 0.2
f ( x1 ) 0.2 25(0.2) 200(0.2) 2 675(0.2)3 900(0.2) 4 400(0.2)5 1.2880
x2 0.4
f ( x2 ) 0.2 25(0.4) 200(0.4) 2 675(0.4)3 900(0.4) 4 400(0.4)5 2.4560
x3 0.6
f ( x3 ) 0.2 25(0.6) 200(0.6) 2 675(0.6)3 900(0.6) 4 400(0.6)5 3.4640
x4 b 0.8
f ( x4 ) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) f ( x4 )
2
I
0.2
0.2 21.2880 2.4560 3.4640 0.232 1.4848
2
Solution
Multiple Application Trapezoidal Rule: at n = 8:
b a 0.8 0
h 0.1
n 8
x0 a 0
f ( x0 ) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0) 5 0.2
x1 0.1
f ( x1 ) 0.2 25(0.1) 200(0.1) 2 675(0.1) 3 900(0.1) 4 400(0.1)5 1.2890
x2 0.2
f ( x2 ) 0.2 25(0.2) 200(0.2) 2 675(0.2) 3 900(0.2) 4 400(0.2)5 1.2880
x3 0.3
f ( x3 ) 0.2 25(0.3) 200(0.3) 2 675(0.3) 3 900(0.3) 4 400(0.3)5 1.6070
x4 0.4
f ( x4 ) 0.2 25(0.4) 200(0.4) 2 675(0.4) 3 900(0.4) 4 400(0.4)5 2.4560
x5 0.5
f ( x5 ) 0.2 25(0.5) 200(0.5) 2 675(0.5)3 900(0.5) 4 400(0.5) 5 3.3250
Solution
Multiple Application Trapezoidal Rule: at n = 8:
x6 0.6
f ( x6 ) 0.2 25(0.6) 200(0.6) 2 675(0.6)3 900(0.6) 4 400(0.6) 5 3.4640
x7 0.7
f ( x7 ) 0.2 25(0.7) 200(0.7) 2 675(0.7) 3 900(0.7) 4 400(0.7) 5 2.3630
x8 b 0.8
f ( x8 ) 0.2 25(0.8) 200(0.8) 2 675(0.8) 3 900(0.8) 4 400(0.8) 5 0.232
I
h
f ( x0 ) 2 f ( x1 ) f ( x2 ) f ( x3 ) f ( x4 ) f ( x5 ) f ( x6 ) f ( x7 ) f ( x8 )
2
I
0.1
0.2 21.2890 1.2880 2.4560 2.4560 3.3250 3.4640 2.3630 0.232 1.6008
2
Solution
Summary of Trapezoidal Rule
n h I (h)
1 0.8 0.1728
2 0.4 1.0688
4 0.2 1.4848
8 0.1 1.6008
Solution
Extrapolation Table
n2
I I (h2 )
1
I (h2 ) I (h1 )
2 1
2
y
y=f (x)
f(xi) Approx. derivative
True derivative
xi xi+1
x
Numerical Differentiation
f ( xi 1 ) f ( xi )
f ' ( xi ) m( slope)
xi 1 xi
f ( xi 2 ) 4 f ( xi 1 ) 3 f ( xi )
f ' ( xi )
2h
more accurate version
Numerical Differentiation
Example 12 Estimate the derivative of the function at xi =
0.5 using forward finite divided differences at step sizes h
= 0.5 & h = 0.25 applying the truncated and the more
accurate formula for h = 0.25 step size.
f(x) = – 0.1x4 – 0.15x3 – 0.5x2 – 0.25x + 1.2
Solution
Classical Method:
f ' ( x) 0.4 x 3 0.45 x 2 x 0.25
at xi 0.5
f ' ( x) 0.4(0.5)3 0.45(0.5) 2 0.5 0.25 0.9125
Solution
Forward Divided Difference: (h = 0.5)
xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5)3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1 * h 0.5 1(0.5) 1;
f ( xi 1 ) 0.1(1) 4 0.15(1)3 0.5(1) 2 0.25(1) 1.2 0.2
f ( xi 1 ) f ( x) 0.2 0.925
f ' ( x) 1.45(truncated )
h 0.5
Solution
Forward Divided Difference: (h = 0.25)
xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5)3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1* h 0.5 1(0.25) 0.75;
f ( xi 1 ) 0.1(0.75) 4 0.15(0.75)3 0.5(0.75) 2 0.25(0.75) 1.2 0.6363
f ( xi 1 ) f ( x) 0.6363 0.925
f ' ( x) 1.1548(truncated )
h 0.25
xi 2 xi 2 * h 0.5 2(0.25) 1;
f ( xi 2 ) 0.1(1) 4 0.15(1) 3 0.5(1) 2 0.25(1) 1.2 0.2
f ( xi 2 ) 4 f ( xi 1 ) 3 f ( xi )
f ' ( x)
2h
0.2 4(0.6363) 3(0.925)
f ' ( x) 0.8596(more accurate)
2(0.25)
Numerical Differentiation
Backward Finite Divided Difference
y
y=f (x)
f(xi)
Approx. derivative
True derivative
xi-1 xi
x
Numerical Differentiation
f ( xi ) f ( xi 1 )
f ' ( xi ) m( slope)
xi xi 1
3 f ( xi ) 4 f ( xi 1 ) f ( xi 2 )
f ' ( xi ) more accurate version
2h
Numerical Differentiation
Example 13. Estimate the derivative of the function at xi =
0.5 using backward finite divided differences at step sizes
h = 0.5 & h = 0.25 applying the truncated and the more
accurate formula for h = 0.25 step size.
f(x) = – 0.1x4 – 0.15x3 – 0.5x2 – 0.25x + 1.2
Solution
Backward Divided Difference: (h = 0.5)
xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5)3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1 * h 0.5 1(0.5) 0;
f ( xi 1 ) 0.1(0) 4 0.15(0)3 0.5(0) 2 0.25(0) 1.2 1.2
f ( xi 1 ) f ( x) 1.2 0.925
f ' ( x) 0.55(truncated )
h 0.5
Solution
Backward Divided Difference: (h = 0.25)
xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5) 3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1* h 0.5 1(0.25) 0.25;
f ( xi 1 ) 0.1(0.25) 4 0.15(0.25)3 0.5(0.25) 2 0.25(0.25) 1.2 1.1035
f ( x) f ( xi 1 ) 0.925 1.1035
f ' ( x) 0.714(truncated )
h 0.25
xi 2 xi 2 * h 0.5 2(0.25) 0;
f ( xi 2 ) 0.1(0) 4 0.15(0)3 0.5(0) 2 0.25(0) 1.2 1.2
3 f ( xi ) 4 f ( xi 1 ) f ( xi 2 )
f ' ( x)
2h
3(0.925) 4(1.1035) (1.2)
f ' ( x) 0.878(more accurate)
2(0.25)
Numerical Differentiation
Centered Finite Divided Difference
y
y=f (x)
f(xi)
Approx. derivative
True derivative
xi-1 xi xi+1
x
Numerical Differentiation
f ( xi 1 ) f ( xi 1 )
f ' ( xi ) m( slope)
xi 1 xi 1
thus, the first derivative formula
f ( xi 1 ) f ( xi 1 )
f ' ( xi )
2h
truncated version
f ( xi 2 ) 8 f ( xi 1 ) 8 f ( xi 1 ) f ( xi 2 )
f ' ( xi )
12h
D D(h2 )
1
D(h2 ) D(h1 )
(h1 / h2 ) 1
2
Numerical Differentiation
Thus,
D D(h2 )
1
D(h2 ) D(h1 )
2 1
k
Where:
D(h1) = Derivative estimate at spacing (step size) h1. (less
accurate)
D(h2) = Derivative estimate at spacing (step size) h2.
(more accurate)
h2 = h1/2 (extrapolation condition)
k = extrapolation order (minimum value of k = 2)
Numerical Differentiation
Example 15. Improve the derivative estimate of the
function at xi = 0.5 using Richardson’s extrapolation on
the finite divided differences techniques at step sizes h =
0.5 & h = 0.25
f(x) = – 0.1x4 – 0.15x3 – 0.5x2 – 0.25x + 1.2
Solution
Forward Divided Difference:
h1 xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5) 3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1* h 0.5 1(0.5) 1;
f ( xi 1 ) 0.1(1) 4 0.15(1) 3 0.5(1) 2 0.25(1) 1.2 0.2
f ( xi 1 ) f ( x) 0.2 0.925
f ' ( x) 1.45
h 0.5
Solution
Forward Divided Difference:
h2 0.25;
xi 1 xi 1* h 0.5 1(0.25) 0.75;
f ( xi 1 ) 0.1(0.75) 4 0.15(0.75)3 0.5(0.75) 2 0.25(0.75) 1.2 0.6363
f ( xi 1 ) f ( x) 0.6363 0.925
f ' ( x) 1.1548
h 0.25
4 1
D (1.1548) (1.45) 1.0564
3 3
Solution
Backward Divided Difference:
h1 xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5) 3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1* h 0.5 1(0.5) 0;
f ( xi 1 ) 0.1(0) 4 0.15(0)3 0.5(0) 2 0.25(0) 1.2 1.2
f ( xi 1 ) f ( x) 1.2 0.925
f ' ( x) 0.55
h 0.5
Solution
Backward Divided Difference:
h2 0.25;
xi 1 xi 1* h 0.5 1(0.25) 0.25;
f ( xi 1 ) 0.1(0.25) 4 0.15(0.25)3 0.5(0.25) 2 0.25(0.25) 1.2 1.1035
f ( x) f ( xi 1 ) 0.925 1.1035
f ' ( x) 0.714
h 0.25
4 1
D (0.714) (0.55) 0.7687
3 3
Solution
Centered Divided Difference:
h1 xi 0.5;
f ( x) 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
f ( x) 0.1(0.5) 4 0.15(0.5) 3 0.5(0.5) 2 0.25(0.5) 1.2 0.925
xi 1 xi 1* h 0.5 1(0.5) 1;
f ( xi 1 ) 0.1(1) 4 0.15(1) 3 0.5(1) 2 0.25(1) 1.2 0.2
xi 1 xi 1* h 0.5 1(0.5) 0;
f ( xi 1 ) 0.1(0) 4 0.15(0) 3 0.5(0) 2 0.25(0) 1.2 1.2
f ( xi 1 ) f ( xi 1 ) 0.2 1.2
f ' ( x) 1
2h 2(0.5)
Solution
Centered Divided Difference:
h2 0.25;
xi 1 xi 1* h 0.5 1(0.25) 0.75;
f ( xi 1 ) 0.1(0.75) 4 0.15(0.75)3 0.5(0.75) 2 0.25(0.75) 1.2 0.6363
xi 1 xi 1* h 0.5 1(0.25) 0.25;
f ( xi 1 ) 0.1(0.25) 4 0.15(0.25)3 0.5(0.25) 2 0.25(0.25) 1.2 1.1035
f ( xi 1 ) f ( xi 1 ) 0.6363 1.1035
f ' ( x) 0.9344
2h 2(0.25)
4 1
D (0.9344) (1) 0.9125
3 3