Re:Sin and Cos: The Programmer's Pals
by seanmcdirmid on Tuesday March 06, 2018 @10:33AM
(#16529412)
When using sin and cos in graphical programming, I wish code completion for them came up in the context of a triangle and unit circle so I wouldn’t keep referring back to Wikipedia.
Re:Sin and Cos: The Programmer's Pals
by Maybestring on Tuesday March 06, 2018 @12:31PM
(#16530322)
If, like me, you have the graph of the functions burned into your memory, then the anti-symmetry of sin makes it's geometric interpretation easy to remember.
Sin and Cos correspond to the rejection and projection of two unit vectors. When they rotate past each other, the projection still has the same direction, but the rejection changes sign, so it must correspond to the anti-symmetric sin, not the symmetric cos.
Re:Sin and Cos: The Programmer's Pals
by seanmcdirmid on Tuesday March 06, 2018 @12:34PM
(#16530352)
I don't use them enough to completely internalize them, so having a reference when I do need to use them is very helpful.
Re:Sin and Cos: The Programmer's Pals
by threatofrain on Tuesday March 06, 2018 @10:24AM
(#16529362)
What's a top alternative you've found to work aside from triangles?
Not who you responded to, but as he stated, the best method is the unit circle.
Take a circle of radius 1 around the origin. Draw a line with angle x through the origin. The point where this line intersects the circle has vertical position sin x and horizontal position cos x. Moreover, if you measure the angle in radians, x is how much of the unit circle your angle covers.
This also immediately makes the identity (sin x)^2 + (cos x)^2 = 1 obvious.
For me it was associating (sin(r), cos(r)) with a direction (on the unit circle), instead of with a triangle. After that, the relation with a triangle where the longest side has unit length is obvious.
(Source: I volunteer with the Toronto Public Library to help high school students with homework, mainly math.)