The Maclaurin series expansion for the natural log of 1 x u
The Maclaurin series expansion for the natural log of (1 + x) up to some order n is given by 1n (1+x) = x - x^2/2 + x^3/3 - x^4/4 + x^5/5 - ...x^n/n, for |x|
Solution
function approx=natlogApprox(x,n)
approx=0.0
i=1
%LABEL abc
if(i<=n)
if(i%2==1)
approx=approx+((x^i)/i)
end
if(i%2==0)
approx=approx-((x^i)/i)
end
i=i+1
if(i<=n)
goto(\'abc\')
end
end
