OrionWorks wrote:
Is there a Vort deity-on-call that can point me to specific Calculus
formulas that one would use to plot PRECISELY the predicted (x,y)
positions on a 2D graph based on the time slice given?
Does such devils in the guise of Calculus exist?
I don't know a closed form solution for an orbit, which expresses the
position in terms of time using simple functions. (I don't even know if
one exists... :-( ) But naturally, that doesn't stop me from
answering... (and I have a couple comments which might help).
-- If you decide to have more than one attractor -- i.e., if you want
the "planets" to have gravity, not just the "star" -- then there is no
closed-form solution and you need to fall back on numerical integration
anyway.
-- Rather than reduce the timestep for the whole simulation when one
planet gets "too close", just take extra steps for that planet. Then go
back to using the "large" step for the rest of the planets in the list.
-- If you are modeling the bodies as points, so they can get arbitrarily
close, then it will be possible for a close approach to wipe out the
simulation no matter how small your time steps are. On a "very close
approach" velocities get arbitrarily large, and the numerical
integration will produce bad results. One way to avoid this is give the
planets nonzero "collision radius" and have them bounce off each other
and the star when they get that close; this avoids approaches closer
than what your simulation can handle. (Of course, finding the exact
moment at which they collide, in order to get the simulation right, is
also a challenge :-( )
-- If you're using a simple model, where you add velocity*dt to get the
next location, and add g*dt to get the next velocity, you might be able
to get some mileage out of using a fancier integration algorithm.
One simple improvement is to use a quadratic to find the next location,
based on g and v rather than just v alone -- i.e, use a truncated Taylor
series; you have the first and second derivatives of the position:
x(dt) = x_0 + v * dt + (1/2) g * dt^2
A more complex approach, which may or may not pay off, is to do
prediction/correction: Find approximate values for the "next location"
and "next velocity" -- better yet find approximate values for two steps
into the future, so you have 3 points determined.. Then find the
acceleration (g field) at the new _approximate_ positions, and go back
and recalculate the new position and velocity using some sensible
numerical integration rule over that interval. Simpson's rule works
pretty well. Wikipedia has a (rather incoherent) page on Simpson's
rule, here:
http://en.wikipedia.org/wiki/Simpson's_rule
Alternatively try googling "runge-kutta", which is a common numerical
integration technique.