How are numbers manipulated in a trigonometric function?

461 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.

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.

Anonymous 0 Comments

There’s several useful ways to define trigonometric functions but if you’re looking for a simple one that helps you see the math under the hood:

Sin(x) = (e^(ix)-e^(-ix))/(2i), where “i” in this case is the imaginary unit i.

Anonymous 0 Comments

There’s several useful ways to define trigonometric functions but if you’re looking for a simple one that helps you see the math under the hood:

Sin(x) = (e^(ix)-e^(-ix))/(2i), where “i” in this case is the imaginary unit i.

Anonymous 0 Comments

If you want to deepen your understanding, then it’s good to lose focus on what happens in a calculator and to focus on learning properties of trig functions and how to compute special values.

* How do you compute sin(45)? Well, you gotta setup a triangle and use the Pythagorean theorem to help.

* How do you compute sin(30)? You have to use a different triangle, and you can do it.

* Can you compute sin(15) from this? Maybe the double angle formula can help.

These all give results involving square roots, so maybe you can think of them as roots to polynomials. For instance, since 30×3 = 90 then I can use the triple angle formula for cosine (cos(3x) = 4cos^(3)(x)-3cos(x)) to find cos(30). To do this, set y=cos(30) and note that cos(3×30) = 0 and with this substitution we get 0 =4y^(3)-3y. Solving for this gives the possible solutions y=0, y=sqrt(3)/2 and y=-sqrt(3)/2 which are the solutions.

Maybe we can solve for cos(10) from this same formula as well, but starting with cos(30)? This can then suggest more ways to compute values of trig functions by using these polynomials to do computations. If I know I can get to cos(20) by starting with 90, dividing by 3, dividing by 3, and multiplying by 2, and applying the polynomial results each time. It them seems that if you want to get cos(x), the all you need to do is find a safe starting point and a sequence of divisions and multiplications by whole numbers until you get close enough to x to call the final result “cos(x)”.

In this way, we’re less “doing stuff with x” and more “taking advantage of trigonometry” to do these computations. And this is the basic idea of many algorithms for the trig functions. But focusing on the geometric properties, the ties to algebra through various identities, can give you a more useful understanding from which the algorithms are a fun consequence.

Anonymous 0 Comments

If you want to deepen your understanding, then it’s good to lose focus on what happens in a calculator and to focus on learning properties of trig functions and how to compute special values.

* How do you compute sin(45)? Well, you gotta setup a triangle and use the Pythagorean theorem to help.

* How do you compute sin(30)? You have to use a different triangle, and you can do it.

* Can you compute sin(15) from this? Maybe the double angle formula can help.

These all give results involving square roots, so maybe you can think of them as roots to polynomials. For instance, since 30×3 = 90 then I can use the triple angle formula for cosine (cos(3x) = 4cos^(3)(x)-3cos(x)) to find cos(30). To do this, set y=cos(30) and note that cos(3×30) = 0 and with this substitution we get 0 =4y^(3)-3y. Solving for this gives the possible solutions y=0, y=sqrt(3)/2 and y=-sqrt(3)/2 which are the solutions.

Maybe we can solve for cos(10) from this same formula as well, but starting with cos(30)? This can then suggest more ways to compute values of trig functions by using these polynomials to do computations. If I know I can get to cos(20) by starting with 90, dividing by 3, dividing by 3, and multiplying by 2, and applying the polynomial results each time. It them seems that if you want to get cos(x), the all you need to do is find a safe starting point and a sequence of divisions and multiplications by whole numbers until you get close enough to x to call the final result “cos(x)”.

In this way, we’re less “doing stuff with x” and more “taking advantage of trigonometry” to do these computations. And this is the basic idea of many algorithms for the trig functions. But focusing on the geometric properties, the ties to algebra through various identities, can give you a more useful understanding from which the algorithms are a fun consequence.

Anonymous 0 Comments

might not be how calculators evaluate trig functions, but one way to do it is with an infinite sum.

https://wikimedia.org/api/rest_v1/media/math/render/svg/def345e147219a7892eb8140dfeb1c77b29dce38

the more of these terms you add up, the closer your answer gets to the actual value of sine.