Sie sind auf Seite 1von 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

Multiply Row1 by 1 and add to contents of Row3


The new matrix becomes

][

] = [

M3=-(m32/m22) =-(2/4) = -0.5


Multiply Row2 by -0.5
The new matrix becomes
[

][

] =

From the above matrix 0.5(x3) = 8.5,

x3 = 17.

4(x2) + 3(x3) = -5, substituting for x3 = 17,

x2 = -14.

x1 - x2 + 0(x3) =2, substituting for both x2 and x3,

] = [

x1=

b) The method used above fails when we encounter


a division by zero during the forward elimination
process

-12.

round off of values during the forward elimination


process

2.

Using LU Decomposition with partial pivoting


P1 = [

and P1A = [

M21 and M31 have already been found as 0.5 and -0.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 = [

][

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.25(x3) = 4.25

] = [

x3=17.

4(x2) + 3.5(x3) = 3.5, substituting x3 = 17,

x2= -14

2x1 + 2x2 + 3x3= -1, substituting for x2=-14, x3 = 17


12

Solution vector X = [

x1 = -

3.

LU decomposition with complete pivoting

P1A=[

P1=[

] ; Q1= [

M1=[

]= A(1)

Hence P1AQ1M1=[

P2=[

P2A(1)Q2= [

] ; P1AQ1=[

]; Q2= [

] ; M2=[

];

] ;

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
, substituting y3 = -14,

y2= -12

2y1 + 2y2 + 3y3= -1, substituting for y2 =-12, y3 = -14


y1 = 17

Since vector Xk is simply a rearrangement of Yk

Solution vector X = [

4.a Determinant of matrix A


Ax=b as represented below in matrix form
[

][

] = [

but after applying Gaussian elimination method on A, the


resulting upper triangular matrix, B = [
det[B]

b.

=det[A] = 1

0.5 = 2

Inverse of the system A-1

A= [
Then A B= I

]let A-1 = B.

Thus [

][

] = [

Let the first column of B be b11, b21and b31 .


[

][

]= [ ]

By using LU decomposition and solving for


Lz=c,
[

][

] = [ ]z1=1,

2(z1) +z2 = 0. Substituting for z1 = 1, z2= -2.


-(z1)+ 0.5(z2) + z3 = 0. After substituting for both z1 and z2, z3= 2.
z= [

] = [

Solving for Ub= z, where U is the upper triangular matrix


[

][

] = [

0.5(b31)= 2, b31 = 4
4(b21)+3(b31)=-2 , b21=-3.5
b11 b21= 1, b11= -2.5

First column of A-1 =[

Solving for the second column of A-1


[

][

] = [ ]

Lz=c is represented below


[

][

]=[ ]

z1 = 0, z2 = 1 and z3 = -0.5
z=[

Solving for the second column of A-1


Ub = z
[

][

] = [

] solving for b

b12=1, b22= 1 and b32= -1.Second column is [


Solving for the column of A-1

][

][

] = [ ] and solving Lz=c first

] = [ ]

Solving the above for z using forward substitution, z1= 0,


0 and z3= 1

z= [ ]

Solving Ub = z
[

][

] = [ ]

Solving the above for values of b


b33= 2, b32= -1.5 and b31= -1.5
The third column is [

A-1 = [

] but A-1=B.

z2 =

5.
[

Swap row 1 and row 3;


[

][

][

][

[ ]

Case 1,
[

M21 = -(4/7) = -0.5714

-4

-4.5714

-5.143

=-

2.2857
4

5
0

0.4286

0.857

3.7143

M31 = -(1/7) = -0.1429


0.5714

-1

-1.1429

-1.2857

=-

0
[

0.8571

][

][

2.7143

7.4286

-0.4286

-1.3574

Swap row 2 and 3;


[

M32 = -(0.4286/0.8571) = -0.5001

= -3.715
0

0.4286
0

][

Case 2,

0.857
0

0.5004

3.7143
-0.0007

][

[ ]

M21 = -(4/7) = -0.5714

-4

-4.5714

-5.143

=-

2.7143
4

5
0

0.4286

0.857

3.2857

M31 = -(1/7) = -0.1429

-1

-1.1429

-1.2857

=-

1.4286
1

0
[

0.8571

][

][

4
2.7143

8
6.5714

Swap row 2 and 3;


[

M32 = -(0.4286/0.8571) = -0.5001


= -3.2864

-0.4286

-1.3574

0.4286
0

0.857

3.2857

0.5004

0.000383
[

][

Das könnte Ihnen auch gefallen