Escolar Documentos
Profissional Documentos
Cultura Documentos
As you can see from the bolded line above, the answers for the questions can be obtained as
1. Step-size that gives minimum error is 10#$ .
2. The minimum value of error obtained at that value is 2.83 × 10#*+ .
This problem was formulated in such a way on purpose. If you ended the sum with “n”, you
will get 50% of credit and not 100%.
If you got 50% of marks by solving the problem on your own, you are on the right track.
Alternatively, you could also use the following loop to solve all of this in one go:
for n=[100, 250, 500, 1000]
S=sum([1:n]./[2:n+1]);
disp(S);
end
% Computation
while(err>tol)
fTerm=fTerm*x; % This gets x^i term
fVal=fVal+fTerm;
err=abs(trueVal-fVal);
i=i+1;
end
% Display results
disp([i, fVal]);