Predicting Celestial Bodies

 

The final project for my Scientific Computing course was a physics algorithm. The algorithm employed a Runge-Kutta 4th-Order ODE to model the positions of the planets over a specified number of moments.

The original project was done in Fortran. However, most of the code was provided by the instructor so I took it upon myself to translate the math and logic into Python. The results are available in HTML.

 

Download inner planets animation

 

Download outer planets animation

 

Newton’s Equations of Motion

The gravitational force upon object i due to object j.

The gravitational acceleration of object i due to object j.

Velocity and acceleration of object i due to object j (extrapolate to dimensions y and z).


To determine the velocity and acceleration for a set of n interacting objects (denote as set N), summate the effect of each body in the set upon the target body (e.g. j and k upon i) for each dimension.



Whiteboard

Design goal was for minimal intervention and hard coding in the execution section. In line with that, the Body objects handle the computations and file writing that compose the bulk of this project. The execution script loops through the set of bodies and calls their reposition function. It iterates a specified number of times before terminating.

 
 
Previous
Previous

Gaming Virtual Economies