Electrical Power Utilisation

download Electrical Power Utilisation

of 9

Transcript of Electrical Power Utilisation

  • 8/7/2019 Electrical Power Utilisation

    1/9

    Electrical Power Utilisation

    Iterative Solutions to Linear Algebraic Equations Jacobi and Gauss Seidel andAcceleration with Gauss Seidel

    Introduction to Jacobi and Gauss

    In numerical linear algebra , the GaussSeidel method, also known as the Liebmannmethod or the method of successive displacement, is an iterative method used to solvea linear system of equations . It is named after the German mathematicians CarlFriedrich Gauss and Philipp Ludwig von Seidel , and is similar to the Jacobi method .Though it can be applied to any matrix with non-zero elements on the diagonals,convergence is guaranteed if the matrix is either diagonally dominant , or symmetricand positive definite .

    Iterative Schemes

    Iterative schemes require time to achieve sufficient accuracy and are reserved for large systems of equations where there are a majority of zero elements in the matrix.Often times the algorithms are taylor-made to take advantage of the special structuresuch as band matrices. Practical uses include applications in circuit analysis,boundary value problems and partial differential equations. Iteration is a popular technique finding roots of equations. Generalization of fixedpoint iteration can be applied to systems of linear equations to produce accurateresults. The method Jacobi iteration is attributed to Carl Jacobi (1804-1851) andGauss-Seidel iteration is attributed to Johann Carl Friedrich Gauss (1777-1855) andPhilipp Ludwig von Seidel (1821-1896).

    ITERATIVE SOLUTIONS TO LINEAR ALGEBRAIC EQUATIONS As finer discretizations are being applied with FiniteDifference and Finite Element

    codes: Matrices are becoming increasingly larger Density of matrices is becoming increasingly smaller Banded storage direct solution algorithms no longer remain attractive as solvers for

    very large systems of simultaneous equations

    http://en.wikipedia.org/wiki/Numerical_linear_algebrahttp://en.wikipedia.org/wiki/Iterative_methodhttp://en.wikipedia.org/wiki/Linear_system_of_equationshttp://en.wikipedia.org/wiki/Germanyhttp://en.wikipedia.org/wiki/Mathematicianhttp://en.wikipedia.org/wiki/Carl_Friedrich_Gausshttp://en.wikipedia.org/wiki/Carl_Friedrich_Gausshttp://en.wikipedia.org/wiki/Philipp_Ludwig_von_Seidelhttp://en.wikipedia.org/wiki/Jacobi_methodhttp://en.wikipedia.org/wiki/Diagonally_dominant_matrixhttp://en.wikipedia.org/wiki/Positive-definite_matrixhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Jacobi.htmlhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Jacobi.htmlhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Gauss.htmlhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Seidel.htmlhttp://en.wikipedia.org/wiki/Numerical_linear_algebrahttp://en.wikipedia.org/wiki/Iterative_methodhttp://en.wikipedia.org/wiki/Linear_system_of_equationshttp://en.wikipedia.org/wiki/Germanyhttp://en.wikipedia.org/wiki/Mathematicianhttp://en.wikipedia.org/wiki/Carl_Friedrich_Gausshttp://en.wikipedia.org/wiki/Carl_Friedrich_Gausshttp://en.wikipedia.org/wiki/Philipp_Ludwig_von_Seidelhttp://en.wikipedia.org/wiki/Jacobi_methodhttp://en.wikipedia.org/wiki/Diagonally_dominant_matrixhttp://en.wikipedia.org/wiki/Positive-definite_matrixhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Jacobi.htmlhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Gauss.htmlhttp://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Seidel.html
  • 8/7/2019 Electrical Power Utilisation

    2/9

    Description

    Given a square system of n linear equations with unknown x:

    where:

    Then A can be decomposed into a lower triangular component L*, and a strictly upper

    triangular component U :

    The system of linear equations may be rewritten as:

    The GaussSeidel method is an iterative technique that solves the left hand side of this expression for x, using previous value for x on the right hand side. Analytically,this may be written as:

    However, by taking advantage of the triangular form of L*, the elements of x(k +1) canbe computed sequentially using forward substitution :

    Note that the sum inside this computation of xi(k +1) requires each element in x (k ) exceptxi(k ) itself.

    The procedure is generally continued until the changes made by an iteration are belowsome tolerance.

    Discussion

    http://en.wikipedia.org/wiki/Triangular_matrixhttp://en.wikipedia.org/wiki/Triangular_matrix#Strictly_triangular_matrixhttp://en.wikipedia.org/wiki/Triangular_matrix#Strictly_triangular_matrixhttp://en.wikipedia.org/wiki/Iterative_methodhttp://en.wikipedia.org/wiki/Iterative_methodhttp://en.wikipedia.org/wiki/Forward_substitutionhttp://en.wikipedia.org/wiki/Forward_substitutionhttp://en.wikipedia.org/wiki/Triangular_matrixhttp://en.wikipedia.org/wiki/Triangular_matrix#Strictly_triangular_matrixhttp://en.wikipedia.org/wiki/Triangular_matrix#Strictly_triangular_matrixhttp://en.wikipedia.org/wiki/Iterative_methodhttp://en.wikipedia.org/wiki/Forward_substitution
  • 8/7/2019 Electrical Power Utilisation

    3/9

    The element-wise formula for the GaussSeidel method is extremely similar to that of the Jacobi method .

    The computation of xi(k +1) uses only the elements of x(k +1) that have already beencomputed, and only the elements of x(k ) that have yet to be advanced to iteration k +1.

    This means that, unlike the Jacobi method, only one storage vector is required aselements can be overwritten as they are computed, which can be advantageous for very large problems.

    However, unlike the Jacobi method, the computations for each element cannot bedone in parallel . Furthermore, the values at each iteration are dependent on the order of the original equations.

    Convergence

    The convergence properties of the GaussSeidel method are dependent on the matrixA. Namely, the procedure is known to converge if either:

    A is symmetric positive-definite , or A is strictly or irreducibly diagonally dominant .

    The GaussSeidel method sometimes converges even if these conditions are notsatisfied.

    Algorithm

    Inputs: A , bOutput:

    Choose an initial guess (0) to the solutionrepeat until convergence

    for i from 1 until n do

    for j from 1 until i 1 do

    end (j-loop)for j from i + 1 until n do

    end (j-loop)

    end (i-loop)check if convergence is reached

    end (repeat)

    Gauss-Seidel is the same as SOR (successive over-relaxation) with = 1 .

    http://en.wikipedia.org/wiki/Jacobi_methodhttp://en.wikipedia.org/wiki/Jacobi_methodhttp://en.wikipedia.org/wiki/Parallel_algorithmhttp://en.wikipedia.org/wiki/Positive-definite_matrixhttp://en.wikipedia.org/wiki/Diagonally_dominant_matrixhttp://en.wikipedia.org/wiki/Diagonally_dominant_matrixhttp://en.wikipedia.org/wiki/Successive_Over-relaxationhttp://en.wikipedia.org/wiki/Successive_Over-relaxationhttp://en.wikipedia.org/wiki/Jacobi_methodhttp://en.wikipedia.org/wiki/Parallel_algorithmhttp://en.wikipedia.org/wiki/Positive-definite_matrixhttp://en.wikipedia.org/wiki/Diagonally_dominant_matrixhttp://en.wikipedia.org/wiki/Successive_Over-relaxation
  • 8/7/2019 Electrical Power Utilisation

    4/9

    An example for the matrix version

    A linear system shown as is given by:

    and

    We want to use the equation

    in the form

    where:

    and

    We must decompose into the sum of a lower triangular component and a strictupper triangular component :

    and

    The inverse of is:

    .

    Now we can find:

    Now we have and and we can use them to obtain the vectors iteratively.

    First of all, we have to choose : we can only guess. The better the guess, thequicker will perform the algorithm.

    We suppose:

  • 8/7/2019 Electrical Power Utilisation

    5/9

    We can then calculate:

    As expected, the algorithm converges to the exact solution:

    In fact, the matrix A is diagonally dominant (but not positive definite).

    Another example for the matrix version

    Another linear system shown as is given by:

    and

    We want to use the equation

    in the form

    where:

  • 8/7/2019 Electrical Power Utilisation

    6/9

    and

    We must decompose into the sum of a lower triangular component and a strictupper triangular component :

    and

    The inverse of is:

    .

    Now we can find:

    Now we have and and we can use them to obtain the vectors iteratively.

    First of all, we have to choose : we can only guess. The better the guess, thequicker will perform the algorithm.

    We suppose:

    We can then calculate:

    If we test for convergence we'll find that the algorithm diverges. In fact, the matrix Ais neither diagonally dominant nor positive definite. Then, convergency to the exactsolution

  • 8/7/2019 Electrical Power Utilisation

    7/9

    is not guaranteed and, in this case, will not occur.

    Computational Considerations

    One of the most important problems in technical computing is the solution of systems of simultaneous linear equations.

    In matrix notation, the general problem takes the following form: Given two matrices A and B ,does there exist a unique matrix X so that AX = B or XA = B ?

    It is instructive to consider a 1-by-1 example. For example, does the equation

    7 x = 21

    have a unique solution?

    The answer, of course, is yes. The equation has the unique solution x = 3. The solution is easilyobtained by division:

    x = 21/7 = 3.

    The solution is not ordinarily obtained by computing the inverse of 7, that is 7 1 = 0.142857...,and then multiplying 7 1 by 21. This would be more work and, if 7 1 is represented to a finitenumber of digits, less accurate. Similar considerations apply to sets of linear equations withmore than one unknown; the MATLAB software solves such equations without computing theinverse of the matrix.

    Although it is not standard mathematical notation, MATLAB uses the division terminologyfamiliar in the scalar case to describe the solution of a general system of simultaneousequations. The two division symbols, slash , /, and backslash , \, correspond to the two MATLABfunctions mldivide and mrdivide . mldivide and mrdivide are used for the two situationswhere the unknown matrix appears on the left or right of the coefficient matrix:

    X = B/A Denotes the solution to the matrix equation XA =B .

    X = A\B Denotes the solution to the matrix equation AX =B .

    Think of "dividing" both sides of the equation AX = B or XA = B by A . The coefficient matrix A isalways in the "denominator."

    The dimension compatibility conditions for X = A\B require the two matrices A and B to havethe same number of rows. The solution X then has the same number of columns as B and itsrow dimension is equal to the column dimension of A. For X = B/A , the roles of rows and

    columns are interchanged.

    In practice, linear equations of the form AX = B occur more frequently than those of the formXA = B . Consequently, the backslash is used far more frequently than the slash. The remainderof this section concentrates on the backslash operator; the corresponding properties of the slashoperator can be inferred from the identity:

    (B/A)' = (A'\B')

    The coefficient matrix A need not be square. If A is m -by- n , there are three cases:

    m = n Square system. Seek an exact solution.

    m > n Overdetermined system. Find a least squares solution.

    m < n Underdetermined system. Find a basic solution with at most m nonzero

    http://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mrdivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mrdivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mrdivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mrdivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mrdivide.html
  • 8/7/2019 Electrical Power Utilisation

    8/9

    components.

    Back to Top

    The mldivide Algorithm

    The mldivide operator employs different algorithms to handle different kinds of coefficientmatrices. The various cases are diagnosed automatically by examining the coefficient matrix.

    Permutations of Triangular Matrices

    mldivide checks for triangularity by testing for zero elements. If a matrix A is triangular,MATLAB software uses a substitution to compute the solution vector x . If A is a permutation of atriangular matrix, MATLAB software uses a permuted substitution algorithm.

    Square Matrices

    If A is symmetric and has real, positive diagonal elements, MATLAB attempts a Choleskyfactorization. If the Cholesky factorization fails, MATLAB performs a symmetric, indefinite

    factorization. If A is upper Hessenberg, MATLAB uses Gaussian elimination to reduce the systemto a triangular matrix. If A is square but is neither permuted triangular, symmetric and positivedefinite, or Hessenberg, MATLAB performs a general triangular factorization using LUfactorization with partial pivoting (see lu ).

    Rectangular Matrices

    If A is rectangular, mldivide returns a least-squares solution. MATLAB solves overdeterminedsystems with QR factorization (see qr ). For an underdetermined system, MATLAB returns thesolution with the maximum number of zero elements.

    The mldivide function reference page contains a more detailed description of the algorithm.

    Back to Top

    General Solution

    The general solution to a system of linear equations AX = b describes all possible solutions. Youcan find the general solution by:

    1. Solving the corresponding homogeneous system AX = 0 . Do this using the null command, by typing null(A) . This returns a basis for the solution space to AX = 0. Anysolution is a linear combination of basis vectors.

    2. Finding a particular solution to the nonhomogeneous system AX = b.

    You can then write any solution to AX = b as the sum of the particular solution to AX = b , fromstep 2, plus a linear combination of the basis vectors from step 1.

    The rest of this section describes how to use MATLAB to find a particular solution to AX = b , asin step 2.

    Square Systems

    The most common situation involves a square coefficient matrix A and a single right-hand sidecolumn vector b .

    Nonsingular Coefficient Matrix

    If the matrix A is nonsingular, the solution, x = A\b , is then the same size as b . For example:

    A = pascal(3);

    u = [3; 1; 4];

    x = A\u

    http://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/lu.htmlhttp://www.mathworks.com/help/techdoc/ref/lu.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/qr.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/ref/null.htmlhttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/lu.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/ref/qr.htmlhttp://www.mathworks.com/help/techdoc/ref/mldivide.htmlhttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/math/f4-983672.html#top_of_page%23top_of_pagehttp://www.mathworks.com/help/techdoc/ref/null.html
  • 8/7/2019 Electrical Power Utilisation

    9/9

    x =

    10

    -12

    5

    It can be confirmed that A*x is exactly equal to u .

    If A and B are square and the same size, X = A\B is also that size:

    B = magic(3);

    X = A\B

    X =

    19 -3 -1

    -17 4 13

    6 0 -6It can be confirmed that A*X is exactly equal to B.

    Both of these examples have exact, integer solutions. This is because the coefficient matrix waschosen to be pascal(3) , which has a determinant equal to 1