When I type in sin(45) into a calculator I get the value 0.707. When I type in sin(135) into a calculator I also get 0.707. What is the procedure that creates the same value in both cases? Is it some if, then function? ie if x>90 minus 90 sort of thing?? I hope I am clear with what I am asking. Any insight would be greatly appreciated. Many thanks.
-
1@JMoravitz: I think that the question you linked to, doesn't address what OP is asking. – Martin Argerami May 02 '19 at 13:58
-
@MartinArgerami Possible duplicate of Why is $\sin(x) = \sin(180^{\circ}-x)$ – YuiTo Cheng May 02 '19 at 14:02
-
Different calculators may calculate the same thing in slightly different ways. The specific coding may be a slight variation that yields a mathematically equivalent result. I have not seen the coding for a particular calculator, but converting a number to radians and then calculating using the first few terms of the Power Series expansion would likely get as rapid a result as first converting to an angle in the first quadrant and then applying the Sine function. – SlipEternal May 02 '19 at 14:03
-
@YuiToCheng: that's more approximate, but OP is not asking why it happens, since he doesn't even seem to know the relation exists. – Martin Argerami May 02 '19 at 14:06
-
@MartinArgerami: the OP is clearly thinking in programmatic terms. – May 02 '19 at 14:07
-
1The question is about the exploitation of symmetries (not their justification), which is not addressed in the questions referred to. – May 02 '19 at 14:18
3 Answers
Calculators use built-in algorithms to compute this kind of functions. These can be pretty sophisticated, and the quadrant discussion is probably the easiest part.
The first step in the computation is to divide the argument by a quarter turn (whatever the angular unit). Then you take the modulo $4$ of the integer part, and obtain a number normalized to the range $[0,4)$; think that the argument could as well be $1000000°$ or $-2345.33$ radians.
The integer part tells you the quadrant and which symmetry rules you can apply. In the end, all angles can be reduced to the first quadrant.
From this, the sine/cosine can be evaluated by means of predefined polynomials, or by the smart CORDIC method.
The sine satisfies the following relations: $$ \sin(180 - A)=\sin A,\ \ \ \sin(180+A)=-\sin A. $$ Similarly, the cosine satisfies $$ \cos(180-A)=-\cos A,\ \ \ \cos(180+A)=-\cos A $$ With those you can always reduce to calculating the sine and cosine of angles in the first quadrant. When you get to the actual calculation in the first quadrant, this answer gives some details.

- 205,756
sin
calculates the value of the sine function. The basic symmetries of this function are
- $\sin(-x)=-\sin(x)$
- $\sin(x+180) = -\sin(x)$ (for a $x$ in degrees).
Thus $ \sin(135) = -\sin(-45) = \sin(45)$.

- 744