=========================preview======================
(MATH230)SampleSolutions.pdf
Back to MATH230 Login to download
======================================================
MATH 230 Suggested Solutions to Sample Questions May 26, 2003
1. (a) For the matrix
. 1 23. A = .152 .
..
3 36
(1) Find U by performing row operations on A.
. 1 23.. 3 36..336..33 6 .
R1 .R3m21 =.1/3 m32 =1/6
A = .152 .
.... .152 .
...... 064 ...... 06 4 . = U
.... .. .
m31 =1/3
3 36 1 23 011 001/3
(2) Then .nd L.
........... . .... . ...
R1 .R3m21 =.1/3 m32 =1/6
.. ..
...... . .
...... .1/3 . . ...... .1/3 ..
.. .. m31 =1/3 ... .
... ... 1/3 .. 1/31/6 . . 1 00.
Fill in
....... .1/310. = L
1s and 0s .
1/31/61
(3) Finally, .nd P by performing only row interchanges.
.100..001.
R1 .R3
010 .
.... 010. = P
.. .
001 100
(b) ALL necessary MATLAB expressions:
A=[1,2,3; -1,5,2; 3,3,6]; [L,U,P] = lu(A);
2. (a) Partial pivoting reduces error propagation by avoiding small pivots.
(b)
Refer to bksub.m on lecture notes page 48.
(c)
Consider the equation AT Ax = AT b and the decomposition PA = LU.
PA = LU (1.1) =. AT P T = UT LT . (1.2)
Mutiply (1.2) by (1.1) on the left gives, using the fact that P T P = I,
AT (P T P )A = UT LT LU =. AT (I)A = U T LT LU =. AT A = UT LT LU.
Thus the equation AT Ax = AT b becomes UT LT LUx = UT {LT [L(Ux)]} = AT b and its equivalent to the set of equations UT w = AT b, (Lower triangular system) LT z = w, (Upper triangular system) Ly = z, (Lower triangular system) Ux = y. (Upper triangular system) The MATLAB script without using matrix inverse or division is then given below. Script .le SampleQ2c.m :
A = % Define A b = % Define b [L,U,P] = lu(A); w = fwsub(U,A*b); z = bksub(L,w); y = fwsub(L,z); x = bksub(U,y);
3. (a) The coe.cient matrix A of the given linear system is
. ..
4 .0.51 .1
1 .20.30.6
A =
.
32.593
.
.30 1 .6
Then A is diagonally dominant since
|4| > 2.5= |.0.5| + |1| + |.1|,
|.2| > 1.9= |1| + |0.3| + |0.6|, |9| > 8.5= |3| + |2.5| + |3|, |.6| > 4= |. 3| + |0| + |1|.
This implies that .M.. < 1 and hence the Jacobi iteration is convergent. (Remark: The matrix M = .A.1A2 where A1 = diag(diag(A)), and A2 = A.A1.)
1
(b) The complete MATLAB implementation seidel.m is given below. Function .le seidel.m :
function x=seidel(A,b,x0,delta) if nargin<4, delta=1e-10; end
A1 = tril(A); % A1 is lower triangular part
A2 =A-A1; r = Inf; % Set r to be a large number x = x0;
while r > delta
x=A1 \( b-A2*x);
r = norm( b-A*x );
end
4. (a) The linear system Ax = b is of the form
.a11 a12 a13 ... a1n ..x1 ..b1 . a21 a22 0 ... 0 x2 b2
......
A = ..a31 0 a33 ... 0 ....x3 ..= ..b3 ........ . ... ... .
..... . .
.... .. ... ... .
. ... ..
an1 00 ... ann xn bn
Note that for i =2, 3,...,n, xi only depends on two entries of A, ai1 and aii, i.e.,
bi . ai1x1
xi = . aii
Substituting this into the .rst equation, we can .rst solve x1.
a11x1 + a12x2 + a13x3 + + a1nxn = b1;
b2 . a21x1 b3 . a31x1 bn . an1x1
a11x1 + a12 + a13 + + a1n = b1; a22 a33 ann a12 a13 a1n
a11x1 +(b2 . a21x1