rainwarrior wrote:
GradualGames wrote:
Oh, cool! That makes sense (seeing the pattern there...still don't have any idea how somebody figured this out to begin with). Well, I still am confused because...I understand you can approximate the sin function with the derivative(s) of sin at just one point. What I don't get is how does it work that you can approximate a whole function just from the derivatives at one point?
Yes, it works not just for sine, but for any continuous function.
e.g. if you pick a point on a curve f(a), you can approximate a point f(a+b) nearby by
taking the slope and following a straight line to that nearby point.
The slope is just the first derivative, though, you can make a better approximation if you take into account whether it is curving up or down vs. that straight line slope... so you can take the "slope" of that derivative slope, or second derivative, to improve the estimate. Instead of following the straight line, you follow the straight line, plus a continual curve up or down to adjust from it...
This process can be repeated until you have the accuracy you want. If the function is a simple polynomial eventually you get a derivative that is just 0, and at that point you're calculating it exactly.
If you want more accuracy around a specific region of the function, you can pick your starting point there. Considering a sine, you might realize that an approximation of sine(0.3) near 0 might be more accurate than sine(50π+0.3), even though the target value should be the same. Each successive layer of approximation will maybe get you one more "curve" in your approximated function. Of course with sine you know it's periodic so you can just modulo 2π to keep everything in the "close" range, but there are lots of non-periodic functions out there you may want to approximate.
Anyhow, that's just the Taylor Series idea, there's lots of other approximation methods. Many approximation methods have
undesirable instability that you should be careful to avoid. Again, hard to know where they can apply until you understand them and have experience with them, but I recommend taking it as far as you're interested. It's
OK to use stuff you don't understand if it solves your problem adequately, just it's hard to know what you're missing until you do.
Wikipedia is also generally a very bad place to learn anything to do with math. I find most of the articles are written by experts who expect a lot of pre-requisite knowledge. Wikipedia isn't supposed to be a tutorial, either, but it's not even structured in a way that is suitable for learning these concepts anyway. If you're lucky there's good learning material in the "external links" but that's a crap shoot. Much better to learn math from the traditional sources: textbooks, school programs, good teachers, etc.
That bit about the slope really helped me understand how that is working. Since a "sampled" derivative is the slope so if you keep taking (additional derivatives), it gets more and more accurate. Makes sense. It's still kind of amazing to me though...I mean looking at the Taylor series for the sin function on wikipedia, there isn't any trigonometry to be found, yet it works.
This further helps me realize how much of math is breaking things down into smaller steps, much like programming. I mean, I've been doing sinusoidal motion in my games since Nomolos, by accelerating an object in the opposite direction relative to a center point. It was just somehow easier to understand because I was down at the step by step, "add the next acceleration value" level, whereas math on paper has all the steps kind of expressed all at once. (though come to think of it, so is code, but maybe since I was writing it myself with a notation I was familiar with, a programming language, it was easier to think about...)
It's still damn impressive it works and somebody figured it out to begin with. Like, I really have trouble calling these things "simple." Maybe they're simple to use and perhaps to understand in some cases, but...actually being the guy who invents something like this...that amazes me.
Proofs are another thing I really never got a good grip on. The furthest I got is a few lights maybe turned on in my discrete math course in college and I did a little bit of induction, but that's it. After that whenever a proof came up in a class I was usually quite lost.