WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

download WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

of 23

Transcript of WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    1/23

    Numerical MethodsNumerical Methods

    Computational Fluid Dynamics

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    2/23

    OutlineOutlineSuccessive ApproximationsMatrix and Linear Equations Pivotal Condensation Method System of Linear Equations Gauss Elimination Method Partial and Complete Pivoting Gauss Jordan Elimination Method Eigen values and Eigen vectorsDifferentiation and Integration

    3/5/2013 2Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    3/23

    OutlineOutlineDifferential Equations Eulers Methods Taylors Method Runge-KuttaMethods Simultaneous Differential Equations Higher Order Equations

    Boundary Value Problems Partial Differential EquationsAlgebraic Equations

    3/5/2013 3Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    4/23

    Successive ApproximationsSuccessive 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 4Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    5/23

    Successive ApproximationsSuccessive ApproximationsWrite the given eq in the form, x = f (x)

    Consider the formula, xk+1 = f (xk), which is called iterative equation

    Start with an initial guess, x0 = c

    Evaluate, x1 = f (x0)

    x2 = f (x1)

    x3 = f (x2) ..

    Continue the procedure until, xk+ 1 = xk

    If it doesnt converge, try with another iterative equation

    3/5/2013 5Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    6/23

    Successive ApproximationsSuccessive ApproximationsALGORITHM

    Define f (x)

    Read x1

    k =1

    xk+1 = f (xk)

    Print k +1, xk+1 , f (xk+1 )

    If |xk+1 xk| 5e -5,

    end if

    Print final root, xk+1

    Stop

    3/5/2013 6Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    7/23

    Successive ApproximationsSuccessive Approximations

    Exercise

    Find the root of an equation, 32 x5 64 x + 31 = 0

    Find the root of an equation, x5 3 x2 + 3 x 1= 0

    3/5/2013 7Numerical Methods

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    8/23

    Matrix and Linear EquationsMatrix and Linear Equations

    Pivotal Condensation Method

    3/5/2013 8Numerical Methods

    11 12 1

    21 22 2

    1 2

    .......

    .......

    ..... ...... ....... ....

    .......

    n

    n

    n n nn

    a a aa a a

    A

    a a a

    Do the operation 1 111

    iij ij j

    aa a a

    a

    Then it becomes

    11 12 1 22 23 2

    22 2 32 33 311

    2 2 3

    ....... .......

    0 ....... .......

    ..... ...... ....... .... ..... ...... ....... ....

    0 ....... .......

    n n

    n n

    n nn n n nn

    a a a a a aa a a a a

    A a

    a a a a a

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    9/23

    Matrix and Linear EquationsMatrix and Linear Equations

    Repeat the procedure to get

    3/5/2013 9Numerical Methods

    33 32 3

    43 44 411 22

    3 4

    .......

    .......

    ..... ...... ....... ....

    .......

    n

    n

    n n nn

    a a a

    a a aA a a

    a a a

    Repeat until weget

    11 22 33 ...... nnA a a a a

    Pivotal Condensation Method

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    10/23

    Pivotal Condensation MethodPivotal Condensation MethodALGORITHM

    Read nFor i =1 to nFor j =1 to nRead a ijNext jNext i

    For k =1 to n 1For i =k +1 to nRatio =

    For j =1 to naij =a ij ratio * a kjNext jNext iNext k

    3/5/2013 10Numerical Methods

    ik kka aALGORITHM (Contd.,)

    Det =1

    For i =1 to nDet =Det * a iiNext iPrint DetStop

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    11/23

    Pivotal Condensation MethodPivotal Condensation Method

    Exercise

    Find the determinant of,

    3/5/2013 11Numerical 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.

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    12/23

    Matrix and Linear EquationsMatrix and Linear Equations

    Gauss Elimination Method

    Gauss Jordan Elimination Method

    3/5/2013 12Numerical Methods

    Consider a system 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

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    13/23

    Systems of Linear Equations

    Coefficient Matrix

    3/5/2013 13Numerical Methods

    Right hand side vector

    11 12 1

    21 22 2

    1 2

    .......

    .......

    ..... ...... ....... ....

    .......

    n

    n

    n n nn

    a a aa a a

    a a a

    1, 1

    2, 1

    , 1

    ........

    n

    n

    n n

    aa

    a

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    14/23

    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 14Numerical Methods

    Gauss Jordan Elimination Method

    Gauss Elimination Method

    GaussSeidal Iteration Method

    Solution Techniques

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    15/23

    Systems of Linear Equations: Solution Techniques

    Bringing down the coefficient matrix to DIAGONAL MATRIX

    3/5/2013 15Numerical Methods

    Consider asystem equations

    Gauss Jordan Elimination Method

    1 2 3

    1 2 3

    1 2 3

    4 3 6

    1

    3 5 3 4

    x x xx x xx 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

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    16/23

    Systems of Linear Equations: Solution Techniques

    Bringing down the coefficient matrix to UPPER TRI-DIAGONAL

    MATRIX

    3/5/2013 16Numerical 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 xx x xx x x

    Make some row operationsso that the matrix reduces to

    UPPER TRIDIAGONAL MATRIX

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    17/23

    Gauss Elimination MethodGauss Elimination MethodALGORITHM

    Read nFor i =1 to nFor j =1 to n+1Read a ijNext jNext i

    For k =1 to n1For i =k+1 to nRatio =

    For j =1 to n+1aij =a ij ratio * a kjNext jNext iNext k

    3/5/2013 17Numerical Methods

    ik kka a

    ALGORITHM (Contd.,)

    For k =n1 to 1, 1xk =a k,n+1For j =k+1 to nxk =x k akj x jNext jxk =x k / a kkNext kStop

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    18/23

    Gauss Elimination MethodGauss Elimination Method

    Exercise

    Solve the following system of equsby Gauss Elimination Method,

    3/5/2013 18Numerical 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

    xxx

    Write a programming code and validateyour analytical

    result with it.

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    19/23

    Systems of Linear Equations: Solution Techniques

    3/5/2013 19Numerical Methods

    Consider asystem equations

    Gauss Seidel Iteration Method

    1 1, 1 1211

    2 2, 1 2122

    , 11

    1

    1, 2

    ....................................................

    1,

    n

    n j j j

    n

    n j j

    n

    n n n nj jnn

    x a a xa

    x a a x ja

    x a a x j na

    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

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    20/23

    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 yn, if it is zero stop iteration

    Otherwise, assign x n to y n and repeatethe procedure until x n yn becomes

    zero or within a residual value specified

    3/5/2013 20Numerical Methods

    Systems of Linear Equations: Solution Techniques

    Gauss Seidel Iteration Method

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    21/23

    Gauss Seidel Iteration MethodGauss Seidel Iteration MethodALGORITHM

    Read nFor i =1 to nFor j =1 to n+1Read a ijNext jNext i

    For i =1 to nxi =0, y i =0Next iIteration =112 For i =1 to n

    xi =a i,n+1For j =1 to nIf i =j, go to step 17xi =x i aij x j17 Next j

    3/5/2013 21Numerical Methods

    ALGORITHM (Contd.,)

    xi =x i / a iiNext iFor k =1 to nIf |x k yk| >0.00005, thenPrint IterationFor i =1 to nyi =x iPrint x iNext iIteration =Iteration +1Go to step 12

    End if Next kPrint Final result reachedStop

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    22/23

    Gauss Seidel Iteration MethodGauss Seidel Iteration MethodExercise

    Solve the following system of Equsby Gauss Seidel Iteration

    Method,

    3/5/2013 22Numerical 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 xx x x x

    x x x xx x x x

  • 7/28/2019 WINSEM2012 13 CP0854 06 Mar 2013 RM01 7 Numerical Methods

    23/23

    M M OHANM MOHAN J AGADEESH J AGADEESH KUMARKUMAR

    ASST PROFESSOR (SG)ASST PROFESSOR (SG)

    SMBSSMBS,, R.NOR.NO: MB 133G: MB 133G

    Thank you

    3/5/2013 Numerical Methods 23