Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

Here is an amusing method for finding the sine of an angle that makes intuitive sense:

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.

*Last edited by mikau (2009-12-07 20:23:22)*

A logarithm is just a misspelled algorithm.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,523

Hi mikau;

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

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

Nice! And of course we can say a[0]=x/2^M for the general case! B)

(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.

*Last edited by mikau (2009-12-08 07:20:26)*

A logarithm is just a misspelled algorithm.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,523

Hi mikau;

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.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

That works too! :]

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))

*Last edited by mikau (2009-12-08 07:46:40)*

A logarithm is just a misspelled algorithm.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,523

Hi mikau;

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

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

you said hello 3 times! ;]

Cordic method huh? I'll look it up

A logarithm is just a misspelled algorithm.

Offline

**devian18****Member**- Registered: 2009-02-24
- Posts: 12

i have no clue about it

Offline