chapter 5 · chapter 5 : linear algebraic equations 5555.1 ..11 .1 introductionintroduction in...
TRANSCRIPT
CHAPTER 5
LINEAR ALGEBRAIC LINEAR ALGEBRAIC EQUATIONS
Chapter 5 : TOPIC COVERS
(LINEAR ALGEBRAIC EQUATIONS)
•Naïve Gauss Elimination•Gauss-Jordan Elimination•Gauss-Jordan Elimination•LU Decomposition Method•Gauss-Siedel Method•Applications in Chemical Engineering
LEARNING OUTCOMES
INTRODUCTION
It is expected that students will be able to:
•Clarify the terms forward elimination, back•Clarify the terms forward elimination, backsubstitution, pivot equation and pivot coefficient.
•Solve simultaneously sets of linear algebraic equations.
•Identify suitable numerical technique(s) well suitedfor problems given – Engineering Applications.
CHAPTER 5 : LINEAR ALGEBRAIC EQUATIONSCHAPTER 5 : LINEAR ALGEBRAIC EQUATIONSCHAPTER 5 : LINEAR ALGEBRAIC EQUATIONSCHAPTER 5 : LINEAR ALGEBRAIC EQUATIONS
5555.1 .1 .1 .1 IntroductionIntroductionIntroductionIntroduction
In Chapter 4 (Root of Equation), the value x that satisfied a singleequation, f(x) = 0 is determined. Now, we deal with the case ofdetermining the values x1, x2, …… xn that simultaneously satisfy a set ofequations:
f1 (x1, x2, . . . xn ) = 0f1 (x1, x2, . . . xn ) = 0
f2 (x1, x2, . . . xn ) = 0
. .
. .
fn (x1, x2, . . . xn ) = 0
Such system can be either linear or nonlinear.
For system of linearlinearlinearlinear algebraicalgebraicalgebraicalgebraic equationequationequationequation in general form:
a11x1 + a12x2 + . . . .+ a1nxn = b1
a21x1 + a22x2 + . . . .+ a2nxn = b2
. . . .
. .
an1x1 + an2x2 + . . . .+ annxn = bn------- (5.1)
where; a = constant coefficients
b = constantsb = constants
n = number of equations
Note: Only linearlinearlinearlinear equationsequationsequationsequations involve in the calculation.
There are 4 approach for solving a system of linear algebraic equations:
1. Naïve Gauss Elimination
2. Gauss-Jordan Elimination
3. LU Decomposition Method
4. Gauss-Siedel Method
5555....1111....1111 NaïveNaïveNaïveNaïve GaussGaussGaussGauss EliminationEliminationEliminationElimination
There are 2 steps of procedure for solving:
a. The equations were manipulated to eliminate one of unknownsfrom the equations. The result - one equation with one unknown.
b. This equation is solved directly & the result back-substituted into oneof the original equations to solve for remaining unknowns.
To solve a general set of n equations (4.1):
a11x1 + a12x2 + . . . .+ a1nxn = b1a11x1 + a12x2 + . . . .+ a1nxn = b1
a21x1 + a22x2 + . . . .+ a2nxn = b2
. .
. .
an1x1 + an2x2 + . . . .+ annxn = bn------- (4.1)
where; a = constant coefficients
b = constants
n = number of equations
In simplified form;
AAAAxxxx ==== bbbb -------------------------------- ((((4444....2222))))
where; A = known non-singular matrix n x n
b = n x 1 matrix
x = unknown n x 1 matrix (to be calculated)
x and b also called as vector column / vectors
To solve equation (4.1) or (4.2) we use direct method of forwardelimination and back substitution without iterative.
Example 5.1: Naïve Gauss Elimination
Solve for vector x1, x2, and x3 ; as describe by linear equations:
3x1 + 2x2 – x3 = 5 -------- (i)
x1 - x2 + 3x3 = -10 ------- (ii)
-2x1 + x2 – 2x3 = 5 ------ (iii)
SolutionSolutionSolutionSolution::::
Step 1: eliminates x1 from equations (ii) & (iii) by multiply equation (i)
with suitable value.
Now, row (i) is called as pivotalpivotalpivotalpivotal rowrowrowrow in 1st step
Step 1 can be done as describe below:
Pivot element, a11 = 3
Coefficient, m1 = a21/a11 = 1/3
m2 = a31/a11 = (-2/3) = -2/3
Then, eliminate a21: equation (ii) - (m1)(i)
eliminate a31: equation (iii) - (m2)(i)
Give; 3x1 + 2x2 – x3 = 5 ---------- (i)
0 – 5/3x2 + 10/3x3 = -35/3 --------- (iv)
0 + 7/3x2 – 8/3x3 = 25/3 -------- (v)
Step 2 : eliminates x from equations (v) by using equation (iv) as pivotal rowStep 2 : eliminates x2 from equations (v) by using equation (iv) as pivotal row
Pivot element, a22 = -5/3
Coefficient, m3 = a32/a22 = (7/3)/(-5/3) = -7/5
Then, eliminate a32: equation (v) - (m3)(iv)
Give; 3x1 + 2x2 – x3 = 5 --------- (i)
0 – 5/3x2 + 10/3x3 = -35/3 --------- (iv)
0 + 0 + 2x3 = -8 -------- (vi)
The equations above are reduced to upper triangular system:
Step 3 : Calculate x1, x2, and x3 by back substitution.
From equation (vi)
x3= b3 /a33 = -8/2 = -4
From equation (iv)
x2 = (b2 – a23x3 )/a22 = [-35/3 – 10/3(-4) ]/(-5/3) = -1
From equation (i)
x1 = (b1 – a12x2– a13x3)/a11 = [5 – 2(-1) – 4 ]/3 = 11 1 12 2 13 3 11
AnswerAnswerAnswerAnswer::::
or x = [1, -1, -4]T
where T = transpose matrix
−
−=
=
4
1
1
3
2
1
x
x
x
x
Note:
1. In every steps, pivot element ≠ 0
2. If pivot element = 0, rearrange the rowsto lower level until pivot element ≠ 0
3. If pivot element = 0 after rearrange; thus3. If pivot element = 0 after rearrange; thusno single solution or answer for vector x.
Pitfalls/Drawbacks of Elimination MethodsPitfalls/Drawbacks of Elimination MethodsPitfalls/Drawbacks of Elimination MethodsPitfalls/Drawbacks of Elimination Methods
• Division by zeroDivision by zeroDivision by zeroDivision by zero
During both the elimination and back substitution phase, it is possible that a division by zero could occur
2x2 + 3x3 = 8
4x1 + 6x2 + 7x3 = -3
2x1 + x2 + 6x3 = 5
a11 = 0
• RoundRoundRoundRound----Off ErrorsOff ErrorsOff ErrorsOff Errors
Since computers carry a limited number of significant figures, round off errors can occur and it will propagate.
• Ill/Hard Conditioned systemsConditioned systemsConditioned systemsConditioned systems
Adequacy of solution depends on condition of the system. Ill (Hard) conditioned system will produced a wide range of answers or small changes in coefficients result in large changes in the solution. In contrasts, well-conditioned systems are those where a small change in one or more coefficients results in a similar small change in the solution.
HOW TO SOLVE THE PROBLEM?HOW TO SOLVE THE PROBLEM?HOW TO SOLVE THE PROBLEM?HOW TO SOLVE THE PROBLEM?
1. Determine the largest available coefficient in the column below the pivot element.
2. Switched the row so that the largest element is the pivot element.
This is called “Partial Pivoting”
Example:
1) Without switched the row 1) Without switched the row 1) Without switched the row 1) Without switched the row
0.0003x1 + 3.0000x2 = 2.0001 .......(i) 1.0000x1 + 1.0000x2 = 1.0000 .......(ii)
Pivot element, a11=0.0003 is very close to zero.
Solve by using Gauss elimination:Solve by using Gauss elimination:Solve by using Gauss elimination:Solve by using Gauss elimination:
0.0003x1 + 3.0000x2 = 2.0001 ....... (i) 1.0000x1 + 1.0000x2 = 1.0000 ....... (ii)
Step 1: eliminates x1 from equations (ii)
Pivot element, a11 = 0.0003
Coefficient, m1 = a21/a11 = (1.0000/0.0003)
Then, eliminate a21: equation (ii) - (m1)(i)
(ii) : 1.0000x + 1.0000x = 1.0000(ii) : 1.0000x1 + 1.0000x2 = 1.0000
(m1)(i) : 1.0000x1 + 10,000x2 = 6667
-9999x2 = -6666∴ x2 = 2/3
Substituted x2 into Eq.(i):
x 1 =
2 .0001 − 3 ×2
3
0 .0003=
1
3
• This case is much less sensitive to the number significant figures in the computation
Significant
Figures
x2 x1
3 0.667 0.333
4 0.6667 0.33334 0.6667 0.3333
5 0.66667 0.33333
6 0.666667 0.333333
7 0.6666667 0.3333333
5555....1111....2222 GaussGaussGaussGauss----JordanJordanJordanJordan EliminationEliminationEliminationElimination
The major difference with Naive-Gauss Elimination - when an unknownis eliminated in the Gauss-Jordan Method, it is eliminated from all otherequations, rather than just the subsequent ones. Thus, the eliminationstep results in an identityidentityidentityidentity matrixmatrixmatrixmatrix [[[[IIII ]]]] rather than a triangular matrix.
All rows are normalized by dividing them by their pivot elements.
n Gauss Jordan Method
[A ] [I ]
a11 a12 a13
a a a
1 0 0
0 1 0
a21 a22 a23
a31 a32 a33
0 1 0
0 0 1
1 0 0
0 1 0
0 0 1
a11
−−−−1a
12
−−−−1a
13
−−−−1
a21
−−−−1a
22
−−−−1a
23
−−−−1
a31
−−−−1a
32
−−−−1a
33
−−−−1
[A ]-1[I ]
Example 5.2: Use the Gauss-Jordan technique to solve;
x1 + 2x2 + 3x3 = 6
2x1 - 3x2 + 2x3 = 14
3x1 + x2 - x3 = -2
Thus, in simplify forms; Ax = b
Step 1 : pivot element, a11 = 1
coefficient, m = a /a = 2 (to eliminate a )coefficient, m1 = a21/a11 = 2 (to eliminate a21)
m2 = a31/a11 = 3 (to eliminate a31)
Thus, give; x1 + 2x2 + 3x3 = 6
0 - 7x2 - 4x3 = 2
0 - 5x2 - 10x3 = -20
Step 2 : pivot element, a22 = -7
coefficient, m3 = a32/a22 = -5/-7 (to eliminate a32)
m4 = a12/a22 = 2/-7 (to eliminate a12)
Thus, give; x1 + 0 + 13/7x3 = 46/7
0 - 7x2 - 4x3 = 2
0 + 0 - 50/7x3 = -150/7
Step 3 : pivot element, a = -50/7Step 3 : pivot element, a33 = -50/7
coefficient, m5 = a13/a33 = -13/50 (to eliminate a13)
coefficient, m6 = a23/a33 = 28/50 (to eliminate a23)
Thus, give; x1 + 0 + 0 = 1
0 - 7x2 + 0 = 14
0 + 0 - 50/7x3 = -150/7
Step 4 : Calculate x1, x2, and x3 by back substitution.
In the form of Ax = b
Normalize:
−
=
−
−
7150
14
1
.
75000
070
001
3
2
1
x
x
x
1001 1x
Solve the matrix above:
−=
3
2
1
.
100
010
001
3
2
1
x
x
x
−=
3
2
1
3
2
1
x
x
x
Difference between Naïve Gauss and Gauss-Jordan Elimination :
Naïve Gauss Gauss Jordan
When unknown is eliminated,
it is eliminated from
subsequent/following
equation and back
When an unknown is
eliminated, it is eliminated
from all other equation.equation and back
substitution.
Involve 2 phase: forward
elimination and back
substitution
Only involve elimination.
Not necessary to employ back
substitution.
Elimination results is Upper
triangular matrix
Elimination results is an
Identity matrix
5555....1111....3333 LULULULU DecompositionDecompositionDecompositionDecomposition MethodMethodMethodMethod
In Gauss elimination, the design is to solve systems of linear algebraicequations,
[A] {x} = {b} --------- (5.1)
But it become inefficient when solving equations with the samecoefficient A, but with different right-hand-side constants (the b’s).Recall that Gauss elimination involves 2 steps: forward elimination andback substitution. The forward elimination comprises the bulk of theback substitution. The forward elimination comprises the bulk of thecomputational effort. This is true for large systems of equations.
LU decomposition methods separate/split time-consuming eliminationof the matrix [A] from the manipulations of the right-hand side {b}.Once [A] has been “decomposed”/ (solved), multiple right-hand-sidevectors can be evaluated in efficient manner.
2 steps strategy for obtaining solution for LU decomposition:
a. LU decomposition step: [A] is factored/decomposed into lower [L] andupper [U] triangular matrices.
b. Substitution step: [L] and [U] are used to determine a solution {x} for aright-hand side {b}. This step itself consists of 2 steps.
i. Solve [L] {y} = {b} for {y} with forward substitution.
ii. Solve [U]{x} = {y} for {x}with backward substitution.
LU decomposition methods can be divided into 3 types:
1. Doolittle method
2. Crout Method
3. Cholesky Method
The steps in LU decomposition
a. Doolittle Methoda. Doolittle Methoda. Doolittle Methoda. Doolittle Method
For matrices [A] (3x3) and lii = 1
where; 1 0 0
L = l21 1 0
l31 l32 1
U11 U12 U13
U = 0 U22 U23U = 0 U22 U23
0 0 U33
b. Crout Methodb. Crout Methodb. Crout Methodb. Crout Method
For matrices [A] (3x3) and Uii = 1
where; l11 0 0 1 U12 U13
L = l21 l22 0 U = 0 1 U23
l31 l32 l33 0 0 1
c. Cholesky Methodc. Cholesky Methodc. Cholesky Methodc. Cholesky Method
For matrices [A] (3x3) and Uij = lji
where; l11 0 0
L = l21 l22 0
l31 l32 l33
l11 l21 l31
U = 0 l22 l32 = LT
0 0 l33
Example 5.3: Doolittle Method
Solve for series of equations given below:
3x1 – x2 + 2x3 = 12
x1 + 2x2 + 3x3 = 11
2x1 – 2x2 – x3 = 2
Thus, let : [A] {x} = {b} where;
3 -1 2 12
A = 1 2 3 b = 11
2 -2 -1 2
Step 1: Decomposition
Substitution for A = LU
Then;
×
=
−−
−
33
2322
131211
3231
21
00
0
1
01
001
122
321
213
u
uu
uuu
ll
l
Then;
(1 x U11) + (0x0) + (0x0) = 3
U11 = 3
(1 x U12) + (0xU22) + (0x0) = -1
U12 = -1
(1 x U13) + (0xU23) + (0xU33) = 2
U13 = 2
(l21 x U11)+ (1x0) + (0x0) = 1
l21 = 1/U11 = 1/3
(l21 x U12)+ (1xU22) + (0x0) = 2
(1/3)(-1) + U22 = 2
U22 = 2 + 1/3 = 7/3
(l21 x U13)+ (1xU23) + (0xU33) = 3
(1/3)(2) + U23 = 3
U23 = 3 - 2/3 = 7/3
(l31 x U11)+ (l32 x 0) + (1 x 0) = 2
l31 = 2/U11 = 2/3
U23 = 3 - 2/3 = 7/3
(l31 x U12)+ (l32 x U22) + (1 x 0) = -2
(2/3)(-1) + l32 (7/3) = -2
l32 = (-2 + 2/3) / (7/3)
l32 = (-4/3)(3/7) = -4/7
(l31 x U13)+ (l32 x U23) + (1 x U33) = -1
(2/3)(2) + (-4/7)(7/3) + U33= -1
U33 = (-1 + 4/3 - 4/3)
U33 = -1
Thus;Thus;
−
−
=
−
=
1003
73
70
213
17
43
2
013
1
001
UL
Step 2 : Substitution
i. L y = b with forward substitution
Then, y1 = 12
=
×
− 2
11
12
17
43
2
013
1
001
3
2
1
y
y
y
1
1/3y1 + y2 = 11
y2 = 11 – 1/3(12) = 7
2/3y1 – 4/7y2 + y3 = 2
y3 = 2 – 2/3(12) + 4/7(7) = -2
Thus; yyyy = [12, 7, = [12, 7, = [12, 7, = [12, 7, ----2]2]2]2]TTTT
ii. U x = y with backward substitution
Then; -x3 = -2
x3 = 2
7/3x2 + 7/3x3 = 7
−
=
×
−
−
2
7
12
1003
73
70
213
3
2
1
x
x
x
7/3x2 + 7/3x3 = 7
x2 = [7 – 7/3(2)]/(7/3) = 1
3x1 - x2 + 2x3 = 12
x1 = [12 + 1 -2(2)]/3 = 3
Thus; xxxx = [3, 1, 2]= [3, 1, 2]= [3, 1, 2]= [3, 1, 2]T T T T (Answer)(Answer)(Answer)(Answer)
Example 5.4: Croat Method
Solve for series of equations given below:
3x1 – x2 + 2x3 = 12
x1 + 2x2 + 3x3 = 11
2x1 – 2x2 – x3 = 2
Thus, let : [A] {x} = {b}
where;
3 -1 2 123 -1 2 12
A = 1 2 3 b = 11
2 -2 -1 2
Substitution for Croat Method; A = LU (Uii = 1)
3 -1 2 l11 0 0 1 U12 U13
1 2 3 = l12 l22 0 0 1 U23
2 -2 -1 l31 l32 l33 0 0 1
Solving above matrix;
3 0 0 1 -1/3 2/3
L = 1 7/3 0 U = 0 1 1
2 -4/3 -1 0 0 1
Then;
i. L y = b with forward substitution
y = [4, 3, 2]T
ii. U x = y with backward substitution
x = [3, 1, 2]T
c. Cholesky Methodc. Cholesky Methodc. Cholesky Methodc. Cholesky Method
Characteristics of Cholesky Method:
i. Solving only for Symmetric Matrix where; aij = aji for all i and j. In other words, [A] = [A]T .
Example:
5 1 2
[A] = 1 3 7
Symmetric Matrix (only)
[A] = 1 3 7
2 7 8
ii. Diagonal dominance: diagonal element must be greater than the off-diagonal element for each row; where: | aii | > Σ| a i, j | j = 1, j ≠ i
Example:
4 -2 1
[A] = -2 9 2
1 2 8
Prove that the matrix above is symmetric matrix and diagonal dominance.
Symmetric: a12 = a21 = -2
a13 = a31 = 1
a = a = 2a23 = a32 = 2
diagonal dominance:
|a11| = 4 > |a12| + |a13| = 2 + 1 = 3
|a22| = 9 > |a21| + |a23| = 2 + 2 = 4
|a33| = 8 > |a31| + |a32| = 1 + 2 = 3
iii. Diagonal dominance matrix is non-singular matrix, |A| ≠ 0 ; where inverse
matrix is occur: [A] = [L] [L]T
Example: For linear system [A] {x} = {b}
Then; [L] [L]T {x} = {b}
The problem matrix above can be solved by (similar with LU decomposition method):The problem matrix above can be solved by (similar with LU decomposition method):
i. [L] {y} = {b} : solve for y by forward substitution
ii. [L]T {x} = {y} : solve for x by backward substitution
Example 5.5: Cholesky Method
Solve system of linear algebraic equations below by cholesky method.
4x1 – 2x2 + x3 = 5
-2x1 + 9x2 + 2x3 = 3
x1 + 2x2 + 8x3 = -4
SolutionSolutionSolutionSolution steps:
i. Determining for the matrix : symmetric matrix and diagonal dominance.i. Determining for the matrix : symmetric matrix and diagonal dominance.
4 -2 1 5
[A] = -2 9 2 {b} = 3
1 2 8 -4
ii. A = LLT where:
4 -2 1 l11 0 0 l11 l21 l31
-2 9 2 = l21 l22 0 0 l22 l32
1 2 8 l31 l32 l33 0 0 l33
Solving above matrix:
2 0 0 2 -1 0.5
[L] = -1 2.83 0 [L]T = 0 2.83 0.88
0.5 0.88 2.64 0 0 2.64
iii. [L] {y} = {b} : solve for y by forward substitution
{y} = [2.5, 1.94, -2.64]T
[L]T {x} = {y} : solve for x by backward substitution
[[[[xxxx] = [2, 1, ] = [2, 1, ] = [2, 1, ] = [2, 1, ----1]1]1]1]TTTT
xaxab −−=
5555....1111....4444 GaussGaussGaussGauss----SiedelSiedelSiedelSiedel MethodMethodMethodMethod
The most commonly used “iterative method”.
Given a set of n equations: [A]{x} = {b}
Note:
a. apply for 3 x 3 set of equations only
b. if the diagonal elements are non-zero, the first equation can be solved for x1,
the second for x2 and the third for x3 to yield:
33
2321313
3
22
3231212
2
11
3132121
1
a
xaxabx
a
xaxabx
a
xaxabx
−−=
−−=
−−=
c. Now, 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.
d. These zero can be substituted into equations above, which can be used to
calculate a new value for x1= b1/a11 .
e. Then, we substituted this new value of x1 along with the previous initial
value of x3 (x3 = 0) to compute a new value for x2.
f. The process is repeated to calculate a new estimate for x3.
g. Then, 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:
- - - - - (1)
j
i
j
i xxεε <×
−=
−
%1001
Previous valueNew/Present value
- - - - - (1)
for all i, where j and (j-1 ) are the present and previous iterations respectively.
sj
i
iiia
xεε <×= %100,
Example 5.6: GaussGaussGaussGauss----SiedelSiedelSiedelSiedel MethodMethodMethodMethod
3x1 – 0.1x2 – 0.2x3 = 7.85
0.1x1 + 7x2 – 0.3x3 = -19.3
0.3x1 – 0.2x2 + 10x3 = 71.4
Initial values: x2 = x3 =0.
Step 1: Step 1: Step 1: Step 1: Solve each equations for its unknown on the diagonal.
3.01.03.19
3
2.01.085.7 321
xx
xxx
+−−
++=
Iteration 1: 10
2.03.04.71
7
3.01.03.19
213
312
xxx
xxx
+−=
+−−=
005610.710
)794524.2(2.0)616667.2(3.04.71
794524.27
)0(3.0)616667.2(1.03.19
616667.23
)0(2.0)0(1.085.7
3
2
1
=−+−
=
−=+−−
=
=++
=
x
x
x
Iteration 2:
499625.2)005610.7(3.0)990557.2(1.03.19
%5.12100990557.2
616667.2990557.2
990557.23
)005610.7(2.0)794524.2(1.085.7
1,
1
−=+−−
=
=×−
=
=+−+
=
a
x
x
ε
%6.7100000291.7
005610.7000291.7
000291.710
)499625.2(2.0)990557.2(3.04.71
%8.11100499625.2
794524.2499625.2
499625.27
)005610.7(3.0)990557.2(1.03.19
3,
3
2,
2
=×−
=
=−+−
=
=×−
=
−=+−−
=
a
a
x
x
ε
ε
If in the Example 4.6: Gauss-Siedel Method you are given the true solution for xxxx1111 = = = = 3, x3, x3, x3, x2222 = = = = ----2.5, and x2.5, and x2.5, and x2.5, and x3 3 3 3 = 7, = 7, = 7, = 7, calculate the true percentage error ( )?
Solutions:
After computation, thus for:
%31.0
990557.21
=
=
t
x
ε
%tε
%0042.0
005610.7
%015.0
499625.2
3
2
=
=
=
−=
t
t
x
x
ε
ε
The Gauss-Siedel Method , therefore, converging on the true solution. Additional iterations could be applied to improve the answer. However, in an actual problem, we would not known the true answer a priori.
Consequently, equation (1)(1)(1)(1) provides a means to estimate the error. For example, for xxxx1111;
%5.12%100990557.2
616667.2990557.21, =
−=aε
For xxxx2222 and xxxx3333, the error estimates are ||||εεεεa,2a,2a,2a,2|||| = 11.8% and | | | | εεεεa,3a,3a,3a,3 |||| = 7.6%.
Note that, as the case when determining roots of a single equation, formulation such as equation (1)(1)(1)(1) usually provide a convergence. Thus, when they are met, they ensure that the result is known to at least the tolerance specified by εεεεssss ....
PROBLEMS : Naïve Gauss and Gauss Jordan MethodsPROBLEMS : Naïve Gauss and Gauss Jordan MethodsPROBLEMS : Naïve Gauss and Gauss Jordan MethodsPROBLEMS : Naïve Gauss and Gauss Jordan Methods
1. Write the following set of equations in matrix form:
30 = 2x30 = 2x30 = 2x30 = 2x2222 + 6x+ 6x+ 6x+ 6x3333
20 = 3x20 = 3x20 = 3x20 = 3x2222 + 8x+ 8x+ 8x+ 8x1111
10 = x10 = x10 = x10 = x1111 + x+ x+ x+ x3333
Then, write the transpose of the matrix of coefficients.
2. Give the system
-12xxxx1111 + x+ x+ x+ x2222 ---- xxxx3333 = -20
-2x2x2x2x1111 ---- 4x4x4x4x2222 + 2x+ 2x+ 2x+ 2x3333 = 101111 2222 3333
xxxx1111 + 2x+ 2x+ 2x+ 2x2222 + 2x+ 2x+ 2x+ 2x3333 = 25
a. Solve by naïve Gauss elimination. Show all steps of the computation.
b. Substitute your results into the original equation to check your answers.
3. Solve: xxxx1111 + x+ x+ x+ x2222 ---- xxxx3333 = -3
6x6x6x6x1111 + 2x+ 2x+ 2x+ 2x2222 + 2x+ 2x+ 2x+ 2x3333 = 2
-3x3x3x3x1111 + 4x+ 4x+ 4x+ 4x2222 + x+ x+ x+ x3333 = 5
With (a) naïve Gauss elimination, (b) Gauss elimination with partial pivoting,
(c)naïve Gauss-Jordan, (d) Gauss-Jordan with partial pivoting.
PROBLEMS: LU Decomposition and Gauss Seidel MethodPROBLEMS: LU Decomposition and Gauss Seidel MethodPROBLEMS: LU Decomposition and Gauss Seidel MethodPROBLEMS: LU Decomposition and Gauss Seidel Method
1. Use naïve Gauss elimination to decompose the following system:
7777xxxx1111 + 2x+ 2x+ 2x+ 2x2222 ---- 3x3x3x3x3333 = -12
2x2x2x2x1111 + 5x+ 5x+ 5x+ 5x2222 ---- 3x3x3x3x3333 = -20
xxxx1111 ---- xxxx2222 ---- 6x6x6x6x3333 = -26
Then, multiply the resulting [L] and [U] matrices to determine that [A] is produced.
2. Solve the following system of equations using LU decomposition with partial pivoting:
xxxx + 7x+ 7x+ 7x+ 7x ---- 4x4x4x4x = -51xxxx1111 + 7x+ 7x+ 7x+ 7x2222 ---- 4x4x4x4x3333 = -51
4x4x4x4x1111 ---- 4x4x4x4x2222 + 9x+ 9x+ 9x+ 9x3333 = 62
12xxxx1111 ---- xxxx2222 + 3x+ 3x+ 3x+ 3x3333 = 8
3. 3. 3. 3. Perform Crout decompose on:
2222xxxx1111 ---- 5x5x5x5x2222 + x+ x+ x+ x3333 = 12
----xxxx1111 + 3x+ 3x+ 3x+ 3x2222 ---- xxxx3333 = -8
3xxxx1111 ---- 4x4x4x4x2222 + 2x+ 2x+ 2x+ 2x3333 = 16
Then, multiply the resulting [L] and [U] matrices to determine that [A] is produced.
5.2 5.2 5.2 5.2 ENGINEERING APPLICATIONS : ENGINEERING APPLICATIONS : ENGINEERING APPLICATIONS : ENGINEERING APPLICATIONS :
Linear Algebraic EquationsLinear Algebraic EquationsLinear Algebraic EquationsLinear Algebraic Equations
This chapter will encounter problems involving systems of equations that are too large to solve by hand.
Some of examples are mass balance can be employed to model a system of reactors and linear equations are employed to determine the steady-state configuration of a mass-spring system.
Example 1 : Example 1 : Example 1 : Example 1 : SteadySteadySteadySteady----State of a System of RectorsState of a System of RectorsState of a System of RectorsState of a System of Rectors
Background: One of the most important organizing principles in chemical Background: One of the most important organizing principles in chemical engineering is the conservation of mass. In quantitative terms, the principle is expressed as a mass balance that account for all sources and sinks of a material that pass in and out of a volume (Fig.4.1).
Then, over a finite period of time, this can be expressed as:
Accumulation = inputs – outputs -------(i)
For the period of the computation, if the inputs are greater than the outputs, the mass within the volume increases. If the outputs are greater than the inputs, the mass decreases.
If inputs are equal to the outputs, accumulation is zero and mass remains constant. For this stable condition or steady state (equation i) can be expressed
Fig.4.1:Mass Fig.4.1:Mass Fig.4.1:Mass Fig.4.1:Mass BalanceBalanceBalanceBalance
constant. For this stable condition or steady state (equation i) can be expressed as:
Inputs = outputs ---------- (ii)
Employ the conservation of mass to determine the steady-state concentrations of a system of single reactor and five reactors linked by pipes.
Fig.5.2:Single ReactorPipe 1
Pipe 2
Fig.5.3:Five Reactors
Solutions:
The mass balance can be used for engineering problem solving by expressing the inputs and outputs in terms of measurable variables and parameters.
For example, if we were performing a mass balance for a conservative substance (does not increase or decrease due to chemical transformations) in a reactor (let say reactor in Fig. 5.2), we have to quantify the rate at which mass flows into the reactor through the two inflow pipes and out of the reactor through the outflow pipe.
This can be done by taking the product of the flow rate Q (m3/min) and the concentration, c (mg/m3) for each pipe.concentration, c (mg/m ) for each pipe.
For example, for pipe 1 (Fig. 5.2: Q1=2m3/min and c1=25mg/m3); therefore mass
flows into pipe 1 is Q1c1=2x25=50mg/min.
Similarly for pipe 2 the mass flow can be calculated as Q2c2=1.5x10=15mg/min.
Notice that the concentration out of the reactor through pipe 3 is not specified by Fig. 5.2. As we already have sufficient information to calculate c3 on the basis of the conservation of mass; the inputs should be in balance with the outputs:
Q1c1 + Q2c2 = Q3c3
Substituting the given values into this equation yields:
50 + 15 =3.5c3
which can be solved for c3 = 18.6 mg/min.
Thus, we have determined the concentration in the 3rd pipe.
Because simple algebra was used to determine the concentration for the single reactor in Fig. 5.2, it might not be obvious how computers figure in mass-balance calculations.
Fig. 5.3 shows a problem setting where computers are a practical necessity (real problem).
Because there are five interconnected reactors, five simultaneous mass-balance equations are needed to characterize the system.
For reactor 1; rate of mass flow in : 5(10) + Q cFor reactor 1; rate of mass flow in : 5(10) + Q31c3
rate of mass flow out : Q12c1+ Q15c1
Because the system is at steady state, the inflows and outflows must be equal:
5(10) + Q31c3 = Q12c1+ Q15c1
Or, substituting the values for flow from Fig. 4.3;
6c1 – c3 = 50
Similar equations can be developed for other reactors (Reactor 2, 3, 4, 5) as:
-3c1 + 3c2 = 0
-c2 + 9c3 = 160
-c2 – 8c3 + 11c4 – 2c5 = 0
-3c1 – c2 + 4c5 = 0
A NM can be used to solve these five equations for the five unknown concentrations (c1, c2, c3, c4, c5):
{ } [ ]11.51 17.00 19.06 11.51 51.11=T
C
In other case, the matrix inverse can be computed as:
Each of the elements aij signifies the change in concentration of reactor i due to a unit change in loading to reactor j.
[ ]
=−
25000.0001887.008962.016981.0
04545.009091.008748.007461.006003.0
0011321.003774.001887.0
0001887.033962.016981.0
0001887.000692.016981.0
1A
Column 4/Reactor 4
a unit change in loading to reactor j.
Thus, the zeros in column 4 indicate that a loading to reactor 4 will have no impact on reactor 1, 2, 3 and 5.
This is consistent with the system configuration in Fig. 5.3, which indicates that flow out of reactor 4 does not feed back into any of other reactors.
In contrast, loading to any of the first three reactors (Reactor 1, 2 and 3) will affect the entire system as indicated by the lack of zero in the first three columns.
Such information is of great utility to ENGINEER who design and manage such systems.
END END END END
OF OF OF OF OF OF OF OF
CHAPTER CHAPTER CHAPTER CHAPTER 5555