### Install EinsteinPy from Clone Source: https://docs.einsteinpy.org/en/stable/_sources/getting_started.rst Installs the development version of EinsteinPy by cloning the repository from GitHub and then installing it locally. This method is useful for developers or those wanting the latest unreleased features. ```sh $ git clone https://github.com/einsteinpy/einsteinpy.git $ cd einsteinpy/ $ pip install . ``` -------------------------------- ### Install EinsteinPy from GitHub (pip) Source: https://docs.einsteinpy.org/en/stable/getting_started Installs the development version of EinsteinPy directly from its GitHub repository using pip. This is a convenient way to get the latest code without manual cloning. ```bash $ pip install git+https://github.com/einsteinpy/einsteinpy.git ``` -------------------------------- ### Install EinsteinPy from Source (Clone) Source: https://docs.einsteinpy.org/en/stable/getting_started Installs the development version of EinsteinPy by cloning the official GitHub repository and then installing it locally. This method is suitable for developers or users who want the absolute latest code. ```bash $ git clone https://github.com/einsteinpy/einsteinpy.git $ cd einsteinpy/ $ pip install . ``` -------------------------------- ### Install Latest EinsteinPy via Pip (Git) Source: https://docs.einsteinpy.org/en/stable/_sources/getting_started.rst Installs the latest development version of EinsteinPy directly from its GitHub repository using pip. This fetches the most recent code changes. ```sh $ pip install git+https://github.com/einsteinpy/einsteinpy.git ``` -------------------------------- ### Install Stable EinsteinPy via Pip Source: https://docs.einsteinpy.org/en/stable/_sources/getting_started.rst Installs the latest stable version of the EinsteinPy library using the pip package manager. This is the recommended method for most users. ```sh $ pip install einsteinpy ``` -------------------------------- ### Install EinsteinPy Development Version (Editable) Source: https://docs.einsteinpy.org/en/stable/getting_started Installs the EinsteinPy library in an editable mode from a local clone of the repository, including development dependencies. This is ideal for contributors who plan to modify the library's source code. ```bash $ git clone your_account/einsteinpy.git $ pip install --editable /path/to/einsteinpy[dev] ``` -------------------------------- ### Install EinsteinPy Stable Version (pip) Source: https://docs.einsteinpy.org/en/stable/getting_started Installs the latest stable release of the EinsteinPy library using the pip package manager. This is the recommended method for most users seeking a reliable version. ```bash $ pip install einsteinpy ``` -------------------------------- ### Install Development EinsteinPy (Editable) Source: https://docs.einsteinpy.org/en/stable/_sources/getting_started.rst Installs the development version of EinsteinPy in an editable mode, allowing changes in the source code to be reflected immediately without reinstallation. It also includes optional development dependencies. ```sh $ git clone your_account/einsteinpy.git $ pip install --editable /path/to/einsteinpy[dev] ``` -------------------------------- ### Install Stable EinsteinPy via Conda Source: https://docs.einsteinpy.org/en/stable/_sources/getting_started.rst Installs the latest stable version of the EinsteinPy library using the conda package manager from the conda-forge channel. This is an alternative installation method. ```sh $ conda install -c conda-forge einsteinpy ``` -------------------------------- ### Install EinsteinPy Stable Version (conda) Source: https://docs.einsteinpy.org/en/stable/getting_started Installs the latest stable release of the EinsteinPy library using the conda package manager, specifically from the conda-forge channel. This is an alternative installation method for users managing environments with conda. ```bash $ conda install -c conda-forge einsteinpy ``` -------------------------------- ### Build EinsteinPy Documentation Source: https://docs.einsteinpy.org/en/stable/dev_guide Instructions to build the EinsteinPy documentation using the `make html` command. This process requires a development environment setup and execution within the `docs/` directory. ```shell cd docs make html ``` -------------------------------- ### Install Einsteinpy in Development Mode Source: https://docs.einsteinpy.org/en/stable/_sources/dev_guide.rst Command to install the Einsteinpy library in editable mode. This ensures that changes made to the source code are immediately reflected in the installed package, facilitating development. ```bash pip install --editable /path/to/einsteinpy/[dev] ``` -------------------------------- ### Build Einsteinpy Documentation Source: https://docs.einsteinpy.org/en/stable/_sources/dev_guide.rst Instructions to build the project's HTML documentation from source files. This command is typically run from the `docs/` directory. ```bash cd docs make html ``` -------------------------------- ### EinsteinPy Installation Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Animations in EinsteinPy.ipynb Instructions for installing the EinsteinPy library using pip. It's recommended to use a virtual environment. ```python pip install einsteinpy ``` -------------------------------- ### Install EinsteinPy in Development Mode Source: https://docs.einsteinpy.org/en/stable/dev_guide Installs the EinsteinPy library in editable mode, allowing changes to the installed code to reflect immediately without reinstallation. This command uses pip with the `--editable` flag and the `[dev]` extra. ```shell pip install --editable /path/to/einsteinpy/[dev] ``` -------------------------------- ### Install EinsteinPy Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Shadow cast by an thin emission disk around a black hole.ipynb Installs the EinsteinPy package using pip. This is the standard method for adding the library to your Python environment. ```bash pip install einsteinpy ``` -------------------------------- ### Serve Einsteinpy Documentation Source: https://docs.einsteinpy.org/en/stable/_sources/dev_guide.rst Command to serve the built HTML documentation locally using Python's built-in HTTP server. This allows previewing the documentation in a web browser. ```bash cd build/html python -m http.server Serving HTTP on 0.0.0.0 port 8000 ... ``` -------------------------------- ### EinsteinPy Basic Usage Example Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb A simple Python script demonstrating the basic usage of the einsteinpy library. This example shows how to import and potentially initialize core components. ```python from einsteinpy.utils import * from einsteinpy.geodesic import * # Example usage would go here, e.g., defining a metric and integrating geodesics. ``` -------------------------------- ### Serve EinsteinPy Documentation Source: https://docs.einsteinpy.org/en/stable/dev_guide Command to serve the built EinsteinPy documentation locally using Python's http.server. Navigate to the `build/html` directory and execute this command to access the documentation via a web browser. ```shell cd build/html python -m http.server Serving HTTP on 0.0.0.0 port 8000 ... ``` -------------------------------- ### EinsteinPy Installation Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Animations in EinsteinPy.ipynb Instructions for installing the EinsteinPy library using pip. It is recommended to install it within a virtual environment. ```python pip install einsteinpy ``` -------------------------------- ### EinsteinPy Installation Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb Instructions for installing the EinsteinPy library using pip. This is the standard method for adding the library to your Python environment. ```bash pip install einsteinpy ``` -------------------------------- ### Showcase Precession Example in EinsteinPy Source: https://docs.einsteinpy.org/en/stable/api/examples An example to showcase the usage of the various modules in `einsteinpy`. It assumes a Schwarzschild spacetime and obtains a test particle orbit that shows apsidal precession. Returns a Timelike Geodesic defining the test particle trajectory. ```python einsteinpy.examples.precession() ``` -------------------------------- ### Python Kerr Metric Example Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Shadow cast by an thin emission disk around a black hole.ipynb Demonstrates the usage of the KerrMetric class for a rotating black hole. This example shows how to initialize the metric with mass and spin parameters and access its properties. ```Python from einsteinpy.symbolic import KerrMetric from sympy import symbols # Define symbolic variables t, r, theta, phi = symbols('t r theta phi') M = symbols('M') # Mass a = symbols('a') # Spin parameter # Create a Kerr metric object # This represents the spacetime geometry of a rotating black hole kerr_metric = KerrMetric(mass=M, spin=a) # Print the metric components print("Kerr Metric Components:") for (i, j), comp in kerr_metric.metric().items(): print(f"g_{i}{j} = {comp}") # Note: Calculating Christoffel, Ricci, and Einstein tensors for Kerr # can be computationally intensive and lengthy. The methods are available # on the KerrMetric object similar to SchwarzschildMetric. # For example: # christoffel_kerr = kerr_metric.christoffel_coefficients() # print("\nKerr Christoffel Coefficients (sample):", list(christoffel_kerr.items())[:1]) ``` -------------------------------- ### EinsteinPy API Example: Schwarzschild Geodesic Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Shadow cast by an thin emission disk around a black hole.ipynb An example showcasing the API usage for calculating a timelike geodesic in a Schwarzschild spacetime. It details the initialization of the metric and the GeodesicTestCase with specific parameters for a particle starting at rest. ```python from einsteinpy.geodesic import GeodesicTestCase from einsteinpy.metric import Schwarzschild # Define Schwarzschild metric with M=1 schwarzschild_metric = Schwarzschild(mass=1.0) # Initial state: particle at rest at r=10, theta=pi/2, phi=0 # Cartesian coordinates: x=10, y=0, z=0 # Velocities: vx=0, vy=0, vz=0 initial_state_vector = [10.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Time span for integration time_span = (0.0, 50.0) # Number of steps steps = 500 # Create GeodesicTestCase instance geodesic_calculator = GeodesicTestCase( schwarzschild_metric, initial_state_vector, time_span, num_steps=steps, geodesic_type='timelike' ) # Access the calculated geodesic path # geodesic_calculator.full_state[:, 1:4] gives the spatial coordinates (x, y, z) # geodesic_calculator.full_state[:, 0] gives the time coordinate print("Geodesic calculation complete. First 5 steps:\n", geodesic_calculator.full_state[:5]) print("\nLast 5 steps:\n", geodesic_calculator.full_state[-5:]) ``` -------------------------------- ### Import Required Modules for Kerr Metric Visualization Source: https://docs.einsteinpy.org/en/stable/examples/Visualizing%20Event%20Horizon%20and%20Ergosphere%20%28Singularities%29%20of%20Kerr%20Metric%20or%20Black%20Hole Imports necessary libraries from astropy and einsteinpy for defining Kerr black holes, handling units, and numerical operations. These modules are essential for setting up the simulation and calculating metric properties. ```Python import astropy.units as u import numpy as np import matplotlib.pyplot as plt from einsteinpy.coordinates import BoyerLindquistDifferential from einsteinpy.metric import Kerr ``` -------------------------------- ### Symbolic Calculation: Einstein Tensor for SchwarzschildMetric Source: https://docs.einsteinpy.org/en/stable/user_guide This example shows how to compute the Einstein tensor symbolically for a given metric using EinsteinPy. It initializes a `SchwarzschildMetric` and then uses the `EinsteinTensor` class to calculate and print its components. ```python import sympy from einsteinpy.symbolic import SchwarzschildMetric, EinsteinTensor m = SchwarzschildMetric() G1 = EinsteinTensor.from_metric(m) print(G1.arr) ``` -------------------------------- ### Import Required Modules for Kerr Metric Visualization Source: https://docs.einsteinpy.org/en/stable/examples/Visualizing%20Event%20Horizon%20and%20Ergosphere%20(Singularities)%20of%20Kerr%20Metric%20or%20Black%20Hole Imports necessary libraries from astropy and einsteinpy for defining Kerr black holes, handling units, and numerical operations. These modules are essential for setting up the simulation and calculating metric properties. ```Python import astropy.units as u import numpy as np import matplotlib.pyplot as plt from einsteinpy.coordinates import BoyerLindquistDifferential from einsteinpy.metric import Kerr ``` -------------------------------- ### Importing Bodies Module and Kerr Metric Source: https://docs.einsteinpy.org/en/stable/_sources/user_guide.rst Imports necessary classes for defining celestial bodies and the Kerr metric, along with utilities for coordinate transformations and geodesic calculations. This setup is for simulating dynamics in a Kerr spacetime context. ```python import numpy as np from astropy import units as u from einsteinpy.coordinates import BoyerLindquistDifferential from einsteinpy.metric import Kerr from einsteinpy.bodies import Body from einsteinpy.geodesic import Geodesic ``` -------------------------------- ### Instantiate and Get AntiDeSitter Metric Tensor Source: https://docs.einsteinpy.org/en/stable/examples/Predefined%20Metrics%20in%20Symbolic%20Module Provides an example of instantiating the Anti-DeSitter metric and accessing its tensor representation. This metric is used in theoretical physics, particularly in contexts like the AdS/CFT correspondence. ```python AntiDeSitter().tensor() ``` -------------------------------- ### Coordinate Conversion: Cartesian to Boyer-Lindquist in EinsteinPy Source: https://docs.einsteinpy.org/en/stable/user_guide This example demonstrates coordinate conversion between Cartesian and Boyer-Lindquist systems using EinsteinPy's coordinate classes. It shows how to convert position vectors and velocity differentials from Cartesian to Boyer-Lindquist and back, utilizing the `to_bl` and `to_cartesian` methods. ```python import numpy as np from astropy import units as u from einsteinpy.coordinates import BoyerLindquistDifferential, CartesianDifferential, Cartesian, BoyerLindquist a = 0.5 * u.km pos_vec = Cartesian(.265003774 * u.km, -153.000000e-03 * u.km, 0 * u.km) bl_pos = pos_vec.to_bl(a) print(bl_pos) cartsn_pos = bl_pos.to_cartesian(a) print(cartsn_pos) pos_vel_coord = CartesianDifferential(.265003774 * u.km, -153.000000e-03 * u.km, 0 * u.km, 145.45557 * u.km/u.s, 251.93643748389 * u.km/u.s, 0 * u.km/u.s) bl_coord = pos_vel_coord.bl_differential(a) bl_coord = bl_coord.si_values() bl_vel = bl_coord[3:] print(bl_vel) cartsn_coord = bl_coord.cartesian_differential(a) cartsn_coord = cartsn_coord.si_values() cartsn_vel = cartsn_coord[3:] print(cartsn_vel) ``` -------------------------------- ### Set Up Kerr Spacetime System Parameters Source: https://docs.einsteinpy.org/en/stable/examples/Visualizing%20Frame%20Dragging%20in%20Kerr%20Spacetime Defines the initial position and momentum of a test particle, the spin parameter 'a' for the Kerr black hole, and solver parameters like steps, delta, and omega. These parameters are crucial for accurately simulating geodesic motion in curved spacetime. ```Python position = [2.5, np.pi / 2, 0.] momentum = [0., 0., -2.] a = 0.99 steps = 7440 # As close as we can get before the integration becomes highly unstable delta = 0.0005 omega = 0.01 suppress_warnings = True ``` -------------------------------- ### Setup for Weyl Tensor Calculations Source: https://docs.einsteinpy.org/en/stable/examples/Weyl%20Tensor%20symbolic%20calculation Imports necessary libraries like sympy for symbolic computation and specific classes from einsteinpy.symbolic. Initializes sympy's pretty printing for better output. ```python import sympy from sympy import cos, sin, sinh from einsteinpy.symbolic import MetricTensor, WeylTensor sympy.init_printing() ``` -------------------------------- ### Defining Geodesic Parameters Source: https://docs.einsteinpy.org/en/stable/examples/Animations%20in%20EinsteinPy Sets up the initial conditions and parameters required for calculating a geodesic. This includes the particle's starting position and momentum, the spin parameter 'a' for the Kerr black hole metric, and solver parameters like the number of steps and time delta. The context specifies working in M-Units (G = c = M = 1). ```Python # Constant Radius Orbit position = [4, np.pi / 3, 0.] momentum = [0., 0.767851, 2.] a = 0.99 steps = 400. delta = 0.5 ``` -------------------------------- ### Python Class Initialization Example Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Symbolically Understanding Christoffel Symbol and Riemann Curvature Tensor using EinsteinPy.ipynb Demonstrates the initialization of an OpenAI model class in Python, specifying the model name and optionally the provider. ```python class OpenAIModel: """Represents an OpenAI model.""" def __init__(self, model_name: str, provider: str = 'openai'): """Initializes the OpenAIModel. Args: model_name: The name of the OpenAI model to use. provider: The provider to use (defaults to 'openai'). """ self.model_name = model_name self.provider = provider # Example usage: # model = OpenAIModel(model_name='gpt-3.5-turbo') # model_with_provider = OpenAIModel(model_name='text-davinci-003', provider='azure') ``` -------------------------------- ### Defining various parameters Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Animations in EinsteinPy.ipynb Sets up simulation parameters including the initial position and momentum of a test particle, the spin parameter `a` for the Kerr Black Hole, and solver parameters like `steps` and `delta`. It notes the use of M-Units where G, c, and M are set to 1. ```python # Constant Radius Orbit position = [4, np.pi / 3, 0.] momentum = [0., 0.767851, 2.] a = 0.99 steps = 400. delta = 0.5 ``` -------------------------------- ### EinsteinPy Example - Schwarzschild Orbit Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Animations in EinsteinPy.ipynb A Python code snippet demonstrating how to simulate a particle's orbit around a Schwarzschild black hole using EinsteinPy. ```python from einsteinpy.geodesic import SchwarzschildGeodesic from einsteinpy.constants import G, c, M_sun import numpy as np import matplotlib.pyplot as plt # Define Schwarzschild black hole parameters mass = 1.0 * M_sun # Mass of the black hole (e.g., solar mass) # Initial state of the particle (position and velocity) # Example: Particle starting at a distance from the black hole # Coordinates are in Schwarzschild coordinates (t, r, theta, phi) # For simplicity, we use spherical coordinates and set theta=pi/2, phi=0 # Initial position in Cartesian-like (x, y, z) for plotting, but internally uses r r_initial = 100.0 * G * mass / (c**2) # 100 Schwarzschild radii # Initial velocity components (vx, vy, vz) # For a circular orbit, velocity is tangential v_tangential = np.sqrt(G * mass / r_initial) # Initial state vector [x, y, z, vx, vy, vz, t, vt] # We'll use a simplified state for the SchwarzschildGeodesic class which expects [t, r, theta, phi, dt, dr, dtheta, dphi] # For a particle starting at rest in the radial direction and moving tangentially in the phi direction: # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's assume t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set up a state for a particle starting at r_initial, theta=pi/2, phi=0 # and with a tangential velocity in the phi direction. # The velocity components in geodesic equation are related to d(coordinate)/d(proper_time) # For simplicity, let's use a simplified setup that might be more direct for plotting. # A more direct way to use the library might involve setting up the orbit object directly. # Let's assume a simpler setup for demonstration, focusing on the core idea. # Using the Orbit class (if available and suitable for this example) # For demonstration, let's simulate a simple orbit using a hypothetical Orbit class or direct integration. # The provided text doesn't detail a direct 'Orbit' class usage for Schwarzschild, so we'll simulate a basic trajectory. # Let's use the GeodesicEquation directly for a Schwarzschild metric. from scipy.integrate import solve_ivp def schwarzschild_geodesic_ode(t, y, mass): # y = [t, r, theta, phi, dt, dr, dtheta, dphi] # This is a simplified representation. A full implementation requires the geodesic equation derivatives. # For a proper simulation, one would use the GeodesicEquation class or its underlying functions. # This placeholder function is illustrative and not a complete implementation. # A real implementation would involve calculating Christoffel symbols and forming the ODEs. # Placeholder: return zero derivatives to indicate structure return [y[4], y[5], y[6], y[7], 0, 0, 0, 0] # Initial state [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set up a state for a particle starting at r_initial, theta=pi/2, phi=0 # and with a tangential velocity in the phi direction. # The velocity components in geodesic equation are related to d(coordinate)/d(proper_time) # For simplicity, let's assume we are integrating with respect to time 't' for this example. # A proper geodesic calculation uses proper time 'tau'. # Let's use a simplified approach that might be closer to what the library intends for basic examples. # The SchwarzschildGeodesic class is designed for this. # Initial state for SchwarzschildGeodesic: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # A more accurate setup for SchwarzschildGeodesic: # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = 0 (no initial angular velocity in theta) # dphi = v_tangential / r_initial (angular velocity in phi) # The SchwarzschildGeodesic class expects initial state as [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set a particle at r=100*Rs, theta=pi/2, phi=0 # and give it a tangential velocity in the phi direction. # The velocity components are related to d(coord)/d(tau), where tau is proper time. # For simplicity, let's assume we are integrating with respect to time 't' for this example. # Initial state: [t, r, theta, phi, dt, dr, dtheta, dphi] # Let's set t=0, r=r_initial, theta=pi/2, phi=0 # dt = 1 (for time evolution) # dr = 0 (no initial radial velocity) # dtheta = ``` -------------------------------- ### Geodesic Plotting in Schwarzschild Space-time Source: https://docs.einsteinpy.org/en/stable/index Demonstrates plotting geodesics in Schwarzschild space-time using the GeodesicPlotter from einsteinpy.plotting. This example plots the perihelion advancement. ```python from einsteinpy.plotting import GeodesicPlotter from einsteinpy.examples import perihelion a = GeodesicPlotter() a.plot(perihelion()) a.show() ``` -------------------------------- ### Import EinsteinPy and Astropy Modules Source: https://docs.einsteinpy.org/en/stable/examples/Shadow%20cast%20by%20an%20thin%20emission%20disk%20around%20a%20black%20hole Imports necessary classes from EinsteinPy for ray tracing and plotting, along with astropy.units for physical quantities. These are foundational imports for the subsequent steps. ```Python import astropy.units as u from einsteinpy.rays import Shadow from einsteinpy.plotting import ShadowPlotter ``` -------------------------------- ### Format Code with Tox Source: https://docs.einsteinpy.org/en/stable/_sources/dev_guide.rst This snippet demonstrates how to use the `tox` command-line tool to automatically reformat Python code within the `einsteinpy` project. It requires navigating to the project directory and executing a specific `tox` environment to ensure consistent code style. ```bash $ cd einsteinpy/ $ tox -e reformat ``` -------------------------------- ### Metric Tensor Definition Source: https://docs.einsteinpy.org/en/stable/_sources/metric.rst Defines the differential length element in N-dimensional space using a metric tensor, and provides an example for spherical coordinates. ```APIDOC Metric Tensor Definition: ds^2 = g_{ij}dx_i dx_j - Describes the differential length element in an N-dimensional space. - g_ij: Components of the metric tensor. - dx_i: Infinitesimal displacement along the i-th coordinate. Spherical Coordinate Metric Tensor Example: g_00 = 1 g_11 = r^2 g_22 = r^2sin^2(theta) g_ij = 0 for i != j - Components of the metric tensor in spherical coordinates. - Assumes an orthogonal coordinate system where off-diagonal components are zero. ``` -------------------------------- ### Spherical Coordinate Metric Tensor Source: https://docs.einsteinpy.org/en/stable/metric Example of a metric tensor in spherical coordinates, illustrating diagonal components and the absence of off-diagonal components for orthogonal systems. ```mathematics g_{00} = 1 g_{11} = r^2 g_{22} = r^2\sin^2\theta g_{ij} = 0 \text{ when } i\neq j ``` -------------------------------- ### EinsteinPy Core API - BlackHole Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Animations in EinsteinPy.ipynb Documentation for the BlackHole class in EinsteinPy, used for defining and interacting with black holes. Includes initialization parameters and key methods. ```APIDOC class BlackHole: """Represents a Kerr black hole.""" __init__(mass: float ``` ```text ``` -------------------------------- ### Get Anti-De-Sitter Metric Tensor Source: https://docs.einsteinpy.org/en/stable/_sources/examples/Predefined Metrics in Symbolic Module.ipynb Retrieves the metric tensor for the Anti-De-Sitter spacetime. The output is provided in both LaTeX and plain text formats for clarity. ```python AntiDeSitter().tensor() ``` ```latex \displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & \cos^{2}{\left(t \right)} & 0 & 0\\0 & 0 & \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)} & 0\\0 & 0 & 0 & \sin^{2}{\left(\theta \right)} \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)}\end{matrix}\right] ``` ```plain ⎡-1 0 0 0 ⎤ ╓ ╖ ║ 2 ║ ║0 cos (t) 0 0 ║ ╓ ╖ ║ 2 2 ║ ║0 0 cos (t)⋅sinh (χ) 0 ║ ╓ ╖ ║ 2 2 2 ║ ⎣0 0 0 sin (θ)⋅cos (t)⋅sinh (χ)⎦ ```