Tutorial 01
Tutorial 01
Tutorial
1. Consider the linear system
Ax = b, (1)
where
4.81 −5.92 1.11 0.0
A = 0.007 61.2 0.093 and b = 61.3 .
Use Gaussian elimination with partial pivoting to solve (1), rounding to three
significant digits after each intermediate calculation.
where
9.18 −6.27 1.22 16.67
A = 71.4 2.02 0.18 and b= 69.56 .
Use Gaussian elimination with partial pivoting to solve (2), rounding to three
significant digits after each intermediate calculation.
3. Trace the MATLAB function given below and state what it actually does? Use
−1 −2 1
A = −2 −1 2 .
−3 6 7
Page 1 of 4
MATH 2346C - Computational Linear Algebra Tutorial
Q(i,j) = A(i,j)-P(i,1:i-1)*Q(1:i-1,j);
P(j,i) = (A(j,i)-P(j,1:i-1)*Q(1:i-1,i))/Q(i,i);
end
end
function A=genmat(a)
n=length(a);
for i=1:n
for j=1:n
A(i,j)=a(rem(n-i+j,n)+1);
% rem is a built-in MATLAB function.
% rem(X,Y) returns the remainder after division
% of X by Y.
end
end
(a) Apply the function to the vector x = 4 2 6 8 .
(b) What is the nature of the output generated by the function?
ℓ=1
while (A(ℓ, ℓ) 6= 0) & (ℓ ≤ n − 1)
δ(ℓ + 1 : n) = A(ℓ + 1 : n, ℓ)/A(ℓ, ℓ)
A(ℓ + 1 : n, :) = A(ℓ + 1 : n, :) − δ(ℓ + 1 : n)A(ℓ, :)
ℓ=ℓ+1
end
Page 2 of 4
MATH 2346C - Computational Linear Algebra Tutorial
1 √
√ kAk∞ ≤ kAk2 ≤ nkAk∞ .
n
8. Let X, Y ∈ Rn×2 .
Page 3 of 4
MATH 2346C - Computational Linear Algebra Tutorial
10. (a) Find the ∞-norm and 2-norm of x = [−2, 5 − 12i, 0, 5i]T .
(b) Find the 1−norm of the Hilbert matrix of order 4.
where
b1 c1
a2 b2 c2
A= . .. . .. . ..
,
an−1 bn−1 cn−1
an bn
and x, f ∈ Rn , can be solved by decomposing the coefficient matrix A in the
form
A = LU,
where
q1 1 r1
p2 q2 2 r2
L= .. ..
and U = .. ..
.
. .
. .
pn−1 qn−1 n − 1 rn−1
pn qn n
After A has been factored, we can solve for x by using a two-step process. First
we let z = Ux and solve the system Lz = f for z. Once z is known, we solve
Ux = z for x.
Write a MATLAB/Octave function called mylu to solve (3) using the decomposi-
tion method described above. The user must input the three non-zero diagonals
of A and the the right-hand-side vector f. The output of mylu is the solution
vector x.
Page 4 of 4