You are on page 1of 14

INCOOM SAMEL EWUDZI

INDEX:5888311
DEPARTMENT: ELECTRICAL 3

Numerical assignment

1. a)

[

The system can be represented in matrix form as

][

] =

[

]

M1=-( m21/m11)=-(2/1) = -2.
Multiply Row1 by -2 and add to Row2
The new matrix becomes

[

][

] = [

M2= -(m31/m11) = -(-1/1) = 1

]

x1 . . substituting for x3 = 17.5 The new matrix becomes [ ][ ] = [ ] From the above matrix 0. 4(x2) + 3(x3) = -5.x2 + 0(x3) =2.  x2 = -14.5 Multiply Row2 by -0.5(x3) = 8.  x3 = 17.5. substituting for both x2 and x3.Multiply Row1 by 1 and add to contents of Row3 The new matrix becomes [ ][ ] = [ ] M3=-(m32/m22) =-(2/4) = -0. [ ] = [  x1= ] b) The method used above fails when we encounter  a division by zero during the forward elimination process -12.

5 respectively M1 = [ ] so M1 = [ ][ A(1)= M1P1A =[ A(1)= P2 = [ [ ] ] ] ] and P2A(1) = [ ] M32 have already been found as -0.5 M2 = [ ] so M2 = [ ] . Using LU Decomposition with partial pivoting P1 = [ ] and P1A = [ ] M21 and M31 have already been found as 0.5 and -0. round off of values during the forward elimination process 2.

25(x3) = 4. 4(x2) + 3.25 ] = [  ] x3=17.  x2= -14 2x1 + 2x2 + 3x3= -1.5(x3) = 3.5. substituting for x2=-14.][ U= MzP2A(1) =[ U=[ ] ] P = P2P1L = P (MzP2A(1))-1 P1b = [ ] P 2 M1 P 1 b = [ b1 = [ M1 P 1 b = [ ] ] b1 = M2P2M1P1b = [ ][ ] ] Solution Ux = b1 [ ][ 0. x3 = 17  12  Solution vector X = [ ] x1 = - . substituting x3 = 17.

M2=[ ]. Q1= [ M1=[ ] ]= A(1) Hence P1AQ1M1=[ P2=[ P2A(1)Q2= [ ] .3. LU decomposition with complete pivoting P1A=[ ] P1=[ ] . P1AQ1=[ ]. . Q2= [ ] . ] ] .

] U = A(2) =M2P2A(1)Q2 =[ Now P=P1P2. P1b = [ Q=Q1Q2 ] L = P(M2P2M1P1)-1 M1 P 1 b = [ P 2 M1 P 1 b = [ ] ] b1 = M2P2M1P1b = [ ][ ] Uy = b1 [ ][ (y3) = 4 ] = [  (y2) + 3.5(y3) = ] y3= -14 . y3 = -14 y1 = 17 Since vector Xk is simply a rearrangement of Yk  . substituting y3 = -14.  y2= -12 2y1 + 2y2 + 3y3= -1. substituting for y2 =-12.

B = [  det[B] b. ] . the resulting upper triangular matrix. =det[A] = 1  4  0.a Determinant of matrix A Ax=b as represented below in matrix form [ ][ ] = [ ] but after applying Gaussian elimination method on A. Solution vector X = [ ] 4.5 = 2 Inverse of the system A-1 A= [ Then A  B= I ]let A-1 = B.

Substituting for z1 = 1. [ ][ ] = [ ]z1=1. where U is the upper triangular matrix [ ][ ] = [ 0. z= [ ] = [ ] Solving for Ub= z.5 b11 – b21= 1. b11= -2.Thus [ ][ ] = [ ] Let the first column of B be b11. b21=-3. z2= -2. b31 = 4 4(b21)+3(b31)=-2 .5 ] . [ ][ ]= [ ] By using LU decomposition and solving for Lz=c. 2(z1) +z2 = 0. After substituting for both z1 and z2.5(z2) + z3 = 0. b21and b31 .5(b31)= 2. z3= 2. -(z1)+ 0.

5 z=[ ] Solving for the second column of A-1 Ub = z [ ][ ] = [ ] solving for b b12=1. z2 = 1 and z3 = -0.Second column is [ Solving for the column of A-1 ] . b22= 1 and b32= -1.First column of A-1 =[ ] Solving for the second column of A-1 [ ][ ] = [ ] Lz=c is represented below [ ][ ]=[ ] z1 = 0.

[ ][ [ ][ ] = [ ] and solving Lz=c first ] = [ ] Solving the above for z using forward substitution. z1= 0.5 and b31= -1. 0 and z3= 1  z= [ ] Solving Ub = z [ ][ ] = [ ] Solving the above for values of b b33= 2. ] z2 = . b32= -1.5 The third column is [ A-1 = [ ] but A-1=B.

7143 M31 = -(1/7) = -0. [ ][ ][ ] ][ ] [ ] [ ] Case 1. [ ] [ ] Swap row 1 and row 3.2857 =- .2857 4 5 0 6 0.4286 6 0.5714  -4 -4.1429 0.5714  -1 -1.5.5714 -5.1429 -1. [ M21 = -(4/7) = -0.857 3.143 =- 2.

7143 -0. [ M32 = -(0.4286 0 [ [ ][ ] [ Case 2.5004 3.4286 -0.715 0 0.5001  0 = -3.4286 -1.857 0 ] 0.8571) = -0.3574 Swap row 2 and 3.0007 .4286/0. ] ] [ 0.7143 7.1 2 0 [ 4 0.8571 ][ ] [ ] ][ ] [ ] 8 2.

[ M32 = -(0.3574 .2857 M31 = -(1/7) = -0.7143 4 5 0 6 0.4286/0.2864  0 -0.4286 1 2 0 [ 0.4286 -1.5714 -4  -4.857 3.[ ][ ] [ ] M21 = -(4/7) = -0.4286 6 0.7143 8 6.5001 = -3.5714 Swap row 2 and 3.1429 -1  -1.143 =- 2.8571) = -0.2857 =- 1.5714 -5.8571 ][ ] [ ] ][ ] [ ] 4 2.1429 -1.

0 0.5004 0.000383 [ ][ [ ] [ ] [ [ ] ] ] [ ] - .2857 0 0.4286 0 0.857 3.