| |||||
Although it is outside the scope of this book to explain why, it is important to note that you can approximate trigonometric functions using an approximation of an infinite polynomial known as the Taylor series. The Taylor series expansions for sine and cosine are shown next .
(2.6) Taylor series expansions. |
These equations have an infinite number of terms, but you don't normally have an infinite amount of time. Therefore, you want to approximate the value by taking a set number of terms. You can usually get by with a small number of terms; you just need to understand how they converge. Figure 2.10 shows several graphs of sine using different numbers of terms in the Taylor series. As you can see, four terms are sufficient to get decent results for values in the interval of -pi to pi.
Obviously, four terms are not sufficient for any value outside the -pi to pi interval, but remember that these functions are periodic. Therefore, any value of theta can be mapped into that interval using the following equation.
(2.7) Mapping angle values back to a limited range. |
The basic idea is that it shifts theta by pi and finds the modulo of the result and 2pi. It then multiplies that by 2pi and subtracts pi. The result is the equivalent value in the range of -pi to pi. Equations 2.6 and 2.7 can be used to compute results for any angle value with relatively few terms. When you do this yourself, experiment with the number of terms until you get the accuracy you need.
| |||||