Evaluating trigonometric functions in programming pic c

mugunthanselvaraj

Joined Mar 28, 2008
9
In programming pic microcontrollers how can we evalute some trignometric functions like arccos(x). Can we use any mathematical series like taylor series to evaluate ? are there are any other better methods to evalute to get most aproximate values?

steveb

Joined Jul 3, 2008
2,436
In programming pic microcontrollers how can we evalute some trignometric functions like arccos(x). Can we use any mathematical series like taylor series to evaluate ? are there are any other better methods to evalute to get most aproximate values?
Often, the most efficient method is to use lookup tables, assuming you have enough memory to store the tables. You need to carefully determine what your required precision is and how much memory you can devote to the lookup tables. There are efficient methods of indexing the memory to instantly find the function value for a given input, without a search algorithm. Often linear interpolation is used to improve accuracy or limit the size of the table. It is possible to implement linear interpolation without a division operations, which is preferred since division uses much CPU time.