On 10/14/2010 08:06 AM, Mauro Lacy wrote:
> On 10/11/2010 01:50 PM, OrionWorks - Steven Vincent Johnson wrote:
>>
>> A question for you, Mauro:
>>
>>
>>
>> I would nevertheless love to computer simulate a so-called authentic
>> elliptical orbit that is more accurately based on Miles' three-part
>> gravity model, one that incorporates both the attractive 1/r^2 force
>> and the repulsive E/M 1/r^4 forces. At present I'm at loss as to how
>> I might do that -- that is without my computer simulations reverting
>> back to nothing more than another mechanistic heuristic exercise.
>> Maybe that's all one can really do in our so-called "mechanistic" world.
>>
>
> You're right, and I'm doing exactly that at the moment. A celestial
> mechanics simulator based on first principles. I'll try to use the
> smallest number of principles. So far, I've identified four:
> - Newton's first law (uniform movement law, i.e. inertia)
> - Newton's second law (f=ma => a=f/m)
> - A spherically(circularly, in two dimensions) radiating force field,
> with one (or more than one) transform(i.e. propagation) terms (1/r^0,
> 1/r^1, 1/r^2, ...)
> - Force fields act only in the centripetal direction, that is, they
> have no influence orthogonally.
>
> With that and a small enough interval, I think I can build an orbit
> simulator to test for laws using only first principles. More about
> this later, probably.
Well, I've built a two-body, two-dimensional orbit simulator based in
these four principles. It turns out it was very easy to program using
vectorial arithmetics, so here's the method. It uses vector
substraction, addition, invertion, normalization, and vector multiplying
by an scalar.
Let me know if you discover something that is incorrect.
// inverse square law
int exponent = 2;
// vectors planet.pos and star.pos have the actual positions of the
bodies.
r=planet.pos-star.pos; // the radius vector is the vectorial
substraction of the position of the bodies
float f; // magnitude of the force
f=-(star.mass/pow(r.length(), exponent)); // minus means attractive
attractive force. r.length() gives us the
// magnitude of the radius vector.
planet.ac=r.normalized()*(f/planet.mass); // centripetal
acceleration acts in the radius vector direction. r.normalized() gives
us the unit vector.
planet.velocity=planet.velocity + planet.ac; // vectorial addition
of velocity and centripetal acceleration
// now do the same for the star
f=-(planet.mass/pow(r.length(), exponent)); // force of the planet
on the star
star.ac=-(r.normalized())*(f/star.mass); // centripetal acceleration
produced on the star. In the opposite direction
star.velocity=star.velocity + star.ac;
// now calculate the new positions
planet.pos=planet.pos + planet.velocity;
star.pos=star.pos + star.velocity;
That's it. Except for a=f/m and the force field transform, there are no
other formulas.
Suffice it to say that it produces elliptical orbits, which depend on
the initial positions, velocities, masses and distance between the bodies.
I've used Qt4 QVector2D implementation, but any vector class or library
that implements basic vector operations will do.
Regards,
Mauro