Date post: | 16-Apr-2017 |
Category: |
Technology |
Upload: | harshana-madusanka-jayamaha |
View: | 273 times |
Download: | 7 times |
computing discreteapproximation of solution of linear
simultaneous equation
JMHM Jayamaha
Content
Linear Equations What is Linear Equations Method for solving the system of linear equations
Direct Method Gauss Elimination method
LU Decomposition
Iterative method Jacobi's method
Gauss Seidal method
Linear Equations
What is Linear Equations A linear equation is an algebraic equation in which each term is
either a constant or the product of a constant and (the first power of) a single variable.
Two methods for solving the system of linear equations
Direct Method Solutions are obtained through a finite number of arithmetic
operations Gauss Elimination method
LU Decomposition
Iterative Method: Solutions are obtained through a sequence of successive approximations
which converges to the required solution Jacobi's method
Gauss Seidal method
GAUSS – ELIMINATION METHOD
GAUSS – ELIMINATION METHOD
Consider a system of 3 – equations with 3 – unknowns
)1(
3333232131
2323222121
1313212111
bxaxaxabxaxaxabxaxaxa
Form the augmented matrix from the given equations as
3333231
2232221
1131211
baaabaaabaaa
111
2122 operation row theUse R
aaRR
111
3133 operation row theUse R
aaRR
If a11 0
New augmented matrix will be
'''0'''0
33332
22322
1131211
baabaabaaa
222
3233 '
' operation row theUse RaaRR
New augmented matrix will be
''''00'''0
333
22322
1131211
babaabaaa
If a22’ 0
From the last matrix, the equations can be written as
'''' '''
3333
2323222
1313212111
bxabxaxabxaxaxa
Use back substitution to get the solution as
11
31321211
22
32322
33
33
, '''
, ''''
axaxabx
axabx
abx
Gauss Elimination method Matlab Implementationfunction x = Gauss(A,b); n = length(b); x = zeros(n,1); for k=1:n-1 % forward elimination for i=k+1:n xmult = A(i,k)/A(k,k); for j=k+1:n A(i,j) = A(i,j)-xmult*A(k,j); end b(i) = b(i)-xmult*b(k); end end % back substitution x(n) = b(n)/A(n,n); for i=n-1:-1:1 sum = b(i); for j=i+1:n sum = sum-A(i,j)*x(j); end x(i) = sum/A(i,i); end
LU Decomposition
Matrix A is decomposed into a product of a lower triangular matrix L and an upper triangular matrix U, that is A = LU or
10010
1 0
00
23
1312
333231
2221
11
333231
232221
131211
uuu
lllll
l
aaaaaaaaa
Matrices L and U can be obtained by the following rule
1. Step 1: Obtain l11 = a11, l21 = a21, l31 = a31
11
1313
11
1212 ,Obtain :2 Step .2
aau
aau
3. Step 3: Obtain l22 = a22 – l21u12
13212322
231Obtain :4 Step .4 ulal
u
5. Step 5: Obtain l32 = a32 – l31u12
6. Step 6: Obtain l33 = a33 – l31u13 – l32u23
Once lower and upper triangular matrices are obtained the solution of Ax = b can be obtained using the procedure
Ax = b LUx = b
Let Ux = y then
LUx = b Ly = b
Steps to get the solution of linear equations
3
2
1
3
2
1
333231
2221
11
000
bbb
yyy
lllll
lbLy
232131333
3
121222
211
11
1 and
1 , where
ylylbl
y
ylbl
ylby
By Forward substitution
3
2
1
3
2
1
23
1312
10010
1 Now
bbb
xxx
uuu
bUx
31321211
3232233 , wherexuxuyx
xuyxyx
By Backward substitution
Matlab Implementation for LU Decomposition
Iterative methodsThe Jacobi Method
The Jacobi Method
This method makes two assumptions1. that the system given by has a unique solution2. the coefficient matrix A has no zeros on its main diagonal
To begin the Jacobi method, solve the first equation for x1 the second equation for x2 and so on, as follows.
Then make an initial approximation of the solution,
Algorithm
Example
To begin, write the system in the form
Because you do not know the actual solution, choose
as a convenient initial approximation. So, the first approximation is
Continuing this procedure, you obtain the sequence of approximations shown in Table
Because the last two columns in Table are identical, you can conclude that to three significant digits the solution is
Matlab Implementation for jacobi method
Iterative methodsThe Gauss-Seidel Method
Gauss-Seidel iteration is similar to Jacobi iteration, except that new values for xi are used on the right-hand side of the equations as soon as they become available.
It improves upon the Jacobi method in two respects Convergence is quicker, since you benefit from the newer,
more accurate xi values earlier. Memory requirements are reduced by 50%, since you only need to
keep track of one set of xi values, not two sets.
Algorithm
Example
Step 1: reformat the equations, solving the first one for x1, the second for x2, and the third for x3
Step 2a: Substitute the initial guesses for xi into the right-hand side of the first equation
Step 2b: Substitute the new x1 value with the initial guess for x3 into the second equation
Step 2c: Substitute the new x1 and x2 values into the third equation
Step 3, 4, · · · : Repeat step 2 and watch for the xi values to converge to an exact solution.
Matlab Implementation of Gauss-Seidel Method
Summary
Solution of linear simultaneous are discussed. Two methods
Direct Gauss Elimination method
LU Decomposition
Iterative Jacobi's method
Gauss Seidal method
References https://en.wikipedia.org/wiki/Linear_equation(2016-06-15) http://homel.vsb.cz/~dom033/predmety/parisLA/
02_direct_methods.pdf Numerical computational methods by P.B Patill , U.P Verma http://college.cengage.com/mathematics/larson/elementary_linear/
5e/students/ch08-10/chap_10_2.pdf http://ocw.usu.edu/Civil_and_Environmental_Engineering/
Numerical_Methods_in_Civil_Engineering/NonLinearEquationsMatlab.pdf
http://people.whitman.edu/~hundledr/courses/M467/GaussSeidel.pdf