Sie sind auf Seite 1von 17

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Numerical Methods for Chemical Engineers


Chapter 4: System of Linear Algebraic Equation

Saharudin Haron
Page 4 - 1

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

System of Linear Algebraic Equations


This chapter deals with the case of determining the values x1 , x2 , , xn that simultaneously satisfy a set of equations: a11x1 + a12x2 + . . . .+ a1nxn = b1 a21x1 + a22x2 + . . . .+ a2nxn = b2 . . . . an1x1 + an2x2 + . . . .+ annxn = bn where the as are constant coefficients, bs are constants and n is the number of equations.
Page 4 - 2

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Goals and Objectives


Be able to solve problems involving linear algebraic equations Appreciate the usage of linear algebraic equations in any field of engineering Mastering several techniques and their reliability Nave Gauss elimination Gauss-Jordan elimination LU decomposition Gauss Siedel Be able to use a program to successfully solve systems of linear algebraic equations

Page 4 - 3

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Nave Gauss Elimination


A systematic technique use to solve linear algebraic equations simultaneously with two steps: a) Forward elimination - the equations were manipulated to eliminate all the elements below the main diagonal of matrix A b) Back Substitution - the elimination step result in one equation with one unknown. - the equation could be solved directly and the result backsubstituted into one of the original equations to solve the remaining unknown.
Page 4 - 4

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The procedure of Nave Gauss Elimination


Representing the linear algebraic equations in an augmented matrix form.

a11 a 21 a31 a n1

a12 a22 a32 an 2

a13 .. a1n x1 c1 a23 .. a2 n x2 c2 = a33 .. a3 n x3 c3 an 3 .. a3 n xn cn

a11x1 + a12x2 + a13x3 + .. + a1nxn = c1 a21x1 + a22x2 + a23x3 + .. + a2nxn = c2 a31x1 + a32x2 + a33x3 + .. + a3nxn = c3 : : : : : : an1x1 + an2x2 + an3x3 + .. + annxn = cn

a11 a 21 a31 a n1

a12 a22 a32 an 2

a13 .. a1n a23 .. a2 n a33 .. a3 n an 3 .. ann

c1 c2 c3 c4

- (1) - (2) - (3) - (n)

Label as row or eqn. (1).

Page 4 - 5

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Nave Gauss Elimination (ex. 3 unknowns in 3 equations).

A) Forward elimination a) To eliminate the first unknown, x1, from the second through the nth row/eqn. - row/eqn (1) is called the pivot equation, and a11 is called pivot element.

a11 a 21 a31

a12 a22 a32

a13 a23 a33

c1 (1) c 2 ( 2) c3 (3)

a11

a12 a22 a32

a13 a23 a33

c1 (1) (2) c2 c3 (3)

(i) (ii) (iii) (iv)

(1) x a21/a11 (2) (1a) (1) x a31/a11 (3) (1b)

(1a) (2') (1b) (3')

the prime ' indicates that the elements have been modified.
Page 4 - 6

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Nave Gauss Elimination (ex. 3 unknowns in 3 equations).

b) To eliminate the second unknown, x2, from the third through the nth row/eqn. - row/eqn (2') is called the pivot equation.
a11

a12 a22 a32

a13 a23 a33

c1 (1) (2) c2 c3 (3) (i) (2') x a'32/a'22

(2'a) (3'')

(ii) (3') (2'a)


a11

a12 a22

a13 a23 a33

c1 (1) (2) c2 c3 (3)

the double prime '' indicates that the elements have been modified twice.
Page 4 - 7

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Nave Gauss Elimination (ex. 3 unknowns in 3 equations).

B) Back Substitution From equation (3'') : [a''33 c''33] a''33x3 = c''3


x3 = c''3/a''33

the result x3 can be back-substituted into eqn (2') and (1) to solve for x2 and x1.
a23 x3 ) / a22 x2 = ( c2 x1 = (c1 a12 x2 a13 x3 ) / a11

From equation (2') and (1)

Page 4 - 8

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Nave Gauss Elimination


(assignment in class)

Use Nave Gauss elimination to solve the following equations. x1 + x2 x3 = -3 6x1 + 2x2 + 2x3 = 2 -3x1 + 4x2 + x3 = 1

Page 4 - 9

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Gauss-Jordan Elimination
Steps of Gauss-Jordan Elimination (ex. 3 unknowns in 3 equations).

a)

Change the value of a11 to 1 and eliminate the other elements in the first column. a11 a 21 a31 a12 a22 a32 a13 a23 a33 c1 (1) c 2 ( 2) c3 (3)

1 a12 0 a 22 0 a32

a13 a23 a33

(1) c1 ( 2) c2 c3 (3)

(i) (ii) (iii) (iv) (v)

(1) x 1/a11 (1') x a21 (2) (1'a) (1') x a31 (3) (1'b)

(1') (1'a) (2') (1'b) (3')

the prime ' indicates that the elements have been modified.
Page 4 - 10

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Gauss-Jordan Elimination (ex. 3 unknowns in 3 equations).

b) Change the value of a'22 to 1 and eliminate the other elements in the second column. 1 a12 0 a 22 0 a32 a13 a23 a33 (1) c1 ( 2) c2 c3 (3)

1 0 a13 0 1 a 23 0 0 a33

(1) c1 (2) c2 c3 (3)

(i) (ii) (iii) (iv) (v)

(2') x 1/a'22 (2'') x a'12 (1') (2''a) (2'') x a'32 (3') (2''b)

(2'') (2''a) (1'') (2''b) (3'')

the double prime '' indicates that the elements have been modified twice.
Page 4 - 11

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Gauss-Jordan Elimination (ex. 3 unknowns in 3 equations).

c)

Change the value of a''33 to 1 and eliminate the other elements in the third column. 1 0 a13 0 1 a 23 0 0 a33 (1) c1 (2) c2 c3 (3)

(1) 1 0 0 c1 0 1 0 c (2) 2 (3) 0 0 1 c3

(i) (ii) (iii) (iv) (v)

(3'') x 1/a''33 (3) x a''13 (1'') (3a) (3) x a''23 (2'') (3b)

(3) (3a) (1) (3b) (2)

the triple prime indicates that the elements have been modified three times.
Page 4 - 12

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Steps of Gauss-Jordan Elimination (ex. 3 unknowns in 3 equations).

d) The value of the unknowns can be determined directly without the back substitution step as in the nave gauss elimination. (1) 1 0 0 c1 0 1 0 c (2) 2 (3) 0 0 1 c3 1 0 0 x1 c1 0 1 0 x = c 2 2 c3 0 0 1 x3

x1 = c1 x2 = c2 x3 = c3
Page 4 - 13

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Gauss Seidel Method


The most commonly used iterative method for linear equations solving. The linear equations were derived so that the first equation can be solved for x1, the second can be solved for x2 and the third can be solved for x3.

a11x1 + a12x2 + a13x3 + .. + a1nxn = c1 a21x1 + a22x2 + a23x3 + .. + a2nxn = c2 a31x1 + a32x2 + a33x3 + .. + a3nxn = c3 : : : : : : an1x1 + an2x2 + an3x3 + .. + annxn = cn c a x a13 x 3 L a1n x n x1 = 1 12 2 a11
x3 = c3 a31 x1 a32 x2 L a3n xn a33 x2 = xn = c2 a21 x1 a23 x3 L a2 n xn a22 cn an 2 x2 an 3 x3 L anm xm ann
Page 4 - 14

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Step for Gauss Seidel


x1 = c1 a11

x1 =

( c2 a 21 x1 ) x2 = a22 (c3 a 31 x1 a32 x 2 ) x3 = a33 First Iteration

( c1 a12 x2 a13 x 3 ) a11 ( c2 a 21 x1 a 23 x 3 ) a22 (c3 a 31 x1 a32 x 2 ) a33

x2 = x3 =

Second Iteration

a ,i

x ij xi j 1 = 100% < s j xi

convergence criteria where j and j -1 are the present and previous iterations
Page 4 - 15

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Gauss Seidel
(assignment in class)

Use the Gauss Seidel method to solve the following equations (s = 5 %). 17x1 - 2x2 - 3x3 = 500 -5x1 + 21x2 - 2x3 = 200 -5x1 - 5x2 + 22x3 = 30

Page 4 - 16

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Gauss Seidel assignment in class


Figure 1.0 shows a chemical process consists of 3 reactors linked by pipes. The mass flowrate of a chemical (g/s) through each pipe is equal to its concentration in each reactor, c (g/m3) multiplied by the volume flowrate (m3/s) of the pipe. Assume the system is at a steady state, so that the transfer into each reactor will balance the transfer out. Develop mass-balance equations for the reactors, and solve the equations simultaneously for the unknown concentrations (c1, c2, c3) using Gauss-Siedel method with s = 5%.
30 g/s (14 m3/s)(c2) (5 m3/s)(c2) 200 g/s R2 (2 m3/s)(c3) R3 (17 m3/s)(c3)

(2 m3/s)(c2) (5 m3/s)(c1) R1

(3 m3/s)(c3)

(5 m /s)(c1)

Figure 1.0

500 g/s

(7 m3/s)(c1)
Page 4 - 17

Das könnte Ihnen auch gefallen