Geodesic trajectories
Calculate geodesic trajectories in Schwarzschild, Kerr and Kerr-Newman geometries with a few lines of code.
Compute geodesics, manipulate tensors symbolically and visualise curved spacetime — in Schwarzschild, Kerr and Kerr-Newman geometries, right next to NumPy, SciPy and Astropy.
Define the initial conditions, pick a metric and let EinsteinPy integrate the geodesic.
import numpy as np from einsteinpy.geodesic import Timelike from einsteinpy.plotting.geodesic import StaticGeodesicPlotter geod = Timelike( metric="Schwarzschild", metric_params=(0.,), position=[40., np.pi / 2, 0.], momentum=[0., 0., 3.83405], steps=5500, delta=1, return_cartesian=True, ) plotter = StaticGeodesicPlotter() plotter.plot(geod) plotter.show()
Schwarzschild, Kerr or Kerr-Newman — or bring your own metric.
Timelike and null geodesics with higher-order integrators, accelerated by Numba.
Static, interactive and animated plots that make Einstein's ideas visible.
Build a metric, then get Christoffel symbols, Riemann, Ricci, Einstein and Weyl tensors as SymPy expressions you can simplify, differentiate and lambdify.
from sympy import simplify from einsteinpy.symbolic import ( Schwarzschild, ChristoffelSymbols, RicciTensor, RicciScalar, EinsteinTensor, ) m = Schwarzschild() # predefined metric ch = ChristoffelSymbols.from_metric(m) simplify(ch[0, 0, 1]) # r_s / (2*r*(r - r_s)) simplify(ch[1, 2, 2]) # -r + r_s simplify(ch[2, 3, 3]) # -sin(2*theta)/2 ricci = RicciTensor.from_metric(m) # every component -> 0 R = RicciScalar.from_metric(m) # -> 0 G = EinsteinTensor.from_metric(m) # -> 0 (vacuum)
A focused toolkit for students, researchers and the curious — open source from core to plotting.
Calculate geodesic trajectories in Schwarzschild, Kerr and Kerr-Newman geometries with a few lines of code.
A plotting module that turns Einstein’s ideas into plots anyone can understand — static, interactive or animated.
SymPy-based tensors and operations: Christoffel symbols, Riemann, Ricci, Einstein, Weyl and more.
Work close to the scientific Python tools you already know — Astropy, NumPy and friends.
No more guessing which coordinates to use — EinsteinPy converts between them smoothly.
Core, plotting and symbolic modules are MIT licensed and developed in the open on GitHub.
Ask questions, follow development and help shape the project.
We are in dire need of sponsorships to help sustain the project's activities. If EinsteinPy is creating some change for you, please consider donating.