Methods of Computing Trig Functions
Date: 09/07/99 at 00:04:44 From: A reader writes Subject: Solving unknown angle without using table Hello, I'm trying to understand something. The book says "In right triangle ABC, with A as the right angle: tan(C) = c/b" To find the angle C if I know the lengths of 2 sides (b = 3, c = 4), I can use tan(C) = c/b = 4/3 = 1.33. Without using the tables at the back of the book, what would I do next to figure out the actual angle of C when I know tan(C) = 1.33? Thank you.
Date: 09/07/99 at 08:54:35 From: Doctor Rick Subject: Re: Solving unknown angle without using table Hi, David. I'm not sure exactly what your problem is, but I think you're thinking, "What good does it do to define this thing called a tangent, if all I can do with it is look up the answer in a table? I haven't learned anything if I have to look up the answer every time!" Another way to put it: "So how did they come up with the numbers in that table, anyway? And why don't they teach us that?" The fact is, it's not easy to make those tables; in centuries past, people devoted a good part of their lives to calculating the numbers in the table by hand. And now that we have computers, the methods used to compute trig functions (in computers or scientific calculators) make use of things you won't learn for a while yet. But it's good to learn enough about these methods to appreciate the fact that you have tables and calculators. So here is something I wrote for another student who wondered how one can calculate a trig function by hand. I hope it helps you a little. ======== Before we had calculators, we either looked up the answer in a book of tables (I still have mine) or we used a special scale on a slide rule, which is essentially a table on a stick. That begs the question: How were those tables calculated? I know of three methods. I must admit I have never used any of them! A few people dedicated their lives to doing the calculations and putting the results in tables, and the rest of us bought the tables so we could spend our lives doing other things. METHOD 1: The first "trig table" was produced by Ptolemy of Alexandria, Egypt, in the second century AD. It was part of a book called the Almagest, a name given to an Arabic translation, from its Greek nickname "the greatest." This book was used by astronomers for 1000 years. To construct the tables in the Almagest, Ptolemy started with some angles that can be calculated using geometry. He could have used 30 degrees (whose sine is 1/2), but he instead chose to use 36 degrees, whose sine can be found from the construction of a regular pentagon. Then Ptolemy used the equivalent of our half-angle formulas in trigonometry. He repeatedly divided the angle in half until he got a figure for the sine of 1/4 degree. Finally, he built up the sines and cosines of all the angles in steps of 1/4 degree by using the equivalent of our trigonometric sum and difference formulas, which he came up with. METHOD 2: If you want to compute the sine of an angle without computing a whole table full of angles, you can use the second method: a formula called the Taylor series expansion of sin(x). You won't learn how to derive this formula until you take calculus, but it isn't hard to write down: 3 5 7 15 17 x x x x x sin(x) = x - --- + --- - --- + ... - --- + --- ... 3! 5! 7! 15! 17! where, for instance, 5! (5 factorial) is 5 * 4 * 3 * 2. The series goes on forever, but if x is between 0 and pi/2 (and that's really all you need), this many terms (9 of them) gives an answer as good as most calculators. There are Taylor series for cos(x) and arctan(x), also: 2 4 6 14 16 x x x x x cos(x) = 1 - --- + --- - --- + ... - --- + --- ... 2! 4! 6! 14! 16! 3 5 7 x x x arctan(x) = x - --- + --- - --- + ..., where |x| < 1 3 5 7 If |x| > 1, compute arctan(x) = pi/2 - arctan(1/x). The arctangent formula, unfortunately, converges VERY slowly near x = 1 (you'd need a huge number of terms), so it's not very useful as it stands. The tangent, of course, can be calculated from the sine and cosine. The inverse sine and cosine can be computed from the inverse tangent: arcsin(x) = arctan(x/sqrt(1-x^2)) arccos(x) = pi/2 - arctan(x/sqrt(1-x^2)) METHOD 3: There is a Web page that explains in quite a bit of detail how calculators themselves calculate sine and cosine. There is a way that takes less calculation than the Taylor series. It's called the CORDIC algorithm, and it requires computing about 100 numbers and storing them in the calculator's memory - something it can do, but you and I wouldn't like it so much. Also this method is easier when you work with binary numbers, which calculators do but you and I don't. So for people, the Taylor series method would probably be better, but for calculators the CORDIC method is a snap. Here is the Web page. It starts out explaining the Taylor series method, before presenting the CORDIC method. How Does Your Calculator Work? (Jeff Morgan) What I haven't seen yet is how computers calculate the inverse tangent. So those are the three methods I know of: - Ptolemy's method of building a table using half-angle and sum and difference formulas; - the Taylor series method to calculate one sine or cosine with a nice formula; - the CORDIC method that calculators use. I still prefer a calculator or a table, but it is satisfying to know how I COULD do it myself if I had to.