Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Geometric Methods of Calculating Trigonometric Funtions

110 views
Skip to first unread message

Christopher M. Vanderwall-Brown

unread,
Feb 19, 2009, 8:14:52 AM2/19/09
to app...@support1.mathforum.org
I'm interested in learning the methodology to calculate trigonometric functions without a calculator. I was told by a college chum that the CRC Handbook of Mathematical Tables would include the methodologies to calculate these functions. I listed every single function, law, rule, etc. I could possibly imagine and more, it listed table after tables of calculated trig functions, but it did not show me HOW to calculate them myself.

I admit as an engineering major I do not like to have a subject waved in front of my face and then told..."To calculate sine, press sine x and then..." I about went batty in my lecture course when they tried to explain away sine, cosine, tangent, etc. by means of "pressing the sine button". If I wanted to be taught how to use a calculator I could simply read the instruction manual. What I want to know is HOW to calculate it. Not how to press a bunch of buttons and let a machine calculate it for me. I see this as a great failure in our math education programs around the US...We don't explain and prove these sorts of things and wonder why students don't understand.

Simply put, I understand there are some Taylor series I will learn in calculus that can be used to find sine, cosine, tangent, etc. however, if that was the only way to calculate sine, cosine, tangent, etc. I suspect mathematics did a lot of magic to get where it is today. I discovered through a variety of sources that one can calculate this based on double circles, where one is within another. Secondarily, I've looked at the idea of calculating sine based on chords, where sine of an angle theta is half the chord of twice the angle.

If this is a possible method, then I need a methodology to calculate the chords. If I am given an angle, I am curious how I might use the chord to calculate that angle. I understand that Hipparchus used an arch length of 1, still not sure how he figured the ratio properly, but by using an arc length of 1 he was able to calculate subsequently degrees of an angle. Also Ptolemy's theorem is another possible explanation from what I've been reading. However, no where can I find a quality source to explain this problem.

I can't believe in the 21st century that calculating trigonometric functions could be so difficult. I'm feeling rather like I was deposited in the dark ages of mathematics, where one group is passed needing to know how to calculate it and are fine with letting a calculator solve the problem, or prefer to use calculus to explain things, or who simply don't have a clue about math in general. There should be a relatively rigorous method for calculating these functions. If there wasn't, how on earth did we discover modern mathematics? During the period of Calculus, Descartes, etc. there had to have been a methodology to calculate these functions.

Can someone please enlighten me so I am not so lost?

Sincerely,
-Christopher M. Vanderwall-Brown

K. E. Pledger

unread,
Feb 23, 2009, 8:23:45 AM2/23/09
to app...@support1.mathforum.org
> ....
> Simply put, I understand there are some Taylor series
> I will learn in calculus that can be used to find
> sine, cosine, tangent, etc. however, if that was the
> only way to calculate sine, cosine, tangent, etc. I
> suspect mathematics did a lot of magic to get where
> it is today....

Not magic, but hard work by a lot of very clever people. Look up Taylor series in a calculus text to see the rather elegant series for sine, cosine and inverse tangent.

> .... Secondarily,


> I've looked at the idea of calculating sine based on
> chords, where sine of an angle theta is half the
> chord of twice the angle.
>
> If this is a possible method, then I need a
> methodology to calculate the chords. If I am given an
> angle, I am curious how I might use the chord to

> calculate that angle.... Ptolemy's theorem is


> another possible explanation from what I've been
> reading. However, no where can I find a quality
> source to explain this problem.

Ptolemy, "Almagest" Book I section 10 (the theory) and 11 (the oldest surviving trigonometrical table). If necessary I can give a summary of what he did, but for the present I'll avoid all that typing.

> I can't believe in the 21st century that calculating
> trigonometric functions could be so difficult.

When a subject has been around for 4000 years, why should you expect everything in it to be elementary?

> .... There should be a


> relatively rigorous method for calculating these
> functions. If there wasn't, how on earth did we
> discover modern mathematics? During the period of
> Calculus, Descartes, etc. there had to have been a

> methodology to calculate these functions....

Definitely. My two responses above give you a couple of methods to start with.

Ken Pledger.

mathlover4ever

unread,
Mar 3, 2009, 1:41:57 AM3/3/09
to app...@support1.mathforum.org
I too, have always wondered what the formula was. I have looked online, but you get some near-infinte "sum of" formula. Is there a condensed version of formulas to find sines, cosines, tangents, secants, cosecants, cotangents, arcsines, arcsecants, arccosecants, arcosines, arctangents and arccotangents?

Christopher M. Vanderwall-Brown

unread,
Mar 3, 2009, 7:42:07 AM3/3/09
to app...@support1.mathforum.org
Not to mention versed sine, coversed sine, haversed sine, hacoversed sine, and exsecant. All of which once were highly important but now trivial.

-Chris

Balevsky

unread,
Apr 23, 2009, 5:42:34 PM4/23/09
to app...@support1.mathforum.org
Hello, guys.

I believe I can give a good answer to the question you ask.

If I understand your question correctly, this is the exact question I have been asking myself part of my life. And during that time I have done quite some searches to find a good answer. I've found several methods, but most of them would not satisfy me:

1. Many calculators and computers generally use Taylor's series (plus maybe small tables). This is the fastest method, I believe, but I didn't like it because you need to convert the angle to radians to use that method, and thus the accuracy of the method is limited to the accuracy of your knowledge of PI.

2. Other calculators and computers reportedly use CORDIC algorithm. It is good, clean algorithm, and requires no multiplication. But was not satisfied by CORDIC either, because in order to use it you need to prepare a table of atan(2^(-n)), and some people find it difficult to understand (not me of course, ;-P).

3. And then one day I discovered my own simple algorithm. It is not the fastest one out there, and is not the easiest to use for calculation. But still it is reasonably good, does not require previously calculated values, can be carried to an arbitrary level of accuracy, can calculate sin, cos, tan etc, their inverses, and does not need you to know PI at all. Actually, it can be used to calculate PI, though I am not going to explain in detail how, it is not difficult... In addition, it does not require a specific angular unit to be used, any convenient unit will do.

I was proud of myself and satisfied at last. I give a detailed description below, as I have seen several people here in the net asking essentially the same question.

Of course the method is not at all a secret. I once saw almost exactly the same algorithm published by a math teacher here in the net, but I forgot where I saw it and who the teacher was. Still, I have seen it only once, and I think it deserves more attention.

First, here are some simple things you need in advance:

1. You need to know how to add, subtract, multiply, divide and find square roots or positive numbers which are a little smaller than 1. Not very many people nowadays can find square roots, but the best method I know is the newtons method. I believe that anybody should know that algorithm, and even should be able to discover it without external help, it is not that difficult. Mesopotamian people did, as far as I know. If you like me to show you an easy way of "discovering" the Newtons method for square roots, drop me a letter at b_balevsky at yahoo.com. (I would love to know how many people like what I write here. Or maybe dislike it. Or just hate me... whatever :-))

2. If you have the coordinates of the end points of a linear segment in rectangular coordinate system, you can find the midpoint of the segment by averaging the coordinates. For instance, let's have a segment with end points at (3, 4) and (1, 8). The coordinates of its middle point are (2, 6), because 2 = (3+1)/2 and 6 = (4 + 8) / 2.
And this is the exact location of the midpoint.

3. If you have a segment and one of the ends of that segment is point (0,0) then the coordinates of the other end of the segment (x,y) can give you the length of that segment simply by using the Pythagorean theorem: Length = square_root_of(x * x + y * y). Now suppose you divide both x and y by that length.
By doing this, you have in effect "extended" or "shortened" the segment, but you have _NOT_ changed its slope at all! The new segment has length of exactly 1, meaning its end is on the unit circle.

Those things said, here is how you would use the algorithm:

1. Simplify/transform the problem so that the angle in question is between 0 and 90. This should be easy to to in all cases.

Now you either have got a particular angle and want to know its sin/cos/tan, or you have sine cos or tan, and want to know the angle. All other cases should be easily to reduce to those two. The algorithm is almost the same for both tasks.

Start with two segments. Both will be radii of the unit circle. Initially, one of the segments will be horizontal, starting from (0,0), ending at (1,0). The other will be vertical, starting from (0,0) and ending at (0,1).
During the steps of the algorithm, we will move the ends which lay on the unit circle. Each step will halve the angle between the segments by moving one of the two segments in the middle. We will be careful to choose which of the two segments we move in such a way that the interesting angle A always falls between the segments.
Theoretically, the two segments will never coincide, of course. But in practice, after relatively few steps, they will be sufficiently close together for any practical purpose.

Here is an example: Say we want to calculate sin and cos of angle 17.448 degrees to 3 decimal places. Therefore we will use 4 decimal places for all the steps that follow:

Here is how we proceed:
Initially, the endpoints of the segments will be:
x1 = 1, y1 = 0,
x2 = 0, y2 = 1,

and the angles will be
a1 = 0, a2 = 90 degrees.

Now find the mid-angle between the two:
the new "a" will be midway between a1 and a2, which is
(a1 + a2) / 2, which is 45.

This means, we will have to move the second segment, in order to maintain the 17.44892 between the two segments.
We already know what will be the new angle a2, but we need to calculate also new values for the x2, y2:

Find the midpoint of between the ends of the two segments by averaging the old endpoints of x1,y1 and x2,y2: this gives x = 0.5 and y = 0.5. So the new segment is along the line from (0,0) to (0.5, 0.5), but this segment is too short: we need to move the point (0.0, 0.5) so that it falls on the unit circle thus extending the segment to unit length, while being careful not to change the slope of the segment. This is done by multiplying dividing both coordinates to the length of that short segment. And we calculate the length using the Pythagorean theorem:

length = sqrt(0.5 * 0.5 + 0.5 * 0.5) = sqrt(0.5) = 0.7071

Dividing both coordinates in (0.5, 0.5) by 0.7071 gives the new point (0.7071, 0.7071).

And so we now have:
a1 = 0, x1 = 1, y1 = 0
a2 = 45, x2 = 0.7071, y2 = 0.7071

And this is all we need to proceed further to the next step.

At all times, y1 = sin(a1), x1 = cos(a1),
and similarly y2 = sin(a2), x2 = cos(a2).

We can now see that if y1 and y2 differ by less than 0.001, we have reduced the range sufficiently and we have found our answer.

Here is what we get by continuing this process further:
Each row represents the state of the algorithm between successive steps.

a1 x1 y1 a2 x2 y2
---------------------------------------------------
0 1 0 45 0.7071 0.7071
0 1 0 22.5 0.9239 0.3827
11.25 0.9807 0.1951 22.5 0.9232 0.3827
16.875 0.957 0.2904 22.5 0.9232 0.3827
16.875 0.957 0.2904 19.6875 0.9415 0.3370
16.875 0.957 0.2904 18.2813 0.9495 0.3138
16.875 0.957 0.2904 17.5782 0.9533 0.3021

At the last step, something interesting happened, and it will always happen at some step: when we calculate the midpoint, and project it on the unit circle, we see that we need not move that point at all - it is already on the unit circle within the error of our four decimals.

This means that from now on, we don't have to do all that complicated stuff to calculate the sin we needed: we can just interpolate linearly, and that will directly give us our answer. If anybody wants to keep it simple and stupid, go ahead, continue with the iterations, that wont' hurt, and the result should be the same. I prefer the interpolation:

Sin(a) = y1 + (y2 - y1) * (A - a1) / (a2 - a1)
sin(a) = 0.2999, and even the last digit is correct, though you cannot count on it in general, of course.

The result using a calculator is .29985... and "you have found correct", as the Egyptian scribe Ahmes would have said.

A note about choosing how many digits to use in your calculations:

At each step, the range is halved. So to get accuracy of 1/1024 we will need about 10 steps (as 1/1024 = 1/(2^10)).
Those 10 steps means that the error introduced in the final result will be something like 10 times the error due to rounding in each single step.

So if you needed to calculate 9 digits, this would be about 30 steps (at most), so you may need 2 digits more accuracy in the calculations than the desired accuracy in the result, meaning all calculations should be carried to 11 decimals. That's because you will now accumulate error from 30 steps, and that may be up to 30 times the errors introduced by a single step. That said, the algorithm is very reliable and accurate.

The algorithm can also find angles given the sine. The steps above remain mostly the same, the only thing that changes is the way you decide which segment to move at each step.

In our example, we looked at the mid-angle and see which of the two new ranges contained our angle A.

To calculate inverse sin, for instance, you would look at the mid-y, to calculate inverse cos you would decide using the mid-x, atan can be reduced to asin or acos, etc.

All circular trig functions included. Money-back guarantee ;-)

Christopher M. Vanderwall-Brown

unread,
May 9, 2009, 6:46:51 PM5/9/09
to app...@support1.mathforum.org
Thank you Balevsky.

I figured there way an intuitive way to do this that did not require a calculator. That being said, this doesn't require calculus, and only the most basic of trig, algebra and geometry. This is exactly what I was looking for.

This math nerd gives you a double thumbs up. Now I simply need to get through that logic text and advanced trig to understand the thinking process that went into this. I am impressed. Thank you.

-Chris

-"The best answers always come from the greatest questions."

Balevsky

unread,
May 9, 2009, 6:46:46 PM5/9/09
to app...@support1.mathforum.org
1 REM YOU CAN RUN THIS WITH BASICA.EXE
10 INPUT "Enter angle (0..90 degrees, -1 to quit): ";AN
20 if AN < 0 then system: REM QUITS
100 DIM A(2), X(2), Y(2)
110 A(0) = 0: A(1) = 90
120 X(0) = 1: Y(0) = 0
130 X(1) = 0: Y(1) = 1
135 ST = 0
140 I = 1: IF (A(0) + A(1))/2 > AN THEN I = 0
150 J = 1 - I
160 A(J) = (A(J) + A(I)) / 2
170 X(J) = (X(J) + X(I)) / 2
180 Y(J) = (Y(J) + Y(I)) / 2
190 L = 1 / SQR(X(J) * X(J) + Y(J) * Y(J))
200 X(J) = X(J) * L: Y(J) = Y(J) * L
205 ST = ST + 1
210 IF L <> 1 then 140
220 K = (AN - A(0)) / (A(1) - A(0))
230 ?"SIN = ";Y(0) + (Y(1) - Y(0)) * K; ", ";
240 ?"COS = ";X(0) + (X(1) - X(0)) * K; ", "; ST; " STEPS"
250 PI = 3.141592653589793
260 ?"SIN()=";SIN(AN * PI/180);", COS()=";COS(AN * PI/180)
270 RUN

Balevsky

unread,
May 10, 2009, 7:15:07 PM5/10/09
to app...@support1.mathforum.org
So I did understand your question correctly, then.
I new it.

In case you have any questions about it, just ask.

Christopher M. Vanderwall-Brown

unread,
May 10, 2009, 8:19:00 PM5/10/09
to app...@support1.mathforum.org
Yes you did. I was interested in the methods you were discussing, the method to discover newton's method of calculating square roots.

-Chris

Balevsky

unread,
May 11, 2009, 2:30:19 PM5/11/09
to app...@support1.mathforum.org
Hello Chris

In a previous posting I suggested that anyone interested in this sends me an email, so I can send back the explanation. The explanation was supposed to have a drawing in it, because I think that the geometric point of view is most appealing in this particular case, and I don't really know how to post a drawing here in this forum (is there a way?)

The other important reason was, that I wanted some feedback. I wanted to see how many people are reading what I write and how many are willing to indicate some interest.

It seems that you are the only one who reads this pаrticular forum AND is interested enough to say so. I don't know why.

If you want a peace of advice, here it is: Do not hesitate to attack some real-life problem. You may find that you are much more ready for some challenges than you think you are. Attempting to solve real-life problems will teach you much faster and easier than academic study. But it CAN NOT replace academic study. So my advice is - do both.

And here is what you asked for, (it's algebraic version). I hope you will be able to reconstruct the geometric version on your own. I will try to give my simplest and most insightful description.

You know what an iterative method is. Basically, you have a guess, and you apply the method which is known to improve the guess (it is known to never fail to do that).
The nice thing is that you may repeat the step with the new guess etc.

This is different from traditional methods, and the difference is huge, though it may not be obvious at first sight. I think it is this difference that made calculus possible.

Had the ancient Greeks realized that, the world might have been much different today.

Here is the lesson I've learned from this: Be careful about what you require. It is often the case that you lose many opportunities because your requirements are too strict. If you are willing to relax somewhat your requirements, sometimes you will discover a treasure. On the other hand, if you don't know exactly what you are looking for, you probably won't find it at all.

Notice, there is no contradiction here.
1. You CAN know exactly what is acceptable for you.
2. You CAN struggle not to narrow your search without a good reason.

The algebraic derivation of the "square root" method follows, but first some notation:

old_x: the guess we have

new_x: the improved guess we get from applying the method

A: this is what we search the square root of;

err: the difference between the real square root and our guess (old_x), that is, we define err to satisfy

(old_x + err) = sqrt(A)

Squaring both sides gives
old_x * old_x + 2 * old_x * err + err * err = A

If you can solve this equation for err, we are done in a single step. But in order to do that, we will need to take square roots by some other means, so this is not the way to go.

Another possibility is to relax our requirements.
We give up trying to solve this exact equation. We start attacking a simplified version of it.

The simplified version is almost the same, except that we will get rid of err * err term. Removing the err * err term is the critical step.

The solution of the simplified equation will not be exactly the same, bu the step is acceptable, because:
1. We do not really require the solution to be exact!
2. The smaller err is, the better the match.
3. At the next step, err will hopefully be smaller.

Notice the connecting between points 2 and 3: that is what makes the method work and never fail to provide a significant improvement.

Solving the simplified equation gives for err:

err = (A - old_x * old_x) / (2 * old_x),

or, after s simplification,

err = ((A / old_x) - old_x) / 2

How is this a solution useful?

Well, if we have a good estimate of err, then we can
find a better approximation like this
new_x := old_x + err.

If you substitute here err and simplify, you will find
the Newton's formula for square root, which is
new_x = ((A / old_x) + old_x) / 2

Ant that is all. To represent the same thing geometrically, draw a square, and imagine that the side of that square has length A.

Split the base and the height of the square to two parts - old_x and err. This can be thought of as splitting the area of the square to four parts. If old_x is not much different than A, then the err part of the sides will be small.

The four parts of the area will be:
1. One square with side old_x, corresponding to
the term old_x * old_x in the equation
2. Two rectangles with sides err and old_x,
corresponding to the term 2 * old_x * err
3. One tiny square with side err (the term we ignored).

The geometric viewpoint illustrates beautifully how insignificant err can be - you just compare the area of the small square to the other parts of the big square.

I hope this was interesting and helpful.

I did my best, really :-)

Christopher M. Vanderwall-Brown

unread,
May 11, 2009, 4:20:58 PM5/11/09
to app...@support1.mathforum.org
I'm going to reply in two posts. The first is to tell you whether or not you can input pictures into the forum.

My suggestion is simply attach the picture as a file attachment.

As you can see, the file attachment is a picture and that picture can be viewed by simply clicking.

I tried to figure out what the forum uses for coding. There are so many different scripts. I'm going to have to ask them what the scripting code they use is so I can input files and make HTML/XHTML/XML/CSS/CSS2/CSS3 modifications. Depending on what people use.

Hope that helps.

-Chris

Attachment available at http://mathforum.org/kb/servlet/JiveServlet/download/125-1904094-6705388-555286/Preliminary_Hero_Sketch_by_Dragoon91786.jpg

Balevsky

unread,
May 12, 2009, 8:05:05 AM5/12/09
to app...@support1.mathforum.org
Ha, that's nice.
Let me try...

Cool. Thanks, Chris

Attachment available at http://mathforum.org/kb/servlet/JiveServlet/download/125-1904094-6706074-555350/steinmetz_einstein.jpg

dave

unread,
Nov 24, 2009, 3:43:23 PM11/24/09
to app...@support1.mathforum.org
I am relieved to say the least after hours of searching for how to calculate trig functions. I will study the methods described and will probably have questions as I go through it. I am working on a project because the math is wrong in a computer especially when using the double data type. I want to program math functions using the decimal data type along with accurate trig functions.

Balevsky

unread,
Sep 17, 2010, 7:48:35 AM9/17/10
to app...@support1.mathforum.org
Just wanted to suggest an idea.

There is a similar way to calculate logarithm or its inverse for any base you would like. Can you find it?

Here is a hint: instead of the Pythagorean step, use geometric mean.

Balevsky

unread,
Sep 17, 2010, 7:48:40 AM9/17/10
to app...@support1.mathforum.org
A clarification about the "trigonometric" algorithm above:

The "linear interpolation" step is not cheating, by the following reasons:

1. You can do without it, if it is ok to approximately double the number of steps to reach the answer.

2. It can be shown that, if you dispense with the "linear interpolation shortcut", what you would actually be doing is really a complicated form of linear interpolation (it is interesting to see the equivalence from geometric point of view).

0 new messages