Esempio n. 1
0
def test_EinsteinTensor_trace_negetive_of_Ricci_Scalar_in_4D(metric):
    # https://en.wikipedia.org/wiki/Einstein_tensor#Trace
    G1 = EinsteinTensor.from_metric(metric)
    G2 = G1.change_config("ul")
    val1 = simplify(tensorcontraction(G2.tensor(), (0, 1)))
    val2 = RicciScalar.from_metric(metric).expr
    assert simplify(val1 + val2) == 0
Esempio n. 2
0
def test_RicciScalar_raise_TypeError():
    x, y = sympy.symbols("x y")
    try:
        R = RicciScalar(x ** 2 * y * 3, 0)
        assert False
    except TypeError:
        assert True
Esempio n. 3
0
### "DeSitter"
mink = DeSitter()
t = mink.tensor()
pprint(t)
### @end
assert isinstance(sch, einsteinpy.symbolic.metric.MetricTensor)
snippets['DeSitter'] = latex(t)

### "AntiDeSitter"
mink = AntiDeSitter()
t = mink.tensor()
pprint(t)
### @end
assert isinstance(sch, einsteinpy.symbolic.metric.MetricTensor)
snippets['AntiDeSitter'] = latex(t)

### "Ricci-curvatures"
scalar_curvature_de_sitter = RicciScalar.from_metric(DeSitter())
scalar_curvature_anti_de_sitter = RicciScalar.from_metric(AntiDeSitter())
### @end
snippets['DeSitter-curvature'] = latex(scalar_curvature_de_sitter.expr)
snippets['AntiDeSitter-curvature'] = latex(
    scalar_curvature_anti_de_sitter.expr)
snippets['AntiDeSitter-simplified'] = latex(
    simplify(scalar_curvature_anti_de_sitter.expr))

### "save-latex"
with open("snippets.json", 'w') as f:
    json.dump(snippets, f)
Esempio n. 4
0
def test_RicciScalar_inbuilt_simplify_works():
    x, y = sympy.symbols("x y")
    R = RicciScalar((-y) + 2 * sin(x) * cos(x) + y - sin(2 * x), (x, y))
    val = R.simplify(set_self=True)
    assert R.expr == 0
    assert sum(val) == 0
Esempio n. 5
0
def test_RicciScalar_is_constant_for_ADS_spacetime():
    # R is -12 for anti-de-Sitter spacetime
    mt = anti_de_sitter_metric()
    R = RicciScalar.from_metric(mt)
    assert sympy.simplify(R.expr).is_constant()
Esempio n. 6
0
def test_RicciScalar_expr_property():
    x, y = sympy.symbols("x y")
    R = RicciScalar(x**2 * y * 3, (x, y))
    assert sympy.simplify(R._expr - R.expr) == 0