Introduction To Computational Engineering: Min Long
Introduction To Computational Engineering: Min Long
Introduction To Computational Engineering: Min Long
Min Long
Indirect/Iterative Methods
Not required
But good supplements
Introduction to Computation
Matrix Form
Solution:
Step 1: elimination
Eqn (2)-0.5 x Eqn (1)
Introduction to Computation
Uniqueness of Solution
A system of n linear equations in n unknowns has a unique
solution, if the determinant of the coefficient matrix is nonsingular.
It means: no row is a linear combination of other rows.
Introduction to Computation
Gauss Elimination
Elimination phase: obtain an upper triangular matrix U
Back substitution phase: Ux=c can be easily solved by back substitution
Introduction to Computation
To be eliminated
Introduction to Computation
for k = 1:n-1
for i= k+1:n
if A(i,k) ~= 0
lambda = A(i,k)/A(k,k);
A(i,k:n) = A(i,k:n) - lambda*A(k,k+1:n);
b(i)= b(i) - lambda*b(k);
end
end
end
To be eliminated
Introduction to Computation
for k = n:-1:1
b(k) = (b(k) - A(k,k+1:n)*b(k+1:n))/A(k,k);
end
Introduction to Computation
% set of equations
n=length(b)
% number of equations
for k = 1:n-1
for i= k+1:n % Elimination Phase
if A(i,k) ~= 0
lambda = A(i,k)/A(k,k);
A(i,k:n) = A(i,k:n) - lambda*A(k,k:n);
b(i)= b(i) - lambda*b(k);
end
end
end
for k = n:-1:1
% Back subsitution
b(k) = (b(k) - A(k,k+1:n)*b(k+1:n))/A(k,k);
end
disp(b)
% solution
Introduction to Computation
10
Introduction to Computation
11
Reordering:
Find the s=abs(maximum element) for each row, the relative size of any
12
Use your previous Gauss Elimination code (no pivoting) to solve the
Introduction to Computation
13
Introduction to Computation
14
READING ASSIGNMENTS
This note
Ch2.1-2.3, 2.5
Introduction to Computation
15