100%
APM2613
EXAM PACK
DISTINCTION QUALITY
UNISA EXAM
, lOMoARcPSD|59991305
UNIVERSITY EXAMINATIONS
JANUARY/FEBRUARY 2025
APM2613
Numerical Methods I
____________________________________________________________________
Welcome to APM2613 exam.
Examiner : DR LC MASINGA
Internal Moderator: PROF AR ADEM
External Moderator:
Total marks: 100
Duration: 2 Hours
, lOMoARcPSD|59991305
Question 1 [30 marks]
Consider the linear system
√ √ √
πx1 − e x2 + 2x3 − 3x4 = 11
2 2 3
√ π x1 +√e x2 − e x3 +
√ 7 x4 = 0
5x1 − 6x2 +√x3 − 2x4 = √π
π 3 x1 + e2 x2 − 7x3 + 19 x4 = 2
whose actual solution is x = (0.788, −3.12, 0.167, 4.55)T . Carry out the following computations using
4 decimal places with rounding:
(1.1) Write the system as a matrix equation. (2)
(1.2) Solve the system using:
(a) Gaussian elimination without pivoting. (7)
(b) Gaussian elimination with scaled partial pivoting. (7)
(c) Basic LU decomposition. (7)
(1.3) Determine the number of arithmetic operations (multiplication/ division, addition/subtraction)
in (1.2)(a) above. (3)
(1.4) By comparing the residual vectors based on the approximate solutions obtained in (1.2)(a),
(b) and (c), which method gave the best approximation. (4)
Solution 2025
(1.1) First we write the given system such that the coefficients are in decimal form, with four decimal
places values:
3.1416x1 − 2.7183 x2 + 1.4142x3 − 1.7321x4 = 3.3166
9.8696x1 + 2.7183 x2 − 7.3891x3 + 0.4286x4 = 0
2.2361x1 − 2.4495x2 + x3 − 1.4142x4 = 3.1416
31.0063x1 + 7.3891x2 − 2.6458x3 + 0.1111x4 = 1.4142
, lOMoARcPSD|59991305
From the above system we deduce the matrix form
3.1416 −2.7183 +1.4142 −1.7321 x1 3.3166
9.8696 2.7183 −7.3891 0.4286 x2 0
x3 = 3.1416
2.2361 −2.4495 1 −1.4142
31.0063 7.3891 −2.6458 0.1111 x4 1.4142
(1.2) (a) To perform Gaussian elimination we start with the augmented matrix
3.1416 −2.7183 1.4142 −1.7321 3.3166
9.8696 2.7183 7.3891 0.4286 0
C= 2.2361 −2.4495
1.0000 −1.4142 3.1416
31.0063 7.3891 −2.6458 0.1111 1.4142
As an example the first reduction, the first set of multipliers is obtained using
for i=2:4
m(i,1)=C(i,1)/C(1,1)
end
after initialising the m-matrix as M = zeros(4).
The underlying manual computations are:
m21 = C(2, 1)/C(1, 1); m31 = C(3, 1)/C(1, 1); m41 = C(4, 1)/C(1, 1)
The first reduction of rows R2 to R4 using the first row is computed using the Mat-
lab/Octave code
for i=2:4
C(i,:)=C(i,:)-m(i,1)*C(1,:)
end
which yields
3.1416 −2.7183 1.4142 −1.7321 3.3166
0 11.2581 2.9463 5.8701 −10.4194
C (1)
0 −0.5147 −0.0066 −0.1813 0.7809
0 34.2176 −16.6034 17.2062 −31.3193
Comment:
It is very important to note the structure of the reduction formula to reduce Row j using
Row i: Rj = Rj − mji Ri for j = i + 1, . . . , n for (some people mix this up and end up with
wrong values)
The command C(i,:)=C(i,:)-m(i,2)*C(2,:) for i = 3, 4 will perform the next row reduction of
R3 and R4 using R2 to yield
3.1416 −2.7183 1.4142 −1.7321 3.3166
0 11.2581 2.9463 5.8701 −10.4194
C (2) =
0 0 0.1281 0.0870 0.3046
0 0 −25.5582 −0.6354 0.3492
APM2613
EXAM PACK
DISTINCTION QUALITY
UNISA EXAM
, lOMoARcPSD|59991305
UNIVERSITY EXAMINATIONS
JANUARY/FEBRUARY 2025
APM2613
Numerical Methods I
____________________________________________________________________
Welcome to APM2613 exam.
Examiner : DR LC MASINGA
Internal Moderator: PROF AR ADEM
External Moderator:
Total marks: 100
Duration: 2 Hours
, lOMoARcPSD|59991305
Question 1 [30 marks]
Consider the linear system
√ √ √
πx1 − e x2 + 2x3 − 3x4 = 11
2 2 3
√ π x1 +√e x2 − e x3 +
√ 7 x4 = 0
5x1 − 6x2 +√x3 − 2x4 = √π
π 3 x1 + e2 x2 − 7x3 + 19 x4 = 2
whose actual solution is x = (0.788, −3.12, 0.167, 4.55)T . Carry out the following computations using
4 decimal places with rounding:
(1.1) Write the system as a matrix equation. (2)
(1.2) Solve the system using:
(a) Gaussian elimination without pivoting. (7)
(b) Gaussian elimination with scaled partial pivoting. (7)
(c) Basic LU decomposition. (7)
(1.3) Determine the number of arithmetic operations (multiplication/ division, addition/subtraction)
in (1.2)(a) above. (3)
(1.4) By comparing the residual vectors based on the approximate solutions obtained in (1.2)(a),
(b) and (c), which method gave the best approximation. (4)
Solution 2025
(1.1) First we write the given system such that the coefficients are in decimal form, with four decimal
places values:
3.1416x1 − 2.7183 x2 + 1.4142x3 − 1.7321x4 = 3.3166
9.8696x1 + 2.7183 x2 − 7.3891x3 + 0.4286x4 = 0
2.2361x1 − 2.4495x2 + x3 − 1.4142x4 = 3.1416
31.0063x1 + 7.3891x2 − 2.6458x3 + 0.1111x4 = 1.4142
, lOMoARcPSD|59991305
From the above system we deduce the matrix form
3.1416 −2.7183 +1.4142 −1.7321 x1 3.3166
9.8696 2.7183 −7.3891 0.4286 x2 0
x3 = 3.1416
2.2361 −2.4495 1 −1.4142
31.0063 7.3891 −2.6458 0.1111 x4 1.4142
(1.2) (a) To perform Gaussian elimination we start with the augmented matrix
3.1416 −2.7183 1.4142 −1.7321 3.3166
9.8696 2.7183 7.3891 0.4286 0
C= 2.2361 −2.4495
1.0000 −1.4142 3.1416
31.0063 7.3891 −2.6458 0.1111 1.4142
As an example the first reduction, the first set of multipliers is obtained using
for i=2:4
m(i,1)=C(i,1)/C(1,1)
end
after initialising the m-matrix as M = zeros(4).
The underlying manual computations are:
m21 = C(2, 1)/C(1, 1); m31 = C(3, 1)/C(1, 1); m41 = C(4, 1)/C(1, 1)
The first reduction of rows R2 to R4 using the first row is computed using the Mat-
lab/Octave code
for i=2:4
C(i,:)=C(i,:)-m(i,1)*C(1,:)
end
which yields
3.1416 −2.7183 1.4142 −1.7321 3.3166
0 11.2581 2.9463 5.8701 −10.4194
C (1)
0 −0.5147 −0.0066 −0.1813 0.7809
0 34.2176 −16.6034 17.2062 −31.3193
Comment:
It is very important to note the structure of the reduction formula to reduce Row j using
Row i: Rj = Rj − mji Ri for j = i + 1, . . . , n for (some people mix this up and end up with
wrong values)
The command C(i,:)=C(i,:)-m(i,2)*C(2,:) for i = 3, 4 will perform the next row reduction of
R3 and R4 using R2 to yield
3.1416 −2.7183 1.4142 −1.7321 3.3166
0 11.2581 2.9463 5.8701 −10.4194
C (2) =
0 0 0.1281 0.0870 0.3046
0 0 −25.5582 −0.6354 0.3492