450 likes | 491 Views
Metode Eliminasi. Pertemuan – 4, 5, 6. Mata Kuliah : Analisis Numerik Kode : CIV - 208 SKS : 3 SKS. Sub Pokok Bahasan : Eliminasi Gauss Eliminasi Gauss Jordan Dekomposisi LU Iterasi Gauss-Seidel Iterasi Jacobi.
E N D
Metode Eliminasi Pertemuan – 4, 5, 6 Mata Kuliah : Analisis Numerik Kode : CIV - 208 SKS : 3 SKS
Sub Pokok Bahasan : • Eliminasi Gauss • Eliminasi Gauss Jordan • Dekomposisi LU • Iterasi Gauss-Seidel • Iterasi Jacobi
This topic deals with simultaneous linear algebraic equations that can be represented generally as • where the a’s are constant coefficients and the b’s are constants. • The technique described in this chapter is called Gauss elimination because it involves combining equations to eliminate unknowns. a11.x1 + a12.x2 + … + a1n.xn = b1 a21.x1 + a22.x2 + … + a2n.xn = b2 …… an1.x1 + an2.x2 + … + ann.xn = bn
Before proceeding to the computer methods, we will describe several methods that are appropriate for solving small (n≤3) sets of simultaneous equations and that do not require a computer. • These are the graphical method, Cramer’s rule, and the elimination of unknowns.
For example : solve 3x1 + 2x2 = 18 - x1+ 2x2 = 2 • The solution is the intersection of the two lines at x1=4 and x2=3. • This result can be checked by substituting these values into the original equations to yield 3(4)+2(3)=18 −(4)+2(3) =2
Another method is use elimination • The elimination of unknowns by combining equations is an algebraic approach that can be illustrated for a set of two equations: a11x1+a12x2=b1(1) a21x1+a22x2=b2 (2)
Eq. (1) might be multiplied by a21and Eq. (2) by a11to give a11a21x1+a12a21x2=b1a21(3) a21a11x1+a22a11x2=b2a11(4) • Subtracting Eq. (3) from Eq. (4) will, therefore, eliminate the x1 term from the equations to yield a22a11x2−a12a21x2=b2a11−b1a21
which can be solved for • x2 can then be substituted into Eq. (1), which can be solved for • example : Use the elimination to solve 3x1 + 2x2 = 18 - x1 + 2x2 = 2
Gauss Elimination • In the previous section, the elimination of unknowns was used to solve a pair of simultaneous equations. The procedure consisted of two steps: 1. The equations were manipulated to eliminate one of the unknowns from the equations. The result of this elimination step was that we had one equation with one unknown. 2. Consequently, this equation could be solved directly and the result back-substituted into one of the original equations to solve for the remaining unknown. • This basic approach can be extended to large sets of equations by developing a systematic scheme or algorithm to eliminate unknowns and to back-substitute. • Gauss elimination is the most basic of these schemes.
The Gauss Elimination is designed to solve a general set of n equations: • As was the case with the solution of two equations, the technique for n equations consists of two phases: elimination of unknowns and solution through back substitution. a11.x1 + a12.x2 + … + a1n.xn = b1(5.a) a21.x1 + a22.x2 + … + a2n.xn = b2(5.b) …… an1.x1 + an2.x2 + … + ann.xn = bn (5.c)
The initial step will be to eliminate the first unknown, x1, from the second through the nth equations. • To do this, multiply Eq. (5.a) by a21/a11to give • Subtracted from Eq. (5.b) to give • Or :
The procedure is then repeated for the remaining equations. • For instance, Eq. (5.a) can be multiplied by a31/a11and the result subtracted from the third equation. • Repeating the procedure for the remaining equations results in the following modified system:
Eq. (5.a) is called the pivot equation and a11 is called the pivot coefficient or element a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn = b1(6.a) a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2(6.b) a/32.x2 + a/33.x3 + …. + a/3n.xn = b/3(6.c) ……… a/n2.x2 + a/n3.x3 + …. + a/nn.xn = b/n(6.d)
Now repeat the above to eliminate the second unknown from Eq. (6.c) through (6.d). • To do this multiply Eq. (6.b) by a’32/a’22, and subtract the result from Eq. (6.c). • Perform a similar elimination for the remaining equations to yield
The procedure can be continued using the remaining pivot equations. • The final manipulation in the sequence is to use the (n−1)th equation to eliminate the xn−1term from the nth equation. a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn= b1 a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2 a//33.x3 + …. + a//3n.xn = b//3……… a//n3.x3 + …. + a//nn.xn = b//n
now solve for xn : • This result can be back-substituted into the (n−l)th equation to solve for xn−1. a11.x1 + a12.x2 + a13.x3 + …. + a1n.xn = b1 a/22.x2 + a/23.x3 + …. + a/2n.xn = b/2 a//33.x3 + …. + a//3n.xn = b//3 ……… a(n-1)nn.xn = b(n-1)n
The procedure, which is repeated to evaluate the remaining x’s, can be represented by the following formula: • For i =n−1,n−2,...,1
Example 1 Use Gauss elimination to solve x1 − 2x2+ 2x3= 1 2x1 + x2 − 3x3= −3 −3x1+ x2− x3 =4 Carry six significant figures during the computation.
Gauss-Jordan Elimination • The Gauss-Jordan method is a variation of Gauss elimination. • The major difference is that when an unknown is eliminated in the Gauss-Jordan method, it is eliminated from all other equations rather than just the subsequent ones. • In addition, all rows are normalized by dividing them by their pivot elements. • Thus, the elimination step results in an identity matrix rather than a triangular matrix • Consequently, it is not necessary to employ back substitution to obtain the solution.
Example 2 Use Gauss-Jordan elimination to solve x1 − 2x2 + 2x3= 1 2x1 + x2 − 3x3= −3 −3x1 + x2− x3 = 4 Last step in Gauss Elimination :
LU Decomposition • As described in previous lesson, Gauss elimination is designed to solve systems of linear algebraic equations, [A]{X}={B} (1) • Although it certainly represents a sound way to solve such systems, it becomes inefficient when solving equations with the same coefficients [A], but with different right-hand-side constants (the b’s).
LU decomposition methods separate the time-consuming elimination of the matrix [A] from the manipulations of the right-hand side {B}. • Thus, once [A] has been “decomposed,” multiple right-hand-side vectors can be evaluated in an efficient manner. • Interestingly, Gauss elimination itself can be expressed as an LU decomposition
Equation (1) can be rearranged to give [A]{X}−{B}=0 (2) • Suppose that Eq. (2) could be expressed as an upper triangular system: (3) • Equation (3) can also be expressed in matrix notation and rearranged to give [U]{X}−{D}=0 (4)
Assume that there is a lower diagonal matrix with 1’s on the diagonal, (5) • That has the property that when Eq. (4) is premultiplied by it, Eq. (2) is the result. That is, [L]{[U]{X}−{D}} =[A]{X}−{B} (6)
If this equation holds, it follows from the rules for matrix multiplication that [L][U]=[A] (7) • and [L]{D}={B} (8)
Gauss elimination can be used to decompose [A] into [L] and [U]. For example : (9) • The first step in Gauss elimination is to multiply row 1 by the factor • and subtract the result from the second row to eliminate a21.
Similarly, row 1 is multiplied by • And the result subtracted from the third row to eliminate a31 • The final step is to multiply the modified second row by • and subtract the result from the third row to eliminate a’32
The value of f21, f31, f32actually are the element of [L]. • So we can rewrite Eq.(9) into the form of :
Example 1 • Solve the equation below, using LU decomposition method
Crout Decomposition • An alternative approach involves a [U] matrix with 1’s on the diagonal. • This is called Crout decomposition. • The Crout decomposition approach generates [U] and [L] by sweeping through the matrix by columns and rows, as depicted in Fig
Crout Decomposition can be implemented by the following concise series of formulas • li1 = ai1 for i = 1,2,3, …, n • for j = 2,3, …, n • for j = 2,3,……., n1 and : For i = j, j+1, …., n For k = j+1, j+2, …, n
Example 2 • Repeat example 1 using Crout Decomposition method
Gauss-Seidel Iteration • Iterative or approximate methods provide an alternative to the elimination methods • The Gauss-Seidel method is the most commonly used iterative method. • Assume that we are given a set of n equations: [A]{X}={B} (1)
Suppose that for conciseness we limit ourselves to a 3×3 set of equations. • If the diagonal elements are all nonzero, the first equation can be solved for x1, the second for x2, and the third for x3 to yield (2.a) (2.b) (2.c)
Now, we can start the solution process by choosing guesses for the x’s. • A simple way to obtain initial guesses is to assume that they are all zero. • These zeros can be substituted into Eq. (2.a), which can be used to calculate a new value for x1 = b1/a11. • Then, we substitute this new value of x1 along with the previous guess of zero for x3 into Eq. (2.b) to compute a new value for x2. • The process is repeated for Eq. (2.c) to calculate a new estimate for x3.
Then we return to the first equation and repeat the entire procedure until our solution converges closely enough to the true values. • Convergence can be checked using the criterion
Example 1 Use the Gauss-Seidel method to obtain the solution of the system Recall that the true solution is x1=3, x2=−2.5, and x3=7. 3x1− 0.1x2− 0.2x3 =7.85 0.1x1+ 7x2− 0.3x3 = −19.3 0.3x1− 0.2x2+ 10x3 =71.4
Jacobi Iteration • An alternative approach, called Jacobi iteration, utilizes a somewhat different tactic. • Rather than using the latest available x’s, this technique uses Eq. (2) to compute a set of new x’s on the basis of a set of old x’s. • Thus, as new values are generated, they are not immediately used but rather are retained for the next iteration.
Gauss-Seidel Jacobi
Example 2 Use the Jacobi Iteration method to obtain the solution of the system Recall that the true solution is x1=3, x2=−2.5, and x3=7. 3x1− 0.1x2− 0.2x3 =7.85 0.1x1+ 7x2− 0.3x3 = −19.3 0.3x1− 0.2x2+ 10x3 =71.4
Homework • Calculate each member force for each system