A package for gravitational simulations
Project description
Author: Behrouz Safari
License: MIT
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.solar_system import initial_state
from gravitational.constants import Constant
# Define the time as a datetime object or a string (default now)
t = '2021-02-17 04:26:00'
sim = Simulation(t)
c = Constant()
# Get initial states from Horizons API
p0_sun, v0_sun = initial_state('sun', t)
p0_venus, v0_venus = initial_state('venus', t)
p0_earth, v0_earth = initial_state('earth', t)
# Add bodies
s = sim.add_body(name='Sun', color='y', size=25, mass=c.m_sun,
position=p0_sun, velocity=v0_sun)
v = sim.add_body(name='Venus', color='k', size=8, mass=c.m_venus,
position=p0_venus, velocity=v0_venus)
e = sim.add_body(name='Earth', color='b', size=10, mass=c.m_earth,
position=p0_earth, velocity=v0_earth)
# Run and play the simulation
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.2.2.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file gravitational-0.2.2.tar.gz
.
File metadata
- Download URL: gravitational-0.2.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffdde7dc0c23a1ea343b60973daae5cfc4e584a6c958a7bc3584b7b33740999b |
|
MD5 | b3ba9b1977a4567b444a71555aa5b160 |
|
BLAKE2b-256 | 1acfd3e367387933bd0a48b164c21f99208c696ecdf50f747733f09f441167a1 |
File details
Details for the file gravitational-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: gravitational-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49d087cbc4c76cd4fd78dd9976749886e0a25389a09c35ea87c08fe94f50ac4a |
|
MD5 | 5b7997fde4ecda21823000e53d39d2ec |
|
BLAKE2b-256 | c6e2f2785fd8747076270da79f5713d2c0bdbb60e15a287fc2b657364beb351f |