Classic Computer Magazine Archive COMPUTE! ISSUE 53 / OCTOBER 1984 / PAGE 10

Apple Trigonometry

I have an Apple II + on which I was hoping to be able to do some trigonometry homework. I was testing the SIN, TAN, and COS functions and discovered that when I provided a number within parentheses for these functions to evaluate, the number never matched a set of answers that I have in a chart. I looked up these functions in my Apple manual, and all it gave was an explanation of radians and other things I could not comprehend. Could you give me an understandable explanation of what these functions do?

Chuck Knakal

On computers such as the Apple, TI, Commodore, and many others, the trigonometric functions are always expressed in radians. Radians are just another way to measure an angle. For example, instead of expressing an angle as 180 degrees, you would say it was one pi radians.

A complete circle is 360 degrees. In radians, that would be exactly two pi radians (pi is approximately 3.1416). If what you are looking for, though, is an easy way to get answers in degrees from your computer, all you have to do is multiply the angle that you want evaluated by pi and divide that by 180. If you then input that number into the SIN, TAN, or COS functions of your computer, you should get the right answer in degrees.

For example, let's take 90 degrees. The sine of 90 degrees should give you an answer of 1, but since the computer does not work in degrees, PRINT SIN (90) will give you another answer. To get the answer in degrees, just take the 90 and multiply it by 3.1416, then divide the answer by 180. Now take the SIN of that answer and you should get 1. If your computer has a built-in key for pi, use that instead of the approximation because it will give more precise results. For example, on the Commodore VIC and 64, pressing SHIFT and the up-arrow (↑) key will print a pi symbol which can be used in expressions as a constant with the value of pi. On the Atari there's an even simpler way. You can use the DEG statement to switch all calculations to degrees.