How are numbers manipulated in a trigonometric function?

502 views

Alright, I understand the definitions of the trigonometric functions, how it is a ratio between the lengths and hypotenuse. However, I wish to deepen my understanding how what goes on behind the scenes when I input sin(x degrees) into my calculator to get an output. How is the calculator able to get from this, e.g.sin(56), to that: 0.829 (3 s.f.)?

In: 11

7 Answers

Anonymous 0 Comments

It depends on the calculator. They may have lookup tables for some inputs, but they’ll have an algorithm for calculating other values.

There are a few algorithms for working out trig functions, but the standard one for calculators is a [CORDIC algorithm](https://en.wikipedia.org/wiki/CORDIC).

CORDIC is a thing that uses some neat tricks to turn vector rotation into addition and division by 2 (which in a binary calculator just involves shifting all the bits). Essentially the calculator takes a vector at a known angle (say 45 degrees and the vector 1/sqrt(2)[1,1]) and then rotates it by some increasingly-small “magic” angles either way until it gets to the desired outcome, calculating the new [x,y] coordinates of the point (which give us the cosine and sine of that angle respectively). And by picking the right angles to rotate through each time this becomes very easy for a calculator to work out (provided it has some stuff stored into it).

If you’re not afraid of a bit of maths, [this article](https://www.allaboutcircuits.com/technical-articles/an-introduction-to-the-cordic-algorithm/) has a pretty decent introduction to calculating trig values with CORDIC.

You are viewing 1 out of 7 answers, click here to view all answers.