# Is there a formula for sine and cosine?

I'm an Android programmer and am working on a graphing calculator. I have been looking for a formula for sine and cosine to put in there. I have a decent understanding of mathematics but can not seem to find this formula. Any help would be great, thanks.

-
en.wikipedia.org/wiki/CORDIC –  Qiaochu Yuan Feb 23 '12 at 1:45

The best-known formulas are the Taylor series:

-
Thanks so much. –  jersam515 Feb 23 '12 at 1:44
These work well when $x$ is small. One must suspect for larger $x$ there are refinements that are more computationally efficient. –  Michael Hardy Feb 23 '12 at 1:51
You may want to reduce the argument to an angle within 0 and $2\pi$. Then you'd only need a few terms to get a good approximation (you can even reduce it to an angle between $-\pi/2$ and $\pi/2$ and adjust appropriately, using the symmetry of the functions, afterwards). –  David Mitra Feb 23 '12 at 1:51
@David That's why I suggested Bhaskhara's formula. –  Pedro Tamaroff Mar 9 '12 at 23:20

You might want to consider finite expressions too. Particularily

$$\cos \frac{\pi x}{2} = 4\frac{1-x^2}{4+x^4} \text{ ; for} -1 <x<1$$ and

$$\sin x = \frac{{16x\left( {\pi - x} \right)}}{{5{\pi ^2} - 4x\left( {\pi - x} \right)}} \text{ ; for } 0 <x<\pi$$

They give a great approximation: see here.

-