|
|
#110
|
|
Coda
Developer
|
The frequency is how frequently (hence the name) a periodic function (such as sin) goes through its full cycle per unit time. That's why it's 1 over the period -- one unit of time, divided by how many units of time must elapse for a single cycle, is clearly equal to how many cycles are in a single unit of time.
arcsin, arccos, and arctan exist because they're inverse functions. If you know that sin x = some value, but you don't know what x is, then arcsin allows you to find that. And a property of an inverse function is that, over its domain and range, f(f'(x)) = f'(f(x)) = x. For example, if f(x) = 2x, then f'(x) = x/2, because f(f'(x)) = f'(f(x)) = 2(x/2) = (2x)/2 = x.
As for why arctan is the only one that extends forever over the x axis... well, like I said, these are inverse functions. Plot x = sin(y), x = cos(y), and x = tan(y) on a graph, but limit them to a single cycle of the functions, and you'll see that the graph of x = sin(y) is exactly the graph of y = arcsin(x), the graph of x = cos(y) is exactly the graph of y = arccos(x), and the graph of x = tan(y) is exactly the graph of y = arctan(x).
So only arctan goes on forever in both horizontal directions because only tan goes on forever in both vertical directions -- sin and cos only have values between -1 and +1.
These functions are ridiculously useful in real-world practice. I use arctan a lot.
Think about a right triangle with one point at the origin, the right angle on the x axis, and the third point at (x, y). Call the angle at the origin θ. Since it's a right triangle, you know SOH-CAH-TOA. And since tangent = opposite / adjacent, then you know that tan θ = y / x.
Now get rid of the triangle.
You've got an arbitrary point (x, y) in 2D space now. Draw a ray from the origin through that point. What angle does that ray make with the x axis?
tan θ = y / x
arctan tan θ = arctan (y / x)
θ = arctan(y / x)
Now, technically, this is ambiguous, because tan's range is only (-pi/2,pi/2], not (-pi,pi], so you have to look at the signs of x and y to determine which quadrant θ is actually in, but that's easy to do.
So in other words, arctan lets you figure out what angle you have to turn in order to face a given point. You can see why this would be SUPER useful in video games.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)
Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
|
|
Posted 01-22-2017, 11:09 PM
|
|
|