Sie sind auf Seite 1von 23

Numerical Methods Numerical Methods

Computational Fluid Dynamics


Outline Outline
Successive Approximations
Matrix and Linear Equations
Pivotal Condensation Method
System of Linear Equations
Gauss Elimination Method
Partial and Complete Pivoting
Gauss J ordan Elimination Method
Eigen values and Eigen vectors
Differentiation and Integration
3/5/2013 2 Numerical Methods
Outline Outline
Differential Equations
Eulers Methods
Taylors Method
Runge-KuttaMethods
Simultaneous Differential Equations
Higher Order Equations
Boundary Value Problems
Partial Differential Equations
Algebraic Equations
3/5/2013 3 Numerical Methods
Successive Approximations Successive Approximations
Roots of any algebraic equation of degree greater
than 4 can not be evaluated exactly using finite
number of operations on its coefficients
Method of successive approximation is used to
find an approximate solution for such equations
3/5/2013 4 Numerical Methods
Successive Approximations Successive Approximations
Write the given eqin the form, x=f(x)
Consider the formula, x
k+1
=f(x
k
), which is called iterative equation
Start with an initial guess, x
0
=c
Evaluate, x
1
=f(x
0
)
x
2
=f(x
1
)
x
3
=f(x
2
) ..
Continue the procedure until, x
k+1
=x
k
If it doesnt converge, try with another iterative equation
3/5/2013 5 Numerical Methods
Successive Approximations Successive Approximations
ALGORITHM
Define f(x)
Read x
1
k =1
x
k+1
=f(x
k
)
Print k+1, x
k+1
, f(x
k+1
)
If |x
k+1
x
k
| 5e
-5
,
end if
Print final root, x
k+1
Stop
3/5/2013 6 Numerical Methods
Successive Approximations Successive Approximations
Exercise
Find the root of an equation, 32 x
5
64 x+31=0
Find the root of an equation, x
5
3 x
2
+3 x 1=0
3/5/2013 7 Numerical Methods
Matrix and Linear Equations Matrix and Linear Equations
Pivotal Condensation Method
3/5/2013 8 Numerical Methods
11 12 1
21 22 2
1 2
.......
.......
..... ...... ....... ....
.......
n
n
n n nn
a a a
a a a
A
a a a
(
(
(
=
(
(

Do the operation
1
1
11
i
ij ij j
a
a a a
a
=
Then it becomes
11 12 1 22 23 2
22 2 32 33 3
11
2 2 3
....... .......
0 ....... .......
..... ...... ....... .... ..... ...... ....... ....
0 ....... .......
n n
n n
n nn n n nn
a a a a a a
a a a a a
A a
a a a a a
( (
( (
( (
= =
( (
( (

Matrix and Linear Equations Matrix and Linear Equations
Repeat the procedure to get
3/5/2013 9 Numerical Methods
33 32 3
43 44 4
11 22
3 4
.......
.......
..... ...... ....... ....
.......
n
n
n n nn
a a a
a a a
A a a
a a a
(
(
(
=
(
(

Repeat until weget
11 22 33
......
nn
A a a a a =
Pivotal Condensation Method
Pivotal Condensation Method Pivotal Condensation Method
ALGORITHM
Read n
For i =1 to n
For j =1 to n
Read a
ij
Next j
Next i
For k =1 to n 1
For i =k +1 to n
Ratio =
For j =1 to n
a
ij
=a
ij
ratio * a
kj
Next j
Next i
Next k
3/5/2013 10 Numerical Methods
( )
ik kk
a a
ALGORITHM (Contd.,)
Det =1
For i =1 to n
Det =Det * a
ii
Next i
Print Det
Stop
Pivotal Condensation Method Pivotal Condensation Method
Exercise
Find the determinant of,
3/5/2013 11 Numerical Methods
1.2 2.1 3.2 4.3
1.4 2.6 3 4.1
2.2 1.7 4 1.2
1.1 3.6 5 4.6
A

(
(

(
=
(
(

Write a programming code and validateyour analytical
result with it.
Matrix and Linear Equations Matrix and Linear Equations
Gauss Elimination Method
Gauss J ordan Elimination Method
3/5/2013 12 Numerical Methods
Consider asystem of equations
11 1 12 2 1 1, 1
21 1 22 2 2 2, 1
1 1 2 2 1 , 1
.........
.........
...........................................
...........................................
.........
n n n
n n n
n n nn n n
a x a x a x a
a x a x a x a
a x a x a x a
+
+
+
+ + + =
+ + + =
+ + + =
Systems of Linear Equations
Systems of Linear Equations
Coefficient Matrix
3/5/2013 13 Numerical Methods
Right hand side vector
11 12 1
21 22 2
1 2
.......
.......
..... ...... ....... ....
.......
n
n
n n nn
a a a
a a a
a a a
(
(
(
(
(

1, 1
2, 1
, 1
........
n
n
n n
a
a
a
+
+
+
(
(
(
(
(

Systems of Linear Equations
Bringing down the coefficient matrix to DIAGONAL MATRIX
Bringing down the coefficient matrix to LOWER TRI-DIAGONAL
MATRIX
Bringing down the coefficient matrix to UPPER TRI-DIAGONAL
MATRIX
3/5/2013 14 Numerical Methods
Gauss J ordan Elimination Method
Gauss Elimination Method
GaussSeidal Iteration Method
Solution Techniques
Systems of Linear Equations: Solution Techniques
Bringing down the coefficient matrix to DIAGONAL MATRIX
3/5/2013 15 Numerical Methods
Consider asystem equations
Gauss J ordan Elimination Method
1 2 3
1 2 3
1 2 3
4 3 6
1
3 5 3 4
x x x
x x x
x x x
+ =
+ + =
+ + =
Make some row operationsso that the matrix reduces to
DIAGONAL MATRIX
1
0.5
1 0 0
0 1 0
0 0 1 0.5
(
(
(
(

Systems of Linear Equations: Solution Techniques
Bringing down the coefficient matrix to UPPER TRI-DIAGONAL
MATRIX
3/5/2013 16 Numerical Methods
Consider asystem equations
Gauss Elimination Method
1 2 3
1 2 3
1 2 3
4 3 6
1
3 5 3 4
x x x
x x x
x x x
+ =
+ + =
+ + =
Make some row operationsso that the matrix reduces to
UPPER TRIDIAGONAL MATRIX
Gauss Elimination Method Gauss Elimination Method
ALGORITHM
Read n
For i =1 to n
For j =1 to n+1
Read a
ij
Next j
Next i
For k =1 to n1
For i =k+1 to n
Ratio =
For j =1 to n+1
a
ij
=a
ij
ratio * a
kj
Next j
Next i
Next k
3/5/2013 17 Numerical Methods
( )
ik kk
a a
ALGORITHM (Contd.,)
For k =n1 to 1, 1
x
k
=a
k,n+1
For j =k+1 to n
x
k
=x
k
a
kj
x
j
Next j
x
k
=x
k
/ a
kk
Next k
Stop
Gauss Elimination Method Gauss Elimination Method
Exercise
Solve the following system of equsby Gauss Elimination Method,
3/5/2013 18 Numerical Methods
1
2
3
4
1.2 2.1 1.1 4 6
1.1 2 3.1 3.9 3.9
2.1 2.2 3.7 16 12.2
1 2.3 4.7 12 4
x
x
x
x
( ( (
( ( (

( ( (
=
( ( (
( ( (


Write a programming code and validateyour analytical
result with it.
Systems of Linear Equations: Solution Techniques
3/5/2013 19 Numerical Methods
Consider asystem equations
Gauss Seidel Iteration Method
1 1, 1 1
2
11
2 2, 1 2
1
22
, 1
1
1
1
, 2
....................................................
1
,
n
n j j
j
n
n j j
n
n n n nj j
nn
x a a x
a
x a a x j
a
x a a x j n
a
+
=
+
+
| |
=
|
\ .
| |
= =
|
\ .
| |
= =
|
\ .

Convert them in the form


11 1 12 2 1 1, 1
21 1 22 2 2 2, 1
1 1 2 2 1 , 1
.........
.........
...........................................
...........................................
.........
n n n
n n n
n n nn n n
a x a x a x a
a x a x a x a
a x a x a x a
+
+
+
+ + + =
+ + + =
+ + + =
Start with an initial guess, x
1
=x
2
=x
3
.. =x
n
=0
Store the initial guess in another variable, y
1
=y
2
.. =y
n
=0
Substitute the values of x
n
in RHS of eq(1) and find x
1
Substitute the new x
1
along with x
3
, x
4
,..x
n
, in eq(2) and find x
2
Substitute the new x
1
, x
2
along with x
4
, x
5
,..x
n
, in eq(3) and find x
3
Continue to find x
1
, x
2
, x
3
,..x
n
.
Find x
n
y
n
, if it is zero stop iteration
Otherwise, assign x
n
to y
n
and repeatethe procedure until x
n
y
n
becomes
zero or within a residual value specified
3/5/2013 20 Numerical Methods
Systems of Linear Equations: Solution Techniques
Gauss Seidel Iteration Method
Gauss Seidel Iteration Method Gauss Seidel Iteration Method
ALGORITHM
Read n
For i =1 to n
For j =1 to n+1
Read a
ij
Next j
Next i
For i =1 to n
x
i
=0, y
i
=0
Next i
Iteration =1
12For i =1 to n
x
i
=a
i,n+1
For j =1 to n
If i =j, go to step 17
x
i
=x
i
a
ij
x
j
17 Next j
3/5/2013 21 Numerical Methods
ALGORITHM (Contd.,)
x
i
=x
i
/ a
ii
Next i
For k =1 to n
If |x
k
y
k
| >0.00005, then
Print Iteration
For i =1 to n
y
i
=x
i
Print x
i
Next i
Iteration =Iteration +1
Go to step 12
End if
Next k
Print Final result reached
Stop
Gauss Seidel Iteration Method Gauss Seidel Iteration Method
Exercise
Solve the following system of Equsby Gauss Seidel Iteration
Method,
3/5/2013 22 Numerical Methods
Write a programming code and validateyour analytical
result with it.
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
10 2 3
2 10 15
10 2 27
2 10 9
x x x x
x x x x
x x x x
x x x x
=
+ =
+ =
+ =
M MOHAN M MOHAN J AGADEESH J AGADEESH KUMAR KUMAR
ASST PROFESSOR (SG) ASST PROFESSOR (SG)
SMBS SMBS, , R.NO R.NO: MB 133G : MB 133G
Thank you
3/5/2013 Numerical Methods 23

Das könnte Ihnen auch gefallen