Relaxation Method 2012

download Relaxation Method 2012

of 46

Transcript of Relaxation Method 2012

  • 7/31/2019 Relaxation Method 2012

    1/46

    RELAXATION METHODS

    Presenters : Saleem Abdool 11/0935/1430Michal Dhani 10/0937/1299Quincy Chester 10/0937/2244Kevin Tucker 10/0937/2516

    Adeye Horatio 09/0935/1430

  • 7/31/2019 Relaxation Method 2012

    2/46

    Outline of presentationIntroductionTypes of Relaxation Methods

    - Jacobi method

    - Gauss-Seidel method

    - Successive over relaxation(SOR)

    Summary

    Reference

    Worksheet

    Program solving relaxation Methods

  • 7/31/2019 Relaxation Method 2012

    3/46

    IntroductionWhat is Relaxation Method:

    It is a method of solving simultaneous equations by guessing asolution and then reducing the errors that result by successiveapproximations until all the errors are less than some specifiedamount.

    Why Relaxation Method:

    Because relaxation methods may be applied to any system oflinear equations to interactively improve an approximation to theexact solution.

    In principle, relaxation methods which are the basis of the Jacobi,Gauss-Seidel, Successive Over Relaxation methods may be appliedto any system of linear equations to interatively improve anapproximation to the exact solution.

    One may solve these equation either (1) direct or (2) iterative

    methods.

  • 7/31/2019 Relaxation Method 2012

    4/46

    IntroductionDirect Method

    They are three such methods

    Solution by determinants (Cramer rules)

    Solution by inverse matrix and

    Solution by successive elimination.

    The first two methods are not practical in solving large systemsof equations. Even the third one may sometimes be toocomputer memory demanding that one needs to resort to the

    iterative alternative.

    Additionally, direct methods may leave round-off error problemsthat may result in solutions that are incorrect on computerssupporting or not supporting sufficient precision.

  • 7/31/2019 Relaxation Method 2012

    5/46

    Introduction

    Iterative Method

    Because of the limit in precision in mostcomputations representation of numbers, it isunlikely that one will have the exact solution evenwith the direct method.

    Iterative methods do not produce exact solution,theoretically, in finite number of iteration.

    However, given the imprecise nature of numberrepresentation on computers, iteration method mayhave some advantages over direct methods. Inreality, for large systems of equation, iterativemethods are the ones to choose

  • 7/31/2019 Relaxation Method 2012

    6/46

    Objectives

    To identify the iteration methods

    To show the application of iterative methodin engineering

    To determine the convergence of eachmethod

  • 7/31/2019 Relaxation Method 2012

    7/46

    Why use Iterative Techniques? The method of solving simultaneous linearalgebraic equations using Gaussian Elimination andthe Gauss-Jordan Method. These techniques areknown as direct methods. Problems can arise from

    round-off errors and zero on the diagonal.

    One means of obtaining an approximate solution tothe equations is to use an educated guess.

  • 7/31/2019 Relaxation Method 2012

    8/46

    Iterative Methods

    We will look at three iterativemethods:

    Jacobi Method Gauss-Seidel Method

    Successive over Relaxation (SOR)

  • 7/31/2019 Relaxation Method 2012

    9/46

    Jacobi methodIn numerical linear algebra, the Jacobi method is analgorithm for determining the solutions of a systemof linear equations with largest absolute values ineach row and column dominated by the diagonal

    element. Each diagonal element is solved for, and anapproximate value plugged in. The process is theniterated until it converges. This algorithm is astripped-down version of the Jacobi transformation

    method of matrix diagonalization. The method isnamed after German mathematician Carl GustavJakob Jacobi.

  • 7/31/2019 Relaxation Method 2012

    10/46

    Jacobi method

    The technique solves for the entire set of

    x values for each iteration.

    The problem does not update the values

    until an iteration is completed

  • 7/31/2019 Relaxation Method 2012

    11/46

  • 7/31/2019 Relaxation Method 2012

    12/46

    ExampleA linear system of the form with initial estimate is given by

    We use the equation , described above, to estimate . First, we

    rewrite the equation in a more convenient form , where

    and . Note that where and are the strictly lower

    and upper parts of . From the known values

  • 7/31/2019 Relaxation Method 2012

    13/46

    we determine as

    Further, C is found as

  • 7/31/2019 Relaxation Method 2012

    14/46

    With T and C calculated, we estimate as :

    The next iteration yields

    This process is repeated until convergence (i.e., until is small). The solution after

    25 iterations is

  • 7/31/2019 Relaxation Method 2012

    15/46

    The Gauss-Seidel Method

    This is an iterative method used to solve alinear system of equations. It is named afterthe German mathematicians Carl FriedrichGauss and Philipp Ludwig von Seidel, and is

    similar to the Jacobi method. Though it canbe applied to any matrix with non-zeroelements on the diagonals, Convergence issure if the matrix is diagonally dominant or

    symmetrical and positive definite.

  • 7/31/2019 Relaxation Method 2012

    16/46

    How this method works:

    It use absolute relative approximate errorafter each iteration to check if an error iswithin a prespecified tolerance byassuming an initial guess solution arraythen algebraically solving each linearequation for xi. After which the iterationmethod is repeated to check if the error iswithin the prespecified tolerance.

  • 7/31/2019 Relaxation Method 2012

    17/46

  • 7/31/2019 Relaxation Method 2012

    18/46

    Gauss-Seidel Method

    http://numericalmethods.eng.usf.edu

    AlgorithmRewriting each equation

    11

    13132121

    1a

    xaxaxacx nn

    nn

    nnnnnn

    n

    nn

    nnnnnnnnnn

    nn

    a

    xaxaxacx

    a

    xaxaxaxacx

    a

    xaxaxacx

    11,2211

    1,1

    ,122,122,111,111

    22

    232312122

    From Equation 1

    From equation 2

    From equation n-1

    From equation n

  • 7/31/2019 Relaxation Method 2012

    19/46

    Gauss-Seidel Method

    http://numericalmethods.eng.usf.edu

    AlgorithmGeneral Form of each equation

    11

    11

    11

    1a

    xac

    x

    n

    jj

    jj

    22

    21

    22

    2a

    xac

    x

    j

    n

    jj

    j

    1,1

    11

    ,11

    1

    nn

    n

    njj

    jjnn

    na

    xac

    x

    nn

    n

    njj

    jnjn

    na

    xac

    x

    1

  • 7/31/2019 Relaxation Method 2012

    20/46

  • 7/31/2019 Relaxation Method 2012

    21/46

    Gauss-Seidel Method

    n

    -n

    2

    x

    x

    x

    x

    1

    1

    http://numericalmethods.eng.usf.edu

    Solve for the unknowns

    Assume an initial guess for [X] Use rewritten equations to solve foreach value of xi.

    Important: Remember to use themost recent value of xi. Whichmeans to apply values calculated tothe calculations remaining in thecurrent iteration.

  • 7/31/2019 Relaxation Method 2012

    22/46

    Gauss-Seidel Method

    http://numericalmethods.eng.usf.edu

    Calculate the Absolute Relative Approximate Error

    100

    newi

    old

    i

    new

    i

    ia x

    xx

    So when has the answer been found?

    The iterations are stopped when the absolute relativeapproximate error is less than a prespecified tolerance for allunknowns.

  • 7/31/2019 Relaxation Method 2012

    23/46

    Gauss-Seidel Method: Example 1

    Time, Velocity

    5 106.8

    8 177.2

    12 279.2

    http://numericalmethods.eng.usf.edu

    The upward velocity of a rocketis given at three different times

    The velocity data is approximated by a polynomial as:

    12.t5,322

    1 atatatv

    st m/sv

    Table 1 Velocity vs. Time data.

  • 7/31/2019 Relaxation Method 2012

    24/46

    Gauss-Seidel Method: Example 1

    3

    2

    1

    3

    2

    3

    2

    2

    2

    1

    2

    1

    1

    1

    1

    v

    v

    v

    a

    a

    a

    tt

    tt

    tt

    3

    2

    1

    2.279

    2.177

    8.106

    112144

    1864

    1525

    3

    2

    1

    a

    a

    a

    http://numericalmethods.eng.usf.edu

    Using a Matrix template of the form

    The system of equations becomes

    Initial Guess: Assume an initial guess of

    5

    2

    1

    3

    2

    1

    a

    a

    a

  • 7/31/2019 Relaxation Method 2012

    25/46

    Gauss-Seidel Method: Example 1

    2.279

    2.177

    8.106

    112144

    1864

    1525

    3

    2

    1

    a

    a

    a

    http://numericalmethods.eng.usf.edu

    Rewriting each equation

    25

    58.106 321

    aaa

    8

    642.177 312

    aaa

    1

    121442.279 213

    aaa

  • 7/31/2019 Relaxation Method 2012

    26/46

    Gauss-Seidel Method: Example 1

    http://numericalmethods.eng.usf.edu

    Applying the initial guess and solving for ai

    5

    2

    1

    3

    2

    1

    a

    a

    a 6720.325

    )5()2(58.106a1

    8510.7

    8

    56720.3642.177a 2

    36.155

    1

    8510.7126720.31442.279a3

    Initial Guess

    When solving for a2, how many of the initial guess values were used?

  • 7/31/2019 Relaxation Method 2012

    27/46

    Gauss-Seidel Method: Example 1

    36.155

    8510.76720.3

    3

    2

    1

    a

    a

    a

    http://numericalmethods.eng.usf.edu

    100

    new

    i

    old

    i

    new

    i

    ia x

    xx

    %76.721006720.3

    0000.16720.31a

    x

    %47.1251008510.7

    0000.28510.72a

    x

    %22.10310036.155

    0000.536.1553a

    x

    Finding the absolute relative approximate error

    At the end of the first iteration

    The maximum absolute

    relative approximate error is125.47%

  • 7/31/2019 Relaxation Method 2012

    28/46

    Gauss-Seidel Method: Example 1

    36.155

    8510.7

    6720.3

    3

    2

    1

    a

    a

    a

    http://numericalmethods.eng.usf.edu

    Iteration #2Using

    056.1225

    36.1558510.758.1061

    a

    882.54

    8

    36.155056.12642.1772

    a

    34.798

    1

    882.5412056.121442.2793

    a

    from iteration #1

    the values of ai are found:

  • 7/31/2019 Relaxation Method 2012

    29/46

    Gauss-Seidel Method: Example 1

    http://numericalmethods.eng.usf.edu

    Finding the absolute relative approximate error

    %543.69100056.12

    6720.3056.121a

    x

    %695.85100x

    882.54

    8510.7882.542

    a

    %540.8010034.79836.15534.798

    3a

    x

    At the end of the second iteration

    54.798

    882.54

    056.12

    3

    2

    1

    a

    a

    a

    The maximum absoluterelative approximate error is

    85.695%

  • 7/31/2019 Relaxation Method 2012

    30/46

    Iteration a1 a2 a3

    1

    23

    4

    5

    6

    3.6720

    12.05647.182

    193.33

    800.53

    3322.6

    72.767

    69.54374.447

    75.595

    75.850

    75.906

    7.8510

    54.882

    255.51

    1093.4

    4577.2

    19049

    125.47

    85.69578.521

    76.632

    76.112

    75.972

    155.36

    798.34

    3448.9

    14440

    60072

    249580

    103.22

    80.54076.852

    76.116

    75.963

    75.931

    Gauss-Seidel Method: Example 1

    0857.1

    690.19

    29048.0

    a

    a

    a

    3

    2

    1

    http://numericalmethods.eng.usf.edu

    Repeating more iterations, the following values are obtained

    %1a

    %2a

    %3a

    Notice The relative errors are not decreasing at any significant rate

    Also, the solution is not converging to the true solution of

  • 7/31/2019 Relaxation Method 2012

    31/46

    Gauss-Seidel Method: Pitfall

    http://numericalmethods.eng.usf.edu

    Even though done correctly, the answer is not converging to thecorrect answer

    This example illustrates a pitfall of the Gauss-Siedel method: not allsystems of equations will converge.

    One class of system of equations always converges: One with a diagonallydominantcoefficient matrix.

    Diagonally dominant: [A] in [A] [X] = [C] is diagonally dominant if:

    n

    j

    j

    ijaa

    i

    1

    ii

    n

    ij

    j

    ijii aa1

    for all i and for at least one i

  • 7/31/2019 Relaxation Method 2012

    32/46

    Gauss-Seidel Method: Example 2

    http://numericalmethods.eng.usf.edu

    Given the system of equations

    15312 321 x-xx

    2835 321 xxx

    761373 321 xxx

    1

    0

    1

    3

    2

    1

    x

    x

    x

    With an initial guess of

    The coefficient matrix is:

    1373

    351

    5312

    A

  • 7/31/2019 Relaxation Method 2012

    33/46

    Gauss-Seidel Method: Example 2

    76

    28

    1

    1373

    351

    5312

    3

    2

    1

    a

    a

    a

    1

    0

    1

    3

    2

    1

    x

    x

    x

    http://numericalmethods.eng.usf.edu

    Rewriting each equation

    12

    531 321

    xxx

    5328 312 xxx

    13

    7376 213

    xxx

    With an initial guess of

    50000.0

    12

    150311

    x

    9000.45 135.0282

    x

    0923.3

    13

    9000.4750000.03763

    x

  • 7/31/2019 Relaxation Method 2012

    34/46

    Gauss-Seidel Method: Example 2

    http://numericalmethods.eng.usf.edu

    The absolute relative approximate error

    %00.10010050000.0

    0000.150000.01

    a

    %00.1001009000.4

    09000.42a

    %662.671000923.3

    0000.10923.33a

    The maximum absolute relative error after the first iteration is 100%

  • 7/31/2019 Relaxation Method 2012

    35/46

    Gauss-Seidel Method: Example 2

    8118.3

    7153.3

    14679.0

    3

    2

    1

    x

    x

    x

    0923.3

    9000.4

    5000.0

    3

    2

    1

    x

    x

    x

    http://numericalmethods.eng.usf.edu

    After Iteration #1

    14679.0

    12

    0923.359000.4311

    x

    7153.3

    5

    0923.3314679.0282

    x

    8118.3

    13

    900.4714679.03763

    x

    Substituting the x values into theequations

    After Iteration #2

  • 7/31/2019 Relaxation Method 2012

    36/46

    Gauss-Seidel Method: Example 2

    http://numericalmethods.eng.usf.edu

    Iteration #2 absolute relative approximate error

    %61.24010014679.0

    50000.014679.01a

    %889.311007153.3

    9000.47153.32a

    %874.181008118.3

    0923.38118.33a

    The maximum absolute relative error after the first iteration is 240.61%

  • 7/31/2019 Relaxation Method 2012

    37/46

  • 7/31/2019 Relaxation Method 2012

    38/46

    Successive Over relaxation Method

    This method is based on to the Gauss-SeidelMethod and is specially formulated to give

    you a more accurate solution in lessrepetition.

    This is done with the use of a relaxationfactor().

    http://numericalmethods.eng.usf.edu38

  • 7/31/2019 Relaxation Method 2012

    39/46

    This method is based on the general Formula

    (+)

    ()

    ()

    Where

    ()is the residual of

    Hence from a rearranged for of the Gauss-

    Seidel Method which is

    (+)

    ()

    ()

    ()+

    Where we can see the Residual bracketed

    http://numericalmethods.eng.usf.edu39

  • 7/31/2019 Relaxation Method 2012

    40/46

    The SOR formula then becomes:

    (+)

    ()

    ()

    ()

    +

    http://numericalmethods.eng.usf.edu40

  • 7/31/2019 Relaxation Method 2012

    41/46

    Example

    Solve for values of x in the following system where:

    2 1

    2 3 0

    23 1 Which becomes the matrix form

    2 1 0

    1 2 1

    0 1 2

    3

    10

    1

    Where for

    (+)

    ==

    http://numericalmethods.eng.usf.edu41

  • 7/31/2019 Relaxation Method 2012

    42/46

    Example contd Rewriting the actual solution

    2 0 1 0 0 0 1

    Using the equation:

    (+) () ()

    Taking to be 1 in this case

    http://numericalmethods.eng.usf.edu42

  • 7/31/2019 Relaxation Method 2012

    43/46

    Example contd (+) 0 1

    And it continues as shown below

    http://numericalmethods.eng.usf.edu43

    K 1 0.5 0.25 0.6252 0.625 0.625 0.8125

    10 0.9985 0.9985 0.9926

  • 7/31/2019 Relaxation Method 2012

    44/46

    Example contd At different values of can see checking a value

    each variable after 5 cycles (k=5)

    http://numericalmethods.eng.usf.edu44

    3

    0.5 0.651 0.545 0.704

    1.0 0.953 0.953 0.976

    1.99 0.995 0.995 1.94

  • 7/31/2019 Relaxation Method 2012

    45/46

    The key to successfully using this method is obtaining anappropriate value for each time.

    This allows convergence to be faster than the previousmethods mentioned

    For 0 < < 2 the system will converge.

    But at < < 1 convergence is slower than the Gauss-

    Seidel Method. While at 1 the system becomes Gauss-Seidel

    Method.

    And for 1 < < 2 the system converges fastest and in

    the least steps. This does not mean that for the highest possible value of

    we get the fastest convergence but an appropriatevalue of can be obtained by trial and error.

    http://numericalmethods.eng.usf.edu45

  • 7/31/2019 Relaxation Method 2012

    46/46

    The End