I was looking more into functions in SQL and found the trig functions. Something just doesn't seem right though. I don't get how the inverse functions work?
If I use the cosine function, it takes an argument representing an angle in radians.
So:
Is the cosine of an angle which is 5.5 radians. Thus the resulting value is:Code:SELECT COS(5.5);
Now, if I was to apply ACOS to 0.70866977429126 then the resulting value should be 5.5?0.70866977429126
So what we should have is:
The resulting value should be:Code:SELECT ACOS(COS(5.5));
Then why is it5.5? I'm sure I'm missing something. Any thoughts as to what I am missing here?0.783185307179586
COS is a many to one function. The result is that it doesn't have an inverse that is guaranteed to result in the original value entered.
ACOS returns a value between 0 and PI.
So then is that the same as SIN and ASIN because those create weird results also.
returns -0.358407346410207.Code:SELECT ASIN(SIN(3.5));
When I do:
The result is 0.358407346410207. Then what are these functions doing? Where are these weird numbers coming from?Code:SELECT ATAN(TAN(3.5));
When I do this:
I get the original value of 3.5. I don't actually know what a radian is. Does that mean I can't have 3.5 radians? Which is why I am getting weird results?Code:SELECT DEGREES(ASIN(SIN(RADIANS(3.5))));
In advanced math and ALL programming languages, trig is done in radians. A circle has 2*PI radians (360 degrees). 90 degrees is PI/2 radians. If you are thinking in degrees, you will get severely scrambled.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks