• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

HAKMEM - collection of mathematical curiosities and useful algorithms

ITEM 158 (Gosper, Salamin, Schroeppel):

Using trig identities to calculate trig functions.

Start with arg x
Do x -> 3^(-n)*x to make it small enough to make sin(x) = x a very good approximation.
Set s = sin(x)
Do n times: s = 3*s - 4*s^3
Return s

Likewise, one can do tan(x) as tan(x/2)/(1 - (tan(x/2))^2) and cos(x) = 1 - 2*(sin(x/2))^2

PROGRAMMING ALGORITHMS, HEURISTICS

HARDWARE

All done
 
Back
Top Bottom