In this module a system of N interacting bodies moving in 3 dimensions over time will be simulated. The trajectories of the bodies are approximated by numerically integrating the equations of motion with the Runge-Kutta Method.
N-body equations of motion are defined by
where the right side is summed up over N with j=1 & j≠i.
These equations describe the motions of N mass points mᵢ,
moving under the influence of their mutual attracting force given by Newton's law of gravitation.
with p̲ᵢ = mᵢ×(dx̲ᵢ/dt) follows a set of first order differential equations:
which will be numerically integrated with the Runge-Kutta 4 Method to approximate the bodies trajectories.
Author: Melanie H., based on the code '/Ingolstadt.jl/tree/main/src/Development/NBodies/NBodies.jl' published on github by Niall Palfreyman, downloaded: 26/5/2022.
Type Demo.demo() in Julia REPL to run the simulation.
The "demo()" function of "Demo.jl" file demonstrates the simulation of 3 different n-body systems while giving explanation in the REPL.
"Demo.jl" uses the main module "NBodies.jl", where the math and physics is happening.