コード例 #1
0
def test_no_exception_raised_passing_christoffel_with_unconventional_indices():
    sch = schwarzschild_metric()
    ch = ChristoffelSymbols.from_metric(sch)
    ch2 = ch.change_config("uuu")
    try:
        rm = RiemannCurvatureTensor.from_christoffels(ch2)
        assert True
    except:
        assert False
コード例 #2
0
def test_properties():
    sch_inv = schwarzschild_metric()
    ch = ChristoffelSymbols.from_metric(sch_inv)
    assert ch.parent_metric == ch._parent_metric
    # test change_config, should raise ValueError
    ch._parent_metric = None
    try:
        ch_new = ch.change_config("lll")
        assert False
    except Exception:
        return True
コード例 #3
0
    def get_christoffel_symbols(self, input_vectors=None):
        """
        returns the christoffel symbols in the standard order:
            `cf[i,j,k]`= $\Gamma^i_{jk}$
        einsteinpy is used to obtain the tensor
        """
        cf = ChristoffelSymbols.from_metric(self.get_metric_tensor())

        if input_vectors is not None:            
            cf = self.model.apply(cf.tensor(), input_vectors)
        
        return cf
コード例 #4
0
def test_ChristoffelSymbols():
    sch = schwarzschild_metric()
    chl = ChristoffelSymbols.from_metric(sch)
    mat = chl.tensor()
    symbolstr = "t r theta phi"
    syms = sympy.symbols(symbolstr)
    G, M, c, a = sympy.symbols("G M c a")
    assert (
        sympy.simplify(mat[2, 3, 3] -
                       (-1 * sympy.cos(syms[2]) * sympy.sin(syms[2]))) == 0)
    assert sympy.simplify(mat[3, 3, 1] - syms[1] / (syms[1]**2)) == 0
    assert (sympy.simplify((mat[1, 1, 1].subs({a: (2 * G * M / (c**2))})) -
                           (G * M /
                            (2 * G * M * syms[1] - c**2 * syms[1]**2))) == 0)
    assert chl.symbols() == syms
コード例 #5
0
 def christoffel_symbol(self):
     from einsteinpy.symbolic import ChristoffelSymbols
     return ChristoffelSymbols.from_metric(self.metric_tensor)
コード例 #6
0
 def get_tensor():
     metric = AntiDeSitter()
     return ChristoffelSymbols.from_metric(metric)