Ch2-SL2-Linear System-Iterative
Ch2-SL2-Linear System-Iterative
Engineering
Chapter Two
Solutions to Linear System
Iterative Method
Solution of Linear System by Iterative Method
Gauss-Seidel formula
1 1
𝑥 = 16 + 3𝑦 − 2𝑧 𝑥𝑛+1 = 8 16 + 3𝑦𝑛 − 2𝑧𝑛
8
1 1
𝑦 = −9 + 2𝑥 − 𝑧 𝑦𝑛+1 = −9 + 2𝑥𝑛+1 − 𝑧𝑛
8 8
1 1
𝑧= [1 + 2𝑥 − 4𝑦] 𝑧𝑛+1 = 1 + 2𝑥𝑛+1 − 4𝑦𝑛+1
10
10
c.
Starting with initial values 𝑥0 = 1.5, 𝑦0 = −1, 𝑧0 = 1
When 𝑛 = 0, we have 1
𝑥𝑛+1 = 8 16 + 3𝑦𝑛 − 2𝑧𝑛
1 1
𝑥1 = 8 16 + 3 −1 − 2 1 = 1.375 𝑦𝑛+1 = 8 −9 + 2𝑥𝑛+1 − 𝑧𝑛
1 1
𝑦1 = −9 + 2 1.375 − 1 = −0.906 𝑧𝑛+1 = 10 1 + 2𝑥𝑛+1 − 4𝑦𝑛+1
8
1
𝑧1 = 10 1 + 2 1.375 − 4 −0.906 = 0.737
For 𝑛 = 1, we have
1
𝑥 2 = 8 16 + 3 −0.906 − 2 0.737 = 1.476
1
𝑦2 = 8 −9 + 2 1.476 − −0.906 = −0.848
1
𝑧2 = 10 1 + 2 1.476 − 4 −0.848 = 0.734
Solution to 2 d.p. is
𝑥 = 1.48, 𝑦 = −0.85, 𝑧 = 0.73.
d. MATLAB
>> clear
>> x(1)=1.5; %Initial values of x, y, z
>> y(1)= -1;
>> z(1)=1;
>> iter(1)=0;
>> for n=1:4
iter(n+1)=n;
x(n+1)=(16+3*y(n)-2*z(n))/8;
y(n+1)=(-9+2*x(n+1)-z(n))/8;
z(n+1)=(1+2*x(n+1)-4*y(n+1))/10;
end
>> Solution = [iter',x',y',z’]
Solution =
0 1.5000 -1.0000 1.0000
1.0000 1.3750 -0.9063 0.7375
2.0000 1.4758 -0.8482 0.7345
3.0000 1.4983 -0.8422 0.7366
4.0000 1.5000 -0.8421 0.7368
SAMPLE MCQ
1. To solve the system of equation by iterative method, the system must be in
a) Diagonally Dominant
b) Iterative equation
c) Maximum value eqation
d) None