Numerical analysis Example No. 3

download Numerical analysis Example No. 3

of 7

Transcript of Numerical analysis Example No. 3

  • 7/27/2019 Numerical analysis Example No. 3

    1/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 1 of 7

    For the shown 11x11 banded symmetric matrix, use only the 2x11 matrixto decompose the matrix into upper and lower matrix using Choleski

    technique:-

    11x11 matrix

    25 10 0 0 0 0 0 0 0 0 0

    10 8 2 0 0 0 0 0 0 0 0

    0 2 5 4 0 0 0 0 0 0 0

    0 0 4 13 6 0 0 0 0 0 00 0 0 6 29 15 0 0 0 0 0

    0 0 0 0 15 34 10 0 0 0 0

    0 0 0 0 0 10 29 10 0 0 0

    0 0 0 0 0 0 10 40 12 0 0

    0 0 0 0 0 0 0 12 20 8 0

    0 0 0 0 0 0 0 0 8 13 6

    0 0 0 0 0 0 0 0 0 6 53

    Banded matrix

    25 10

    8 2

    5 4

    13 6

    29 15

    34 10

    29 10

    40 12

    20 8

    13 6

    53 0

  • 7/27/2019 Numerical analysis Example No. 3

    2/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 2 of 7

    Solution

    See attached excel sheet for detailed calculation of

    below equations and matrices.

    L(i,i) = sqrt(A(i,i) - L(i,1:i-1)*L(i,1:i-1)'); For diagonal numbers

    L(i,j) = (A(i,j) - L(i,1:j-1)*L(j,1:j-1)')/L(j,j); For all other numbers

    Lower Matrix

    5 0 0 0 0 0 0 0 0 0 0

    2 2 0 0 0 0 0 0 0 0 0

    0 1 2 0 0 0 0 0 0 0 0

    0 0 2 3 0 0 0 0 0 0 0

    0 0 0 2 5 0 0 0 0 0 0

    0 0 0 0 3 5 0 0 0 0 0

    0 0 0 0 0 2 5 0 0 0 0

    0 0 0 0 0 0 2 6 0 0 0

    0 0 0 0 0 0 0 2 4 0 0

    0 0 0 0 0 0 0 0 2 3 0

    0 0 0 0 0 0 0 0 0 2 7

    Upper Matrix

    5 2 0 0 0 0 0 0 0 0 0

    0 2 1 0 0 0 0 0 0 0 00 0 2 2 0 0 0 0 0 0 0

    0 0 0 3 2 0 0 0 0 0 0

    0 0 0 0 5 3 0 0 0 0 0

    0 0 0 0 0 5 2 0 0 0 0

    0 0 0 0 0 0 5 2 0 0 0

    0 0 0 0 0 0 0 6 2 0 0

    0 0 0 0 0 0 0 0 4 2 0

    0 0 0 0 0 0 0 0 0 3 2

    0 0 0 0 0 0 0 0 0 0 7

  • 7/27/2019 Numerical analysis Example No. 3

    3/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 3 of 7

    The lower matrix can be re written in 11x2 matrix

    5 2

    2 1

    2 2

    3 2

    5 3

    5 2

    5 2

    6 2

    4 2

    3 2

    7 0

  • 7/27/2019 Numerical analysis Example No. 3

    4/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 4 of 7

    Algorithm :

    for i = 1 : n

    for j = 1: m %% m is number of columns in banded matrix

    if i == 1 & j == 1

    s = A(i,i); %% i=1, j=1 is special case

    else

    s = A (i , j) -

    C ( y , i y + 1)'

    *

    C ( y , j + i - y);

    end

    if j > 1

    C( i , j ) = s / C( i , 1 );

    else

    if s

  • 7/27/2019 Numerical analysis Example No. 3

    5/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 5 of 7

    Using the above algorithm and apply in it step by step we found that value of S

    for the banded matrix is as below

    i NO. j = 1 j = 2

    1 S = A ( 1 , 1 ) S = A ( 1 , 2 )

    2 S = A ( 2 , 1 ) C ( 1 , 2 ) * C ( 1 , 2 ) S = A ( 2 , 2 )

    3 S = A ( 3 , 1 ) C ( 2 , 2 ) * C ( 2 , 2 ) S = A ( 3 , 2 )

    4 S = A ( 4 , 1 ) C ( 3 , 2 ) * C ( 3 , 2 ) S = A ( 4 , 2 )

    5 S = A ( 5 , 1 ) C ( 4 , 2 ) * C ( 4 , 2 ) S = A ( 5 , 2 )

    6 S = A ( 6 , 1 ) C ( 5 , 2 ) * C ( 5 , 2 ) S = A ( 6 , 2 )

    7 S = A ( 7 , 1 ) C ( 6 , 2 ) * C ( 6 , 2 ) S = A ( 7 , 2 )

    8 S = A ( 8 , 1 ) C ( 7 , 2 ) * C ( 7 , 2 ) S = A ( 8 , 2 )

    9 S = A ( 9 , 1 ) C ( 8 , 2 ) * C ( 8 , 2 ) S = A ( 9 , 2 )

    10 S = A ( 10 , 1 ) C ( 9 , 2 ) * C ( 9 , 2 ) S = A ( 10 , 2 )

    11 S = A ( 11 , 1 ) C ( 10 , 2 ) * C ( 10 , 2 ) S = A ( 11 , 2 )

  • 7/27/2019 Numerical analysis Example No. 3

    6/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 6 of 7

    Continue in the above algorithm we can reach to value of the banded lower

    matrix in form of 11x2 as shown below

    i NO. j = 1 j = 2

    1 Sqrt ( 25 ) = 5 10 / 5 = 2

    2 Sqrt ( 8 2 * 2 ) = 2 2 / 2 = 1

    3 Sqrt ( 5 1 * 1 ) = 2 4 / 2 = 2

    4 Sqrt ( 13 2 * 2 ) = 3 6 / 3 = 2

    5 Sqrt ( 29 2 * 2 ) = 5 15 / 5 = 3

    6 Sqrt ( 34 3 * 3 ) = 5 10 / 5 = 2

    7 Sqrt ( 29 2 * 2 ) = 5 10 / 5 = 2

    8 Sqrt ( 40 2 * 2 ) = 6 12 / 6 = 2

    9 Sqrt ( 20 2 * 2 ) =4 8 / 4 = 2

    10 Sqrt ( 13 2 * 2 ) =3 6 / 3 = 2

    11 Sqrt ( 53 2 * 2 ) =7 0 / 7 = 0

  • 7/27/2019 Numerical analysis Example No. 3

    7/7

    Numerical Analysis Assignment NO.3 17-OCT-2010

    DR.Ahmed Amir Bayoumy

    Prepared By: Ahmed Shaban Mahmoud

    Page 7 of 7

    Conclusion:-

    As following of the new algorithm for banded matrix reached the same

    result for Choleski technique. So, the new algorithm may be right.