Пример #1
0
def Ernst(B=symbols("B"), M=symbols("M")):
    """
    Black holes in a magnetic universe.
    J. Math. Phys., 17:54–56, 1976.
    Frederick J. Ernst.

    Parameters
    ----------
    M : ~sympy.core.basic.Basic or int or float
        Mass of the black hole. Defaults to ``M``.
    B : ~sympy.core.basic.Basic or int or float
        The magnetic field strength
        Defaults to ``B``.
    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    # Helper functions
    lambd = 1 + ((B * r * sin(th))**2)
    w = 1 - ((2 * M) / r)

    # define the metric
    metric = diag(
        -1 * (lambd**2) * w,
        (lambd**2) / w,
        ((r * lambd)**2),
        (((r * sin(th)) / lambd)**2),
    ).tolist()
    return MetricTensor(metric, coords, "ll")
Пример #2
0
def JanisNewmanWinicour(
    c=constants.c, G=constants.G, gam=symbols("gam"), M=symbols("M")
):
    """
    Reality of the Schwarzschild singularity.
    Phys. Rev. Lett., 20:878–880, 1968.
    A. I. Janis, E. T. Newman, and J. Winicour.

    Parameters
    ----------
    M : ~sympy.core.basic.Basic or int or float
        Mass parameter, this is used for defining the schwarzschild metric. Defaults to ``M``.
    gam : ~sympy.core.basic.Basic or int or float
        Parameter for scaling  Schwarzschild radius, for gamma=1 this will return the  Schwarzschild metric
        Defaults to ``gam``.
    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    # Helper functions
    r_s = (2 * G * M) / (c ** 2)
    alpha = 1 - (r_s / (gam * r))

    # define the metric
    metric = diag(
        -1 * (alpha ** gam),
        (alpha ** -gam) / (c ** 2),
        (r ** 2) * (alpha ** (-gam + 1)),
        (r ** 2) * (alpha ** (-gam + 1)) * (sin(th) ** 2),
    ).tolist()
    return MetricTensor(metric, coords, "ll", name="JanisNewmanWinicourMetric")
Пример #3
0
def Kerr(c=constants.c, sch=symbols("r_s"), a=symbols("a")):
    """
    Kerr Metric in Boyer Lindquist coordinates.

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to ``c``.
    sch : ~sympy.core.basic.Basic or int or float
        Any value to assign to Schwarzschild Radius of the central object. 
        Defaults to ``r_s``.
    a : ~sympy.core.basic.Basic or int or float
        Spin factor of the heavy body. Usually, given by ``J/(Mc)``,
        where ``J`` is the angular momentum.
        Defaults to ``a``.

    """
    coords = symbols("t r theta phi")
    t, r, theta, phi = coords
    Sigma = r**2 + (a**2 * cos(theta)**2)
    Delta = r**2 - sch * r + a**2
    c2 = c**2

    metric = diag(
        1 - (sch * r / Sigma),
        -Sigma / (Delta * c2),
        -Sigma / c2,
        -((r**2 + a**2 + (sch * r * (a**2) * (sin(theta)**2) / Sigma)) *
          (sin(theta)**2)) / c2,
    ).tolist()
    metric[0][3] = metric[3][0] = sch * r * a * (sin(theta)**2) / (Sigma * c)
    return MetricTensor(metric, coords, "ll")
Пример #4
0
def SchwarzschildMetric(symbolstr="t r theta phi"):
    """
    Returns  Metric Tensor  of symbols of Schwarzschild Metric.

    Parameters
    ----------
    symbolstr : string
        symbols to be used to define schwarzschild space, defaults to 't r theta phi'

    Returns
    -------
    ~einsteinpy.symbolic.metric.MetricTensor
        Metric Tensor for Schwarzschild space-time
    """
    raise_warning(
        PendingDeprecationWarning,
        "SchwarzschildMetric class would be deprecated with v0.3.0 !",
    )
    list2d = [[0 for i in range(4)] for i in range(4)]
    syms = sympy.symbols(symbolstr)
    c, a = sympy.symbols("c a")
    list2d[0][0] = 1 - (a / syms[1])
    list2d[1][1] = -1 / ((1 - (a / syms[1])) * (c**2))
    list2d[2][2] = -1 * (syms[1]**2) / (c**2)
    list2d[3][3] = -1 * (syms[1]**2) * (sympy.sin(syms[2])**2) / (c**2)

    return MetricTensor(list2d, syms)
Пример #5
0
def AntiDeSitterStatic():
    """
    Static form of Anti-de Sitter space

    Hawking and Ellis (5.9) p131

    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    metric = diag(-cosh(r) ** 2, 1, sinh(r) ** 2, sinh(r) ** 2 * sin(th) ** 2).tolist()
    return MetricTensor(metric, coords, "ll", name="AntiDeSitterStaticMetric")
Пример #6
0
def DeSitter():
    """
    de Sitter space

    Hawking and Ellis p125

    """
    coords = symbols("t x y z")
    t = coords[1]
    al = symbols("alpha")
    expr = exp(2 * t / al)
    metric = diag(-1, expr, expr, expr).tolist()
    return MetricTensor(metric, coords, "ll", name="DeSitterMetric")
Пример #7
0
def Godel():
    """
    Godel metric
    Rev. Mod. Phys., v21, p447, (1949)
    Stephani (10.25) 122
    """
    coords = symbols("t x y z")
    om = symbols("omega")
    t, x, y, z = coords
    # define the metric
    metric = diag(-1, 1, -Rational(1, 2) * exp(2 * sqrt(2) * om * x), 1)
    metric[0, 2] = metric[2, 0] = -exp(sqrt(2) * om * x)
    metric = metric.tolist()
    return MetricTensor(metric, coords, "ll")
Пример #8
0
def Minkowski(c=constants.c):
    """
    Minkowski(flat) space-time. Space-time without any curvature or matter.

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to 'c'.

    
    """
    coords = symbols("t x y z")
    metric = diag(-1, 1 / (c**2), 1 / (c**2), 1 / (c**2)).tolist()
    return MetricTensor(metric, coords, "ll")
Пример #9
0
def Davidson():
    """
    Davidson's cylindrically symmetric radiation perfect fluid universe
    Davidson, J. Math. Phys., v32, p1560, (1991)
    """
    coords = symbols("t r z phi")
    t, r, z, phi = coords
    expr = (1 + r**2)**Rational(2, 5)
    metric = diag(
        -(expr**3),
        t**Rational(4, 3) * expr,
        t**Rational(-2, 3) / expr,
        t**Rational(4, 3) * r**2 / expr,
    ).tolist()
    return MetricTensor(metric, coords, "ll", name="DavidsonMetric")
Пример #10
0
def KerrNewman(
        c=constants.c,
        G=constants.G,
        eps_0=constants.eps_0,
        sch=symbols("r_s"),
        a=symbols("a"),
        Q=symbols("Q"),
):
    """
    Kerr-Newman Metric in Boyer Lindquist coordinates.

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to ``c``.
    G : ~sympy.core.basic.Basic or int or float
        Any value to assign to the Newton's (or gravitational) constant. Defaults to ``G``.
    eps_0 : ~sympy.core.basic.Basic or int or float
        Any value to assign to the electric constant or permittivity of free space. Defaults to ``eps_0``.
    sch : ~sympy.core.basic.Basic or int or float
        Any value to assign to Schwarzschild Radius of the central object.
        Defaults to ``r_s``.
    a : ~sympy.core.basic.Basic or int or float
        Spin factor of the heavy body. Usually, given by ``J/(Mc)``,
        where ``J`` is the angular momentum.
        Defaults to ``a``.
    Q:  ~sympy.core.basic.Basic or int or float
        Any value to assign to eletric charge of the central object.
        Defaults to ``Q``.

    """
    coords = symbols("t r theta phi")
    t, r, theta, phi = coords
    Sigma = r**2 + (a**2 * cos(theta)**2)
    rQsq = ((Q**2) * G) / (4 * pi * eps_0 * (c**4))
    Delta = r**2 - sch * r + a**2 + rQsq
    c2 = c**2

    metric = diag(
        1 + ((rQsq - sch * r) / Sigma),
        -Sigma / (Delta * c2),
        -Sigma / c2,
        (Delta * a**2 * sin(theta)**2 - (r**2 + a**2)**2) * sin(theta)**2 /
        (Sigma * c2),
    ).tolist()
    metric[0][3] = metric[3][0] = (sch * r - rQsq) * a * (sin(theta)**
                                                          2) / (Sigma * c)
    return MetricTensor(metric, coords, "ll", name="KerrNewmanMetric")
Пример #11
0
def CMetric():
    """
    The C-metric
    Stephani (Table 16.2) p188
    """

    coords = symbols("t x y phi")
    x, y = coords[1], coords[2]
    f, h = Function("f")(x), Function("h")(y)
    metric = diag(
        -h / (x + y)**2,
        1 / ((x + y)**2 * f),
        1 / ((x + y)**2 * h),
        f / (x + y)**2,
    ).tolist()
    return MetricTensor(metric, coords, "ll")
Пример #12
0
def AntiDeSitter():
    """
    Anti-de Sitter space

    Hawking and Ellis (5.9) p131

    """
    coords = symbols("t chi theta phi")
    t, ch, th, ph = coords
    metric = diag(
        -1,
        cos(t) ** 2,
        cos(t) ** 2 * sinh(ch) ** 2,
        cos(t) ** 2 * sinh(ch) ** 2 * sin(th) ** 2,
    ).tolist()
    return MetricTensor(metric, coords, "ll", name="AntiDeSitterMetric")
Пример #13
0
def MinkowskiPolar(c=constants.c):
    """
    Minkowski(flat) space-time in Polar coordinates. Space-time without any curvature or matter.

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to 'c'.


    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    c2 = c**2
    metric = diag(-1, 1 / c2, (r**2) / c2, (r**2 * sin(th)**2) / c2).tolist()
    return MetricTensor(metric, coords, "ll", name="MinkowskiMetricPolar")
Пример #14
0
def AlcubierreWarp(
    x_s=symbols("x_s"), sigma=symbols("sigma"), R=symbols("R"), v=symbols("v")
):
    """
    Alcubierre Warp Drive Metric (G = c = 1) [1]_

    .. [1] Classical and Quantum Gravity,
    "The warp drive: hyper-fast travel within general relativity",
    Miguel Alcubierre, 1994, **11(5)**, pp. 73-77

    arXiv: `<https://arxiv.org/abs/gr-qc/0009013>`_)

    Journal: `<https://doi.org/10.1088%2F0264-9381%2F11%2F5%2F001>`_

    Parameters
    ----------
    x_s : ~sympy.core.basic.Basic or int or float
        Coordinate (a function of time, `t`)
    sigma : ~sympy.core.basic.Basic or int or float
        Arbitrary Parameter (See paper [1]_)
    R : ~sympy.core.basic.Basic or int or float
        Arbitrary Parameter (See paper [1]_)
    v : ~sympy.core.basic.Basic or int or float
        Coordinate Velocity

    Returns
    -------
    ~einsteinpy.symbolic.metric.MetricTensor
        Alcubierre Warp Drive Metric Tensor


    Alcubierre Warp Drive Metric (G = c = 1) [1]_

    """
    coords = symbols("t x y z")
    t, x, y, z = coords
    r_s = sqrt((x - x_s) ** 2 + y + z)
    f = (tanh(sigma * (r_s + R)) - tanh(sigma * (r_s - R))) / (2 * tanh(sigma * R))

    v2 = v ** 2
    f2 = f ** 2

    metric = diag(v2 * f2 - 1, 1, 1, 1).tolist()
    metric[0][1] = metric[1][0] = -v * f

    return MetricTensor(metric, coords, "ll", name="AlcubierreWarpMetric")
Пример #15
0
def Schwarzschild(c=constants.c, sch=symbols("r_s")):
    """
    Schwarzschild exterior metric in curvature coordinates
    Schwarzschild, Sitz. Preuss. Akad. Wiss., p189, (1916)
    Stephani (13.19) p157

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to ``c``.
    sch : ~sympy.core.basic.Basic or int or float
        Any value to assign to Schwarzschild Radius of the central object. 
        Defaults to ``r_s``.
    
    """
    coords = symbols("t r theta phi")
    t, r, theta, phi = coords
    val1, c2 = 1 - sch / r, c**2
    metric = diag(val1, -1 / (val1 * c2), -1 * (r**2) / c2,
                  -1 * ((r * sin(theta))**2) / c2).tolist()
    return MetricTensor(metric, coords, "ll")
Пример #16
0
def BarriolaVilekin(c=constants.c, k=symbols("k")):
    """
    Barriola-Vilekin monopol metric 
    Phys. Rev. Lett. 63, 341
    Manuel Barriola and Alexander Vilenkin
    Published 24 July 1989

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to 'c'.
    k : ~sympy.core.basic.Basic or int or float
        The scaling factor responsible for the deficit/surplus angle
        Defaults to ``k``.
    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    # define the metric
    metric = diag(-1, 1 / (c**2), ((k * r)**2) / (c**2),
                  ((k * r * sin(th))**2) / (c**2)).tolist()
    return MetricTensor(metric, coords, "ll", name="BarriolaVilekinMetric")
Пример #17
0
def BesselGravitationalWave(C=symbols("C")):
    """
    Exact gravitational wave solution without diffraction.
    Class. Quantum Grav., 16:L75–78, 1999.
    D. Kramer.

    An exact solution describing an axisymmetric gravitational wave propagating in the
    z-direction in closed form. This solution to Einstein’s vacuum field equations has the
    remarkable property that the curvature invariants decrease monotonically with increasing radial
    distance from the axis and vanish at infinity. The solution is regular at the symmetry axis.

    Parameters
    ----------
    C : ~sympy.core.basic.Basic or int or float
        Constant for Bessel metric, the choice of the constant is not really relavent for details see the paper. Defaults to 'C'.
    """
    coords = symbols("t rho phi z")
    t, rho, ph, z = coords

    # Useful helper functions, these wrap the Bessel functions that are used. C is some constant here
    U = C * besselj(rho, 0) * cos(t)
    K = (
        (1 / 2)
        * (C ** 2)
        * rho
        * (
            (rho * ((besselj(rho, 0) ** 2) + (besselj(rho, 1) ** 2)))
            - (2 * besselj(rho, 0) * besselj(rho, 1) * (cos(t) ** 2))
        )
    )

    # define the metric
    metric = diag(
        -1 * exp(-2 * U) * exp(2 * K),
        exp(-2 * U) * exp(2 * K),
        exp(-2 * U) * (rho ** 2),
        exp(2 * U),
    ).tolist()
    return MetricTensor(metric, coords, "ll")
Пример #18
0
def ReissnerNordstorm(
        c=constants.c,
        G=constants.G,
        eps_0=constants.eps_0,
        sch=symbols("r_s"),
        Q=symbols("Q"),
):
    """
    The Reissner–Nordström metric in spherical coordinates
    A static solution to the Einstein–Maxwell field equations,
    which corresponds to the gravitational field of a charged,
    non-rotating, spherically symmetric body of mass M.

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to ``c``.
    G : ~sympy.core.basic.Basic or int or float
        Any value to assign to the Newton's (or gravitational) constant. Defaults to ``G``.
    eps_0 : ~sympy.core.basic.Basic or int or float
        Any value to assign to the electric constant or permittivity of free space. Defaults to ``eps_0``.
    sch : ~sympy.core.basic.Basic or int or float
        Any value to assign to Schwarzschild Radius of the central object.
        Defaults to ``r_s``.
    Q:  ~sympy.core.basic.Basic or int or float
        Any value to assign to eletric charge of the central object.
        Defaults to ``Q``.

    """
    coords = symbols("t r theta phi")
    t, r, theta, phi = coords
    rQsq = ((Q**2) * G) / (4 * pi * eps_0 * (c**4))
    Arn = 1 - sch / r + rQsq / r**2
    c2 = c**2

    metric = diag(Arn, -1 / (Arn * c2), -(r**2) / c2,
                  -(r**2) * sin(theta)**2 / c2).tolist()
    return MetricTensor(metric, coords, "ll", name="ReissnerNordstormMetric")
Пример #19
0
def BertottiKasner(c=constants.c, k=symbols("k"), lambd=symbols("l")):
    """
    Birkhoff’s theorem with Λ-term and Bertotti-Kasner space
    Phys. Lett. A, 245:363–365, 1998
    W. Rindler

    Parameters
    ----------
    c : ~sympy.core.basic.Basic or int or float
        Any value to assign to speed of light. Defaults to 'c'.
    lambd : ~sympy.core.basic.Basic or int or float
        The cosmological constant, note it must be postive. 
        Defaults to ``l``.
    """
    coords = symbols("t r theta phi")
    t, r, th, ph = coords
    # define the metric
    metric = diag(
        -1,
        exp(2 * sqrt(lambd) * c * t) / (c**2),
        1 / (lambd * (c**2)),
        (sin(th)**2) / (lambd * (c**2)),
    ).tolist()
    return MetricTensor(metric, coords, "ll", name="BertottiKasnerMetric")