STUDENT NO
APM1513
ASSIGNMENT 01
TEBOGO NDHLOVU
, 1.1
To evaluate the series 1 − 1/3 + 1/5 − 1/7 + 1/9 − ... − 1/1003 in GNU Octave, we
can use the following code:
/// octave
result = 0;
for i = 1:1003
result = result + ((-1)^(i+1))/(2*i-1);
end
disp(result);
///
When running this code in GNU Octave, we will get the result of the series.
1.2
1.3
APM1513
ASSIGNMENT 01
TEBOGO NDHLOVU
, 1.1
To evaluate the series 1 − 1/3 + 1/5 − 1/7 + 1/9 − ... − 1/1003 in GNU Octave, we
can use the following code:
/// octave
result = 0;
for i = 1:1003
result = result + ((-1)^(i+1))/(2*i-1);
end
disp(result);
///
When running this code in GNU Octave, we will get the result of the series.
1.2
1.3