Skip to content

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.

Notifications You must be signed in to change notification settings

melanie-s-h/N-Body-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

N-Body-Simulation


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

F̲ᵢⱼ = mᵢ×(d²x̲ᵢ/dt²) = ∑ Gmᵢmⱼ×(x̲ⱼ-x̲ᵢ)×(1/|(x̲ⱼ-x̲ᵢ)|³),

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:

ṗ̲ᵢ = dp̲ᵢ/dt = ∑ Gmᵢmⱼ×(x̲ⱼ-x̲ᵢ)×(1/|(x̲ⱼ-x̲ᵢ)|³)


ẋ̲ᵢ = dx̲ᵢ/dt = p̲/m

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.

image

github_julia_n_body_project.mp4

image

image


About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages