You are on page 1of 3

ES-361

COMPUTING METHODS IN ENGINEERING

EXERCISE 2

1) Determine the roots of the following simultaneous nonlinear equations:

5x2-y2=0,
y-0.25[sin (x)+cos (y)] = 0.

Use an initial guesses of { 0.120, 0.270 }T and tolerance of 0.5E-3 (Mnwt.for)


Answer: {x}T ={ 0.121, 0.271}T

2) Consider the system

x1 + 7x2 - 4x3 = -51


4x1 - 4x2 + 9x3 = 62 (1)
12x1 - x2 + 3x3 = 8

a) By retaining 4 significant digits, that is, by using 4 figure floating point arithmetic (in
which we express the numbers as  0.xxxxE  xx ), solve the system in equation (1)
by LU decomposition method (LUM) i) without pivoting ii) with partial pivoting (PP).

b) Check the results you obtained in part (a) by using the computer program BKSB.FOR
which may be found in the WEB site
http://www.metu.edu.tr/~azulfu/courses/es361/es361.htm.

Note that the program BKSB.FOR uses LUM with PP.

c) Also, find the determinant of the coefficient matrix in eqn (1) in view of the U part of
the decomposition found in part (a/ii). Check this determinant value using the program
DET.FOR available in the aforementioned WEB site.

1
3) Compute A of
 2 1 2
A  1 2 3
4 1 2

a) by Gaussian elimination method with partial pivoting


1 1 1
b) by LU decomposition method (without pivoting) and using A  U L .

Use 3 figure floating point arithmetic (that is, 3 significant digits) in your computations.

1 1
NOTE: U and L may be found respectively by backward and forward substitutions :

U | I    U | e1   en  backward substitution gives U ,


1

L | I    L | e1   en  
1
forward substitution gives L ,
1  0  0 
0  1   
     
where, e1    , e 2  0 , ……, e n    .
     
   
 0 
0  1
0
4) Solve the following system given in question (1)

x1 + 7x2 - 4x3 = -51


4x1 - 4x2 + 9x3 = 62
12x1 - x2 + 3x3 = 8

by Gaussian elimination method (GEM) i) without pivoting ii) with partial pivoting (PP). (In
calculations, keep 4 significant digits, that is, by using 4 figure floating point arithmetic in
which we express the numbers as  0.xxxxE  xx ).

5) a)If we disregard the multiplications by “0” (zero), show that the # of multiplications (N) in
x    x  x 0   0 
0        

 x   x  (1)
  
     0
 0   0 x   x    x 
  
E F
( nxn ) ( nxn )
upper triangular Lower triangular

is N  n 3 / 3 (2)
m m
NOTE: Recall the formulas :  i  m(m  1) / 2 , i 2
 m(m  1)(2m  1) / 6 (*)
i 1 i 1
HINT: If we disregard zero multiplications, show that the # of multiplications for multiplying
“k”th row of E by the all the columns of F in eqn (1) is (n-k+1)*(n+k)/2.
n
So, we have, for the total # of multiplications, N   (n  k  1)(n  k ) / 2 which in view of
k 1
the formulas (*), gives eqn (2).
b) Consider the augmented matrix
 U | I    U | e1   e n  , (3)
1
whose solution by back substitutions gives U , where U is upper triangular matrix.

QUESTION: If we disregard the multiplications by zero and division a zero number by


nonzero number, show that the number of operations (N) in eqn (3) is
N  n3 / 6 (4)
1
It may be shown that the # of operations for finding L (where L is a lower triangular
matrix) is also given by eqn (4).
c) Now, consider LU decomposition of a matrix “ A ” (nxn) (obtained without pivoting), that
1 1 1
is A  L U . It is obvious that for the inverse of A one can write A U L .
1 1
i) Show that L and U become respectively lower and upper triangular matrices. (HINT:
1
For showing that U is upper triangular, consider eqn (3) ).
1
ii) In view of eqns (2) and (4), show that the # of operations (N) for finding A by equation
1 1 1 1
A  U L is N  n . (Note that the # of operations for finding A
3
directly by the
Gaussian elimination method was N  4n 3 / 3 , which is lager than N  n 3 )

6) Solve the following system;

x1+x2-x3=-3,
6x1+2x2+2x3 =2
-3x1+4x2+x3 =1.

a) Gauss elimination (GAUEL.FOR),


b) Gauss elimination with partial pivoting,
c) LU decomposition with partial pivoting (Use Bksb.forfor LU decomposition with partial
pivoting) .

Answer: {x}T={ -0.25, -0.50, 2.25}T.

7) Use the iterative methods to solve the following system;

-5x1+12x3 = 80,
4x1-x2-x3 = -2,
6x1+8x2= 45.

If necessary, make sure to rearrange the equations to achieve convergence.

a) Jacobi method (Jacobi.for)


b) Gauss--Seidel method (GAUSEIDEL.FOR)

Start with the initial guess of x1 = 2.375, x2 =3.845, x3 = 7.655 and tolerance of 0.5E-4 in
your hand calculations. Use Matlab routines with the initial guess of { 0.0, 0.0, 0.0}T and
tolerance of 0.5E-8.

Answer: {x}T = { 2.375, 3.844, 7.656}T.

You might also like