Skip to content

GFaure9/N_Bodies_Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

N-Body Problem Solver

This project aims to solve an N-body problem, where given masses are subjected to gravitational force (see Wikipedia page for more information on the problem). The method used to solve such a problem can be found in the chapter 4 of Kjartan Kari Gardasson Myrdal's Bachelor Thesis Some Theoretical and Numerical Aspects of the N-Body Problem (2013).

"No, emptiness is not nothingness. Emptiness is a form of existence. You must utilize this existential emptiness to fill yourself."

  • The Three-Body Problem, Liu Cixin

Image

Further description of the equations and the resolution method can be found at docs/N_bodies_problem.pdf.

Demo

Click the image below to download a demonstration of the project:

Thumbnail

Installation

To install this project, clone the repository using the following command:

git clone https://github.com/GFaure9/N_Bodies_Problem.git

Navigate to the project directory in a terminal (cd path_to_project) and run the following command to install the required dependencies:

pip install -r requirements.txt

Usage

To use the library, first create the configuration you want by writing it in the data/config.yaml file or check for already existing configurations.

# Example of a configuration

three_body:
  N : 4
  dt : 0.1
  T : 10000
  m:
    - [100000]
    - [100000]
    - [100000]
    - [50000]
  G : 6.67428e-11
  init_method: "random"
  solve_method: "euler"

Then in a Python file, run the following commands:

from lib.animate import SolveAnim

solver_anim = SolveAnim(config="name_of_your_config", movie_path="path_for_the_output_movie")
solution = solver_anim.solve()
solver_anim.animation()

The output movie will be created at the path you gave in argument.

Releases

No releases published

Packages

No packages published

Languages