Check this out! You can feed that equation (or just about any other) into the following site and get source code that evaluates it back. http://www.markworld.com/microtools.html Excellent math (Generate 8 or 16 bit PIC code to evaluate an infix expression. Analyze an IEEE floating point number) also servos. For sin Scott Dattalo has it dead at: http://www.dattalo.com/technical/software/pic/picsine.html as does Eric Smith http://www.brouhaha.com/~eric/pic/sine.html All of this was on the pic FAQ at http://www.piclist.com or directly at: http://204.210.50.240/techref/default.asp?url=microchip/routines.htm#math --- James Newton mailto:jamesnewton@geocities.com 1-619-652-0593 http://techref.homepage.com The Technical Details Site. Members can add private/public comments/pages ($0 TANSTAAFL web hosting) -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Phu T. Van Sent: Monday, January 31, 2000 18:13 To: PICLIST@MITVMA.MIT.EDU Subject: Math Hi. I've got a problem I don't quite know how to tackle. I need to program the following function for a 16F84 : P(n) = x - (x^3/6) + (x^5/120) - (x^7/5040) I don't know what this approximation is called or if it really works the way it's supposed to. I got it from a local math whiz; supposedly it will approximate sine of x where x is the angle in radians. Anyhow, I need a reliable, fast and efficient way to calculate sine in realtime to do navigation. I've heard about lookup tables but apparently that is said to consume a huge amount of memory and processing power. I'd like to stick with the PIC if possible. Any/all inputs appreciated. --Phu T. Van