I found the question "Is there a way to get trig functions without a calculator?" when searching for a faster way to calculate Sine.

@AlexPeter's answer included a "Tailored Taylor" representation: $$\sin(x)=x\left(1-\frac{x^2}{3 \cdot 2}\left(1-\frac{x^2}{5 \cdot 4}\left(1-\frac{x^2}{7 \cdot 6}\left(\phantom{\frac{}{}}\cdots\right.\right.\right.\right.$$

The above works very well and is extremely fast when compared to the standard Power-Series usually given for Sine.

Is there a series for Cosine as well? And Secant, CoSecant, Arcsine, Arc-cosine, etc. I want to use it within my calculator program.

Thank you very much.

  • 3
    $\begingroup$ But this is the standard power series for Sine (i.e., the value computed with so-and-so-many terms is the same as the Taylor polynomial of corresponding degree), just in a Horner-like evaluation scheme $\endgroup$ Feb 28, 2019 at 22:12
  • $\begingroup$ The trick is to find the ratios of coefficients in the original series. Among the functions you listed it's feasible for cosine, and I think also arcsine and arccosine, but not for secant or cosecant unless you can easily get (IIRC) Bell numbers. $\endgroup$
    – J.G.
    Feb 28, 2019 at 22:25
  • $\begingroup$ See this question for an arctan algorithm. $\endgroup$ Feb 28, 2019 at 22:30
  • $\begingroup$ @Hagen von Eitzen has given you an important keyword "Horner" (algorithm). Here is another one : CORDIC algorithm for "$\arctan$-like" functions $\endgroup$
    – Jean Marie
    Feb 28, 2019 at 23:23
  • 1
    $\begingroup$ For cosine you get $\;\cos x =1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}\cdots =1-\frac{x^2}{2\cdot 1}\left(1-\frac{x^2}{4 \cdot 3}\left(1-\frac{x^2}{6 \cdot 5}\left(1-\frac{x^2}{8 \cdot 7}\left(\phantom{\frac{}{}}\cdots\right.\right.\right.\right.$ $\endgroup$
    – user376343
    Mar 1, 2019 at 13:15

2 Answers 2


Too long for a comment.

As you know, infinite series are available for all trigonometric functions but, as they are infinite, for a given accuracy, many terms could be required.

What can also be done is to transform them as Padé approximants which write $$f(x) \sim \frac{\sum_{m=0}^n a_m x^m } {1+\sum_{p=1}^q a_p x^p }$$ which are equivalent to $O(x^{n+q+1})$ or even better.

For example $$\sin(x) \sim x \,\frac{1-\frac{29593 }{207636}x^2+\frac{34911 }{7613320}x^4-\frac{479249 }{11511339840}x^6 } {1+\frac{1671 }{69212}x^2+\frac{97 }{351384}x^4+\frac{2623 }{1644477120}x^6}\tag 1$$

Using long division and comparing to the Taylor series, the absolute difference is $$\frac{1768969 }{2986723025814528000}x^{15}$$ which, for $x=\frac \pi 2$ is $\approx 5.18 \times 10^{-10}$.


Note that you can use any algorithm to compute the complex exponential function $\exp$. See this post that details elementary techniques to do so quite efficiently, as well as links to a paper on an advanced technique called AGM iteration.

Then you can easily compute the trigonometric functions, since $\cos(z) = \frac12(\exp(iz)+\exp(-iz))$ and $\sin(z) = \frac1{2i}(\exp(iz)-\exp(-iz))$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.