Article 5Q9VD Filling in gaps in a trig table

Filling in gaps in a trig table

by
John
from John D. Cook on (#5Q9VD)

The previous post shows how you could use linear interpolation to fill in gaps in a table of logarithms. You could do the same for a table of sines and cosines, but there's a better way. As before, we'll assume you're working by hand with just pencil, paper, and a handbook of tables.

Linear interpolation

Suppose you want to find the sine of 12.3456 and you have a table of sines for angles in increments of 0.1. In Table 4.10 of A&S we find

sin 12.3 = 0.21303 03862 74977
sin 12.4 = 0.21473 53271 67063

If we were to use linear interpolation, we'd estimate

sin 12.3456 = sin 12.3 + 0.456(sin 12.4 - sin 12.3) = 0.21380 78393 21768

which is accurate to six decimal places.

Better aproach

Another approach would be to use the identity

sin( + ) = sin cos + cos sin

rather than linear interpolation, setting = 12.3 and = 0.0456. We can look up the sine and cosine of in our table, but how do we find the sine and cosine of ?

The cosine is easy: set it to 1. For a small angle x (in radians) the cosine of x is approximately 1 with an error of less than x^2/2. In radians,

= 0.0456 /180 = 0.00079 58701 38909

and so the truncation error in approximating cos with 1 is about 3*10-7.

Computing the sine of is easy, but it requires converting to radians. You could probably find the conversion factor in your handbook, e.g. in Table 1.1 of A&S.

0.0456 = 0.0456 * 0.01745 32925 19943

Once is in radians, sin = with an error of less than ^3/6 (see here).

Putting the pieces together we have

sin( + ) = sin 12.3 * 1 + cos 12.3 *

which, using the numbers above, gives us 0.21380785249034476, which is off by about 6*10-8.

More accuracy

If we want even more accuracy, we need to find the weakest link in our calculation. The error in approximating sin as is on the order of ^3 while the error in approximating cos as 1 is on the order of ^2, so the latter is the largest source of error.

If we approximate cos as 1 - ^2/2, the error is on the order of 4, and the weakest link would be the sine approximation which has error on the order of ^3, which is still quite small. The overall error in computing sin 12.3456 would be less than 10-10 if we use this higher order approximation for cosine .

Compare and contrast

Let's go back to approximating the cosine of a small angle by 1 and compare the two approximation approaches above.

Linear interpolation:

sin 12.3456 = sin 12.3 + 0.456(sin 12.4 - sin 12.3)

Addition formula:

sin 12.3456 = sin 12.3 + 0.0456 (/180) (cos 12.3)

The the second terms in the two approaches are

0.0456(sin 12.4 - sin 12.3)/0.1

and

0.0456 (/180) (cos 12.3).

The two are similar because

(sin 12.4 - sin 12.3)/0.1 (/180) (cos 12.3).

The term on the left is the difference quotient for sine at 12.3 with step h = 0.1 and the term on the right is the derivative of sine at 12.3.

Wait, isn't the derivative of sine just cosine? It is when you're working in radians, which is why calculus almost always uses radians, but when you work in degrees, the derivative of sine is /180 times cosine.

What this shows is that if you approximate cosines of small angles as zero, the sum formula reduces to a one-term Taylor approximation.

The post Filling in gaps in a trig table first appeared on John D. Cook.f5lq8tWARSs
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments