Trigonometric Tables - A Quick, But Inaccurate, Approximation

A Quick, But Inaccurate, Approximation

A quick, but inaccurate, algorithm for calculating a table of N approximations sn for sin(2πn/N) and cn for cos(2πn/N) is:

s0 = 0
c0 = 1
sn+1 = sn + d × cn
cn+1 = cnd × sn

for n = 0,...,N − 1, where d = 2π/N.

This is simply the Euler method for integrating the differential equation:

with initial conditions s(0) = 0 and c(0) = 1, whose analytical solution is s = sin(t) and c = cos(t).

Unfortunately, this is not a useful algorithm for generating sine tables because it has a significant error, proportional to 1/N.

For example, for N = 256 the maximum error in the sine values is ~0.061 (s202 = −1.0368 instead of −0.9757). For N = 1024, the maximum error in the sine values is ~0.015 (s803 = −0.99321 instead of −0.97832), about 4 times smaller. If the sine and cosine values obtained were to be plotted, this algorithm would draw a logarithmic spiral rather than a circle.

Read more about this topic:  Trigonometric Tables