Skip to main content

A package for gravitational simulations

Project description

gravitational

A package for gravitational simulations

Installation

You can install the latest version of gravitational from PyPI:

pip install gravitational

The only requirements are numpy and matplotlib.

How to use

An example of simulating the inner planets:

>>> from gravitational.simulation import Simulation
>>> from gravitational.utils import SolarSystem
>>> ss = SolarSystem()
>>> sim = Simulation(ss.t)
>>> bodies = [ss.sun(), ss.mercury(), ss.venus(), ss.earth(), ss.mars()]
>>> names = ['sun', 'mercury', 'venus', 'earth', 'mars']
>>> colors = ['y','k','g','b','r']
>>> sizes = [25,8,9,10,9]
>>> for i,b in enumerate(bodies):
       sim.add_body(name=names[i], color=colors[i], radius=b.r, size=sizes[i], 
       mass=b.m, position=b.p0, velocity=b.v0)
>>> sim.play(path=True)

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

gravitational-0.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

gravitational-0.0.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file gravitational-0.0.2.tar.gz.

File metadata

  • Download URL: gravitational-0.0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for gravitational-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5f32cf082f8475c2e748967f3981b31daa8a222fe99b0a291170b5ab8d3ed17d
MD5 01cdef389a2b64fdcff6d3f1b7163b56
BLAKE2b-256 8df9fa451e8202e86fd49406366ebac4f1c661ed93de67a09ed9abfcbc0c5c99

See more details on using hashes here.

File details

Details for the file gravitational-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: gravitational-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for gravitational-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cec3fb879d7fb685deacd371dcae4dfa291a6a0ccfcd6a485b1e7f146104dd08
MD5 ca1e6afdd60957ad80461c0955ba669e
BLAKE2b-256 b64ebd820ee87aa23ec19b94f03c92f59cba442041b88ee80a83accfe19d7286

See more details on using hashes here.

Supported by

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