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 in Python 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 input 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. 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. It works the same way for saving and loading settings from the settings window (open it with Ctrl+I). 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.3.0.tar.gz (17.3 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.3.0-py3-none-any.whl (224.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twobodyproblem-1.3.0.tar.gz
  • Upload date:
  • Size: 17.3 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.3.0.tar.gz
Algorithm Hash digest
SHA256 276cb5059924a97fdee46d2ab64cff1debb090f80ea3536767389c593955ae05
MD5 6ce910fcde473d6de80a19c51c50fc41
BLAKE2b-256 b48f8bb53aeec974d5e85181ce4ba4e537f157925919665d3b4da8bf34a22ffa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twobodyproblem-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 224.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b31edb73d2932777f508397df90272c63eee76a32c57b654f0c7e83204825573
MD5 b3bf918c9a626d6acc1554fc407eb941
BLAKE2b-256 145b528fb34d423c04da24dd22c83267d210a9814fe2f721f483e1b1e5f4462b

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