Skip to main content

a little simulation for the gravitational two body problem

Project description

Two Body Problem

a small simulation

Welcome!

I wrote a small program to simulate the two body problem. You can either choose from presets (like Sun, Earth, Moon etc.) or type in your own masses and volumes. The program will show you a visualization of the simulation.

Table of Contents

Installation Instructions

Usage

Installation Instructions

via PyPi

The Python package manager pip will install the last uploaded version from the Python Package Index PyPi. This will not always be the latest version, so if you want to install all the latest features, install it from git (see below).

  1. Make sure Python and pip are installed correctly.
  2. Run pip3 install --upgrade pip setuptools wheel twobodyproblem from a command line.
  3. Now, the program is runnable with python -m twobodyproblem or python3 -m twobodyproblem.

(You may need Microsoft Visual C++ to be able to run the program, so install it from here if needed.)

via GitHub

  1. Make sure Python and pip are installed correctly.
  2. Make sure Git SCM is installed correctly.
  3. Run these commands from a command line:
    1. mkdir TwoBody and cd TwoBody
    2. git clone https://github.com/Two-Body-Problem/twobodyproblem-simulation-python.git
    3. pip3 install --upgrade pip setuptools wheel
    4. pip3 install twobodyproblem-simulation-python
  4. Now, the program is runnable with python -m twobodyproblem or python3 -m twobodyproblem.

(You may need Microsoft Visual C++ to be able to run the program, so install it from here if needed.)

Usage

To learn more about how to run the program with different options, run python -m twbodyproblem -h or python3 -m twbodyproblem -h respectively.

The program (better: the inputting section) can be run either with a graphical user interface (GUI) or with a command line interface (CLI).

No matter if you run the program in GUI or CLI mode, you will have to input options and values. The options define the particular behavior of the simulation, the values define the dimensions (i.e. mass, radius, distance, velocity) of the bodies.

Saving options and values is currently only supported in GUI mode. The options are automatically saved if you press one of the two buttons in the lower right corner of the settings window (open it with Ctrl+I). To save values, press Ctrl+S. The values will then be saved into a file. If you do this action repeatedly, the former contents of the file (i.e. the saved values) will be overwritten! To load saved values from this file, press Ctrl+L. To save or load values through a file dialog, press Ctrl+Shift+S or Ctrl+Shift+L. These files will be saved in the YAML format (*.yml).

In GUI mode, you can select from a few presets (e.g. Sun, Moon, Earth) to fill in some values. To do so, press Ctrl+E, select from the drop-down menu and press one of the two buttons in the lower right corner.

In CLI mode, the simulation will start automatically after the last input. To start the simulation from GUI mode, press the button in the lower right corner.

During the simulation, you are able to pause, un-pause and stop the simulation with the accordingly named buttons below the black rectangle. The restart button restarts the whole program, not just the simulation.

The sliders below the buttons can be used to magnify the bodies in the simulation. This magnification does not affect the physics, it is only a visual help.


Participation in this README is always welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twobodyproblem-1.2.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twobodyproblem-1.2.0-py3-none-any.whl (223.8 kB view details)

Uploaded Python 3

File details

Details for the file twobodyproblem-1.2.0.tar.gz.

File metadata

  • Download URL: twobodyproblem-1.2.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for twobodyproblem-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ac8cacd9bc0355b3e161e3dac57e1832f1ae79ba6af2fa53f36d9b6229e9d56c
MD5 d05e86440148644d6231421e7300c11b
BLAKE2b-256 a01bcefcfeb60c660368b9dd5767a1bafed5c92953c82d8e2df3fef97e22859b

See more details on using hashes here.

File details

Details for the file twobodyproblem-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: twobodyproblem-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for twobodyproblem-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e7b39fe63b24dabf6050622b95142052524a5d80a4c49f23f285fc8525604c8
MD5 7fe18d505e4978c609c5b1dc3c5d953f
BLAKE2b-256 8e7f1f7e166282ec6a3de233c8ee000bff29d0ef3986464abdb50d9fb7917e20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page