How many iterations of Taylor series for n correct decimal digits

2.9k Views Asked by At

I'm using Taylor series to estimate trigonometric functions. So I need to know exactly how many iterations of Taylor series (say for sine) are needed for n decimal digits precision?
(I'm writing a calculator program)
Thanks in advance

1

There are 1 best solutions below

2
On

The answer depends heavily on the distance between the point where you are taking the Taylor series (presumably at$~0$) and the value$~x$ for which you want to compute $\sin x$. The larger $|x|$, the worse the performance of the Taylor series, and the more terms are needed for a reasonable approximation. You may of course use the periodicity of the sine function to limit $|x|$ (supposing $x$ is real) before invoking your approximation.