You are on page 1of 2

DREXEL UNIVERSITY

Department of Mechanical Engineering & Mechanics


Applied Engineering Analytical & Numerical Methods I
MEM 501/591 - Fall 2010
HOMEWORK #4: Due Thursday, October 28

1. [30 points]
For the classical iterative methods derived in class and given x e J
n
and A e J
nxn
we showed that
x
(k+1)
= Bx
(k)
+ C , (1)
where x
(k)
, x
(k+1)
are the (k)-th and (k+1)-th estimate of the solution to Ax = b.
i) For the Gauss-Seidel (GS) method B = -( + I)
-1
u and C = ( + I)
-1
b. Based on Eq. (1) prove the following recursive
formula:
x
I
(k+1)
= x
I
(k)
+
- u
i]
x
]
(k+1)
- u
i]
x
]
(k)
+b
i
n
]=
-1
]=1
u
ii
(2)
ii) For the Successive over Relaxation (SOR) method B = ( + I)
-1
|-u + (1 - )] and C = ( + I)
-1
b. Based on Eq.
(1) prove the following recursive formula:
x
I
(k+1)
= x
I
(k)
+
- u
i]
x
]
(k+1)
- u
i]
x
]
(k)
+b
i
n
]=
-1
]=1
u
ii
(3)
2. [20 points]
For the Conjugate Gradient (CG) method derived in class, we showed that successive approximations of the solution can be found
by
x
(k+1)
= x
(k)
+
k
d
k
(4)
i) Show that the step length in this method is equal to

k
=
(r
R
, r
R
)
(r
R
, Ad
R
)
. (5)
(Hint: Use the fact that successive residuals in this method are orthogonal.)

ii) Show that if the search direction is d
k
= r
k
+ [
k-1
d
k-1
then
[
k-1
=
(r
R
, r
R
)
(r
R-1
, r
R-1
)
. (6)
(Hint: Use the conjugacy properties of d
k
and the results you obtained in 2.i)
3. [50 points]
Consider the linear system of equations Ax = b, where
A
]
= _
1
+]-1
i i = ]
1 clsc
_ for 1 i, ] 6 and b =
l
l
l
l
l
l
1
2
u
2
1
1
1
1
1
1
1
1
.
Construct the following subroutines. Whenever a tolerance is needed for your computations use the value e 1u
-5
; use the
difference between two successive iterations as your convergence criterion.
i) [10 points]
Jacobi's method.
ii) [10 points]
GS and SOR methods. Use = u.9 for SOR.
iii) [10 points]
Steepest descent method.
iv) [10 points]
CG method.
v) [10 points]
a) Do all iterative methods converge? Explain the results you obtained by using each method.
b) What is the optimal value of for the SORmethod to converge in the least possible iterations? To answer, plot the number
of iterations required by your SOR code to convergence as a function of , if e |u.1,1.9]. Use J = u.u1.
Remark: Recall that you can only use essential built-in commands in MATLAB such as size, length, zeros, eye and
for/if statements. Any multiplication, needs to be in a component form(i.e. A( i , j ) *B( j ) ). Remember to comment
important lines of your code. You should use the subroutines you made in previous homeworks related to all
multiplications of e.g. constant by a vector, etc. Modify the following script to prepare your codes:

f unct i on [ xf i nal , i t ] =J acobi f ( A, b) ; %Si mi l ar l y def i ne GSf ( A, b) , SORf ( A, b) , St eepest f ( A, b) and
Conj ugat ef ( A, b)

m=l engt h( b) ;
maxi t =100; %Maxi mumal l owed number of i t er at i ons
i t =0; %I t er at i on i ndex
cr i t =i nf ; %Cover gence cr i t er i on ( i s def i ned l at er )
.
.
.
whi l e cr i t >10e- 5 & i t <maxi t ; %St ar t t he i t er at i ve scheme
.
.
.
.
end
i f i t ==maxi t
i nf o=' Maxi mumi t er at i on r eached' ;
el se
st r i ng_i t =num2st r ( i t ) ;
i nf o=[ ' Conver ged at i t er at i on ' st r i ng_i t ] %Number of i t er at i on t o conver gence
end

You might also like