Taylor serie of ln x:
ln x = (x − 1) − ((x − 1)^2)/ 2 + ((x − 1)^3)/ 3 − . . .
I need to find an approximately value of ln 3. The question suggested that we should replace x with 1/3 and then take the sum of all terms with absolute value bigger than 1e-8.
The questions suggested solution:
tol=1e-8; s=0; i=0;term=;while abs(term) > tols=s+term;i=i+1;term=...;enddisp(-s)
What i've tried
tol=1e-8; s=0; i=1;term = -2./3;while abs(term) > tols = s + term;i=i+1;term = ((-2./3).^i)./i;enddisp(-s)
My code gives the answear 0.51. The answear to ln 3 is 1.098…
How do i solve this?
Best Answer