So I'm working on a post right now about the Jacobs Ladder, because my friend and I have recently dissected the Jacobs Ladder mathematically. But in the mean time I would like to talk about numerical integration.
What on earth is that? good question. If you know some calculus, you know that the integral has something to do with taking an infinite amount of slices of something and counting up their area. The process of integrating an equation will give you the end result, but not the whole motion. This motion is all of these infinite slices put together.
Unfortunately, computers have a problem with infinity. So do I, so basically everything that you do in simulation can be described as
coarse graining. Coarse graining is the process of taking something that's beautifully smooth, and making it all rough and regimented.
Now one type of this that EVERY developer has to do, is temporal course graining. Also known as time stepping, this takes the current value of a temporally evolving function, say x(t), modifies it based on the rate of change (external forces, inertia) which we'll call x'(t) or v(t), then it waits awhile, then it does it again.
Now we come back to integrals. Say we have the function:
(1)
Now, we, as the creator, can decree that there are no other forces in our world, therefore, integrating this is not that hard:
(2)
Seems easy right, add a power to the exponent, divide by that new exponent. But what if, after 3 seconds, at t = 3, the base function becomes:
(3)
Easy, right, now our integral is:
(4)
No problems there, we simply express all solutions to this equations as being (2), for all times less than 3, and (4), for all times greater than three. What's the big deal with that. Well, what if the base function changed after t = 6, and then changed again after t = 9, and kept changing, every time t equalled a multiple of nine?
Perhaps you can see where I'm going with this, our equation is changing every three seconds, a three second time step.
To understand the need for this, lets go back to the real world. In the real world, there are no time steps, time just keeps on going, you can't keep looking closer and closer until you find time's framerate, it just doesn't work, it's always smaller than you can look. Sort of like the dt in our equations, in fact, exactly like that. The dt shaves down the variable it's applied to, t in our case, and looks at it through all time. An infinite number of shavings, each with zero width.
The laws of motion tell us that all objects in a state like to stay in that state, of either motion, or rest, unless another force acts on them. This is fine, but not useful for chaotic simulations, and most simulations used for computer graphics are, because in chaotic simulations there is a lot going on. Things almost never go in a straight line, and the equations determining (not governing: determining), the motion of these particles are always changing.
Except they're not always changing, they are changing every time step, and teleporting from position to position, based on the computed rates of change for their velocities. The computer looks at things, changes them, waits, and then does it again, each time, it takes off a precisely allotted shaving, not infinitely small, actually rather large, and then does it again, then again, then again, then again.
It's not that hard to see how this method would produce some errors, things might slip inside of other things, forces might be computed to be too big, or too small, distances might cancel and result in a divide by zero, all of these problems are solvable, but the problem of numerical integration is one that will never go away, because it would take an infinitely powerful computer to have infinitely small timesteps, and that doesn't seem on the horizon.
This might seem a bit unfortunate for the programmer: he/she will never get a perfect simulation of something, but, for me, it is almost unbearably exciting, I am experimenting with a field of science and technology that will NEVER be done. There will always be room to advance, room to make new methods, new ideas to be tested, and there will always be a better way.
That sounds like job security to me, thanks for reading.