Modern computers and pocket calculators now generate trigonometric function values on demand, using special libraries of mathematical code. Often, these libraries use pre-calculated tables internally, and compute the required value by using an appropriate interpolation method.
Simple look-up tables of trigonometric functions are now mostly used in computer graphics, where accurate calculations are either not needed, or cannot be made fast enough.
A quick, but inaccurate approximation
A quick, but inaccurate, algorithm for calculating a table of N approximations a[n] for sin(2πn/N) and b[n] for cos(2πn/N) is:
Unfortunately, this is not a useful algorithm for generating sine tables, for a number of reasons. It will only work as the number of divisions tends towards infinity, with infinite-precision arithmetic.
For instance, with table-size N=256, the last sine-value is computed to be -0.02438606 instead of 0, and N=1024 gives -0.006124031.
If the sine and cosine values obtained were to be plotted, this algorithm would draw a logarithmic spiral rather than a circle.
Calculating accurate approximations for trigonometric functions
See also:
Search Encyclopedia
|
Featured Article
|