Find an approximately value of ln3 with Taylor
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am going to find the approximately value of ln3 by putting x = 1/3 and sum all the terms with a bigger abs-value than 1e-8. Anyone who know how I should continue my code?
I got the taylorserie of lnx for x = 1 as help in the task.![Skärmavbild 2019-11-29 kl. 11.59.45.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251441/Sk%C3%A4rmavbild%202019-11-29%20kl.%2011.59.45.png)
![Skärmavbild 2019-11-29 kl. 11.59.45.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251441/Sk%C3%A4rmavbild%202019-11-29%20kl.%2011.59.45.png)
![Skärmavbild 2019-11-29 kl. 11.56.13.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251442/Sk%C3%A4rmavbild%202019-11-29%20kl.%2011.56.13.png)
0 comentarios
Respuestas (1)
Raunak Gupta
el 4 de Dic. de 2019
Hi,
You may find below code useful. I am using ln(1-x) expansion of Taylor Series as it is more intuitive to code. It is not be very different from ln(1+x).
tol = 1e-8;
s = 0;
x = 2/3;
count = 1;
while 1
update = (x.^count)./count;
s = s - update;
count = count + 1;
if ~(abs(update) > tol)
return;
end
end
% s is the finalvalue of ln(1/3)
% reversing the sign of s will give ln(3)
0 comentarios
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!