Cordic method huh? I'll look it up

]]>That idea reminds me of the old Cordic method to compute trig values.

]]>Originally, I thought of it this way: start with the point P= (1,0) and reflect it about the line L through the origin and Q= (1,x/2^n), to produce a point R

now set P equal to Q, and Q equal to R, and repeat. In a way its kind of like rolling a cone of length 1 and circumference x/2^n, through 2^n revolutions until the large end falls onto the point (sin(x),cos(x))

We can describe it as a sequence, a finite one. For, a[0] = 1 / 2^n then we are interested in the nth term of the sequence. For instance a[0] = 1 / 2^20 then a[20], b[20] are our answers.

]]>(edit) also i think it should say that a[M]=sin(x) and b[M]=cos(x), otherwise the above difference equation just describes a sequence, and we don't know where to stop it.

]]>We can represent your algorithm as a coupled set of difference equations:

a[n+1]=2a[n]b[n]

b[n+1]=b[n]^2 - a[n]^2 with b[0]=1 and a[0] = 1 / 65536

Using that I calculated .8414774 and .54030642

]]>suppose we want to find the sine of 1 radian, about 57 degrees.

First we choose a power of 2 that is large relative to the angle. I'll choose 32.

1/32 is fairly small and so sin(1/32) ≈ 1/32, and cos(1/32) ≈ 1.

Now that we know sin(1/32) and cos(1/32) we can use 5 applications of the double angle identities: sin(2x) = 2sin(x)cos(x) and cos(2x)=cos^2(x) - sin^2(x) to get the final sine and cosine!

I worte a simple program to do it for me. Have a look:

sin(1/32): 0.03125 cos: 1

sin(2/32): 0.0625 cos: 0.999023

sin(4/32): 0.124878 cos: 0.994142

sin(8/32): 0.248293 cos: 0.972723

sin(16/32): 0.48304 cos: 0.884541

final (32/32): sin: 0.854537 cos: 0.549085

results by windows calculator:

sin: 0.8414709848078965066525023216303, cos: 0.54030230586813971740093660744298

Hey! Thats pretty close! Of course! you can make it more accurate by choosing a larger power of 2. Choosing 2^10 for instance yields: sin: 0.841881 cos: 0.540566

Its hardly the fastest way to do it, but its easy to understand why it works and I think that makes it fun!

Originally I envisioned this as a series of line reflections. But I eventually realized I was essentially using the double angle formulas. Maybe I'll post a diagram later.