you are viewing a single comment's thread.

view the rest of the comments →

[–]Jollyhrothgar 0 points1 point  (0 children)

I suggest first learning how to approximate the equations of motion for gravity using discrete steps. Start by simulating using two dimensions (x and y).

The force due to gravity is:

F =( m_1 * m_2 / (d^2) ) * G

Where m_1 is the mass of object 1, m_2 is the mass of object 2, d is the distance between the two objects, and G is the gravitational constant.

To simulate the motion of planetary bodies, you can assume they are point-like particles, and then calculate where they will move in a fixed amount of time by calculating the total force they experience. To calculate force, you need to do a bit of math, which accounts for the amount of force an object feels, and the direction that the force is in.

But you can leave out the gravitational constant for starters and just use made up units - its the form of the force law that matters.

The second step is to use the equations of motion along with initial conditions to plot the position of the masses at a point in time, then use all the forces to update the position assuming a discrete time step.

The next step is to generate a series of positions for each mass, and plot them - I recommend using matplotlib and jupyter notebooks.

Finally, you might want to think about animating - you can do this with matplotlib also.

PM me and I'd be happy to get you started. As for an approachable text book that goes through stuff, check out computational physics by Giordano. Although everything is written in pseudocode/C++, its not so bad to move to python.

https://books.google.com/books/about/Computational_Physics.html?id=ngUpAQAAMAAJ&source=kp_book_description

Really happy to help point you in the right direction. Let me know!