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 setuptools wheel twobodyproblem --upgrade 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/flopsi-l-f/two-body-problem_simulation.git
    3. pip3 install setuptools wheel --upgrade
    4. pip3 install two-body-problem_simulation
  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.1.0.tar.gz (220.2 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.1.0-py3-none-any.whl (221.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twobodyproblem-1.1.0.tar.gz
  • Upload date:
  • Size: 220.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

File hashes

Hashes for twobodyproblem-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b5370ea87938c52bd77b50cbd288a6f4d28fddf8a67c5b6a92111f8a7db090ab
MD5 a9fe4222ea4ebe4dd6924f2cbacff104
BLAKE2b-256 16e10f4725e988e8e390bf701d543e7dd6f6560fa1ca788638be4c5dd51d4abc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twobodyproblem-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 221.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

File hashes

Hashes for twobodyproblem-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28981c314392a27c4f0de04f74857f67465fd66aee71faabb51d4da453d09635
MD5 95d7407d41c1593b3b8fe527fd1be52c
BLAKE2b-256 0cf4d2a4b9c89b330ce2b6011aae912696cac239da6cb16d8460315a01a95074

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