Download as pdf or txt
Download as pdf or txt
You are on page 1of 138

System of Linear Equations

Standard Equation Form:


 A11 X1 + A12 X2 + A13 X3 = C1
 A21 X1 + A22 X2 + A23 X3 = C2
 A31 X1 + A32 X2 + A33 X3 = C3

Techniques in evaluating system of linear equations


 A. Direct Methods
1. Conventional Methods
2. Determinants
System of Linear Equations
3. Inverse Matrices
4. Gaussian-hybrid techniques
5. Matrix Decomposition

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,
Ax  C 
 After decomposition
LU x  C 
 Let
y  U x equation 1
 then,
Ly   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.

 Example 3: Evaluate for the unknown node voltages using


Gauss-Jacobi Method. Terminate if Ea ≤ 0.0001 for all
variables.
 -11 = 7V1 – 3V2 – 4V3
 3 = –3V1 + 6V2 – 2V3
 25 = –4V1 – 2V2 + 11V3
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Iterative Methods
Gauss-Seidel Method
 The iterative process is similar to Gauss-Jacobi technique.
The process differs only in the introduction of new values
in the succeeding iteration (substitution process). In order
to forcefully accelerate convergence, the technique
introduces the newly computed variable to the next
computed variable rather than the next iteration. Thereby,
improving the set of computed variables for the next
iteration.
Iterative Methods
 Graphical comparison of the substitution process:
Iterative Methods
 Example 4: Determine the unknown node voltages using
Gauss-Seidel Method. Terminate if Ea≤0.0001 for all
variables.
 -11 = 7V1 – 3V2 – 4V3
 3 = –3V1 + 6V2 – 2V3
 25 = –4V1 – 2V2 + 11V3
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Numerical Integration
Newton-Cotes Integration Formulas
 The Newton-Cotes formulas are the most common
numerical integration schemes. The basic theory of the
Newton-Cotes integration formulas is to replace or
transform a complicated function or tabulated data with
an approximating polynomial function that is easy to
integrate.
Numerical Integration
 Graphical Depiction
Numerical Integration
 The function to be differentiated or integrated typically
appears in any of the particular forms
a. a simple continuous function such as a polynomial, an
exponential or a trigonometric function.
b. a complicated continuous function that is difficult or
nearly impossible to differentiate or integrate directly.
c. a tabulated function where values of x and f(x) are given
at a number of discrete points, as is often the case with
experimental or field data.
2 2  cos(1  x 3 / 2 ) 0.5 x
I  e dx
0
1  0.5 sin x
Numerical Integration
The Trapezoidal Rule
 The trapezoidal rule is the first of the Newton-Cotes
closed integration formulas. It corresponds to the case
where the polynomial is in the first order;
b b

a
f ( x)dx   f1 ( x)dx
a

 f1(x) is an interpolating polynomial function in the first


order.
 The area under this straight line is an estimate of the
integral of f(x) between the limits a and b.
Numerical Integration
 Graphical Depiction
Numerical Integration
 hence,
 f (a )  f (b) 
I  (b  a ) 
 2 

(width)(average height)

 Trapezoidal Rule approximation formula using a single


trapezoid. Trapezoidal Rule approximation formula using a
single trapezoid.

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:
ba
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 

 Example 5. Estimate the integral of the given function


from x = 0 to x = 0.8 using trapezoidal rule and multiple
application trapezoidal rule for segments n = 1, 2, 3, 4, 6,
and 8 segments.
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution
 Conventional Method
I 
0
0.8
0.2  25x  200x 2

 675 x3  900 x 4  400 x5 dx
0.8
 25 x 200 x 675x 900 x 400 x 
2 3 4 5 6
I  0.2 x      
 2 3 4 5 6 0
 25(0.8) 2 200(0.8)3 675(0.8) 4 900(0.8)5 400(0.8)6 
I  0.2(0.8)      
 2 3 4 5 6 
I  1.6405
Solution
 Trapezoidal Rule: at n = 1:
x0  a  0
f (a)  0.2  25(0)  200(0) 2  675(0)3  900(0) 4  400(0)5  0.2
x1  b  0.8
f (b)  0.2  25(0.8)  200(0.8) 2  675(0.8)3  900(0.8) 4  400(0.8)5  0.232
b  a 0.8  0
h   0.8
n 1
 f (a)  f (b)   0.2  0.232 
I  b  a    ( 0.8  0)    0.1728
 2   2 
Solution
 Multiple Application Trapezoidal Rule: at n = 2:

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  22.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  21.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  21.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  21.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  21.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

 Example 6. Improve the trapezoidal integral estimate of


the given function from x = 0 to x = 0.8 for n = 8
segments using the trapezoidal rule truncation error
formula.
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution
f ( x)  0.2  25 x  200 x 2  675 x3  900 x 4  400 x5
f ' ( x)  25  400 x  2025x 2  3600 x3  2000 x 4
f " ( x)  400  4050 x  10800 x 2  8000 x3

  400  4050x  10800x


0.8
2

 8000 x3 dx
f "( x)  0
0.8  0
4050 10800 8000
 400(0.8)  (0.8) 
2
(0.8) 
3
(0.8) 4
f "( x)  2 3 4
0.8
f "( x)  60
at n  8
 b  a   0.8  0
3 3
E ( h)  2
f" 2
(60)  0.04
12n 12(8)
I  I (h)  E (h)  1.6008  0.04  1.6408
Numerical Integration
Simpson’s 1/3 Rule
 This second Newton-Cotes closed integration formula
transforms the complicated function into a second order
polynomial to further improve approximation technique.
b b
I   f ( x)dx   f 2 ( x)dx
a a

 f2(x)is a polynomial function in the second order and a &


b are designated as x0, x1 & x2 respectively.
b ( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 ) 
I    f ( x0 )  f ( x1 )  f ( x2 ) (dx)
a ( x  x )( x  x ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )
 0 1 0 2 
Numerical Integration
 After integration and algebraic manipulation,

I   f ( x0 )  4 f ( x1 )  f ( x2 )
h
 3
 Simpson’s 1/3 Rule approximation formula using a single
parabola.
Numerical Integration
 Graphical Depiction
Numerical Integration
 Graphical Depiction
Numerical Integration
Multiple Application Simpson’s 1/3 Rule
 Just like the trapezoidal rule, Simpson’s rule can be
improved by dividing the integration interval into a
number of segments of equal width.
ba
h
 where: n
 h = equal spacing between segments and discrete points
 n = even number of segments with discrete data points
 b = upper value limit
 a = lower value limit
Numerical Integration
 In general,

h n 1 n2 
I   f ( x0 )  4  f ( xi )  2  f ( x j )  f ( xn ) 

3 i  odd j  even 

 Example 7. Estimate the integral of the given function


from x = 0 to x = 0.8 using Simpson’s 1/3 rule and
multiple application Simpson’s 1/3 rule for segments n = 2,
4, 6 and 8 segments.
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution
f ( x)  0.2  25 x  200 x 2  675 x3  900 x 4  400 x5
at n  2
b  a 0.8  0
h   0.4
n 2
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.4  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.4  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 * 2.456)  0.232  10.256

I
0.4
10.256  1.3675
3
Solution
n4
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
n6
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
n8
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

 Example 8. Improve the Simpson’s 1/3 rule integral


estimate of the given function from x = 0 to x = 0.8 using
the Simpson’s 1/3 rule truncation error formula.
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution
f ( x)  0.2  25 x  200 x 2  675 x 3  900 x 4  400 x 5
f ' ( x)  25  400 x  2025 x 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
 21600  48000 x dx
0.8

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

 Simpson’s 3/8 Rule approximation formula using a single


cubic function.
3h
I  ( f ( x0 )  3 f ( x1 )  3 f ( x2 )  f ( x3 ))
8
Numerical Integration
 Multiple Application Simpson’s 3/8 Rule
 
3h  n 1 n 3

I   f ( x0 )  3 f ( xi )  2  f ( x j )  f ( x n ) 
8  i 1 j 3 n 
 i j 

 Example 9. Estimate the integral of the given function


from x = 0 to x = 0.8 using simpson’s 3/8 rule and
multiple application simpson’s 3/8 rule for segments n = 3
and 6
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution

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
30.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
30.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

 Example 10. Improve the Simpson’s 3/8 rule integral


estimate of the given function from x = 0 to x = 0.8 using
the Simpson’s 3/8 rule truncation error formula.
 f(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
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

  21600  48000x dx


0.8

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

  21600  48000x dx


0.8

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

n (no. of h I(h) O(h2) O(h4) O(h6)


segments) (spacing/ integral k=2 k=3 k=4
step size) estimate

n4 h4 I(h4) I(h34) I(h234) I(h1234)


n3 h3 I(h3) I(h23) I(h123)
n2 h2 I(h2) I(h12)
n1 h1 I(h1)
Numerical Integration
 Example 11. Improve the trapezoidal integral estimates of
the function using Romberg integration for h (step sizes)
of 0.8 (n = 1 segment), 0.4 (n = 2 segments), 0.2 (n = 4
segments) and 0.1 (n = 8 segments).
 F(x) = 0.2 + 25x – 200x2 + 675x3 – 900x4 + 400x5
Solution
 Trapezoidal Rule: at n = 1:
x0  a  0
f (a)  0.2  25(0)  200(0) 2  675(0)3  900(0) 4  400(0)5  0.2
x1  b  0.8
f (b)  0.2  25(0.8)  200(0.8) 2  675(0.8)3  900(0.8) 4  400(0.8)5  0.232
b  a 0.8  0
h   0.8
n 1
 f (a)  f (b)   0.2  0.232 
I  b  a    ( 0.8  0)    0.1728
 2   2 
Solution
 Multiple Application Trapezoidal Rule: at n = 2:

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  22.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  21.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  21.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

h I(h) n=2 n=3 n=4


0.1 1.6008 1.6395 1.6418 1.6405
0.2 1.4848 1.6235 1.6600
0.4 1.0688 1.3675
0.8 0.1728
Solution
I  I (h2 ) 
1
I (h2 )  I (h1 )
2 1
n

n2

I  I (h2 ) 
1
I (h2 )  I (h1 )
2 1
2

 I (h2 )  I (h2 )  I (h1 )


1
I
3
 (1.6008)  (1.6008)  (1.4848)  1.6395
1
I
3
 (1.4848)  (1.4848)  (1.0688)  1.6235
1
I
3
 (1.0688)  (1.0688)  (0.1728)  1.3675
1
I
3
Solution
I  I (h2 )  n
1
I (h2 )  I (h1 )
2 1
n3

I  I (h2 )  3 I (h2 )  I (h1 )


1
2 1
I  I (h2 )  I (h2 )  I (h1 )
1
7
I  (1.6395)  (1.6395)  (1.6235)  1.6418
1
7
I  (1.6235)  (1.6235)  (1.3675)  1.6600
1
7
Solution
I  I (h2 )  n
1
I (h2 )  I (h1 )
2 1
n4

I  I (h2 )  4 I (h2 )  I (h1 )


1
2 1
I  I (h2 )  I (h2 )  I (h1 )
1
15
I  (1.6418)  (1.6418)  (1.6600)  1.6405
1
15
Numerical Differentiation
High-Accuracy Derivative Approximation Formula
 Forward Finite Divided Difference

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

 thus, the first derivative formula



f ( xi 1 )  f ( xi )
f ' ( xi )  truncated version
h

 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

 thus, the first derivative formula



f ( xi )  f ( xi 1 )
f ' ( xi )  truncated version
h

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

 more accurate version


Numerical Differentiation
 Example 14. Estimate the derivative of the function at xi =
0.5 using centered 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
 Centered Divided Difference: (h = 0.5)
xi  0.5;
f ( x)  0.1x 4  0.15 x3  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(truncated )
2h 2(0.5)
Solution
 Centered 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
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(truncated )
2h 2(0.25)
Solution
 Centered Divided Difference: (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
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
 f ( xi  2 )  8 f ( xi 1 )  8 f ( xi 1 )  f ( xi  2 )
f ' ( x) 
12h
 0.2  8(0.6363)  8(1.1035)  1.2
f ' ( x)   0.9125(more accurate)
12(0.25)
Numerical Differentiation
Richardson’s Extrapolation
 This is error correction technique is also used to improve
the results of numerical differentiation on the basis of the
derivative estimates themselves. The method uses two
estimates of a derivative to compute a third derivative
(more accurate approximation).
 Similar to the improved estimate of the integral, the
derivative estimate is transformed to,

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

You might also like