<<Up     Contents

Generating trigonometric tables

Redirected from Generating sinus-tables

Tables of trigonometric functions are useful in a number of areas. Before the existence of fast pocket calculators, trigonometric tables were essential for navigation, science and engineering. The calculation of mathematical tables was an important area of study, which led to the development of the first mechanical computing devices.

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:

a[0] = 0
b[0] = 1
a[n+1] = a[n] + d × b[n]
b[n+1] = b[n] - d × a[n+1]
for n = 0,...,N-1, where d = 2π/N.

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

to be written

See also:

External links

wikipedia.org dumped 2003-03-17 with terodump