Hi all,
I want to know a why to get sine, using an algorithm that uses only Additon , subtraction , multiplication and division.

Anyone have opinion:

Amr
Posted on 2004-03-22 17:27:19 by amr
Hrm, I have a very faint recollection of something from math classes a while ago... Taylor Polynomials, I think. Scali says so, too :p, and that "the division can even be avoided, if you precalc 1/n! into a table". But don't tell anyone if this turns out to be useful advice, you all know that scali is purely evil ^_^
Posted on 2004-03-22 17:32:32 by f0dder
Searching the forum helps all of us to avoid reinventing the wheel. :)
Posted on 2004-03-22 17:35:38 by Starless
amr,

Perhaps you might want to look at this site. Very interesting. Ratch

http://www.bmath.net/bmath/index.html
Posted on 2004-03-22 21:41:24 by Ratch
Just to explain, if x is in radians,

sin x can be expressed by Maclaurin's series expansion (According to maths notes, but some people calls it Taylor's expansion. Not sure who is right, who is wrong.) to
x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - x^11/11! + ..

So the above link by Starless just attempts approximation using the above expansion with a slight bit of modification...
Posted on 2004-03-23 07:20:13 by roticv
roticv,

The infinite series f(x) = f'(a)(x-a) + f''(a)(x-a)? + ... is called the Taylor series. Expansion around x = 0, that is f(x) = f'0)(x) + f"(0)(x)? + ... is called the Maclaurin series. Ratch
Posted on 2004-03-23 08:13:44 by Ratch
NO i do not consider that Scali is pure evil...

But i do know Taylor series are good ;)
Posted on 2004-03-23 10:54:50 by BogdanOntanu
amr

You may also be interested in looking at the source code of a fixed point math library available at the very bottom of the page at the following link. ALL computations are done strictly in integer math with CPU instructions, i.e. no FPU instructions.

http://www.movsd.com/source.htm

Raymond
Posted on 2004-03-23 11:15:07 by Raymond
BogdanOntanu,

NO i do not consider that Scali is pure evil...

But i do know Taylor series are good

Huh? Ratch
Posted on 2004-03-23 11:35:53 by Ratch
Hi all,

I think you read my mind Raymond,
that's exactly what I need.

thanks
Posted on 2004-03-23 16:51:39 by amr
You're welcome amr. I didn't think it would ever get used. Just ask if you have any question about it.

Raymond
Posted on 2004-03-23 21:18:21 by Raymond