Ejemplo n.º 1
0
def flat_sphere():
    import find_metric as fm
    import tensor as t
    g, diff = find_metric.flat_sphere()
    R = t.Riemann(g, dim=2, sys_title='flat_sphere', flat_diff=diff)
    C = Christoffel_2nd(metric=R.metric)
    return C
Ejemplo n.º 2
0
def Christoffel_2nd(
        g=None,
        metric=None):  # either g is supplied as arugment or the two-form
    from sympy.abc import u, v
    from sympy.diffgeom import metric_to_Christoffel_2nd
    from sympy import asin, acos, atan, cos, log, ln, exp, cosh, sin, sinh, sqrt, tan, tanh
    if metric is None:  # if metric is not specified as two_form
        import tensor as t
        R = t.Riemann(g, g.shape[0])
        metric = R.metric
    C = sym.Matrix(eval(str(metric_to_Christoffel_2nd(metric))))
    return C
Ejemplo n.º 3
0
def toroid(u=1, v=None, a=1):
    import find_metric as fm
    g, diff = fm.toroidal_coordinates()
    if v is None:
        g = g.subs('u', u)[:2, :2]
    else:
        g = g.subs('v', v)[1:, 1:]
    g = g.subs('a', a)

    import tensor as t
    R = t.Riemann(g, dim=2, sys_title='toroid')
    C = Christoffel_2nd(metric=R.metric)
    return C
Ejemplo n.º 4
0
def egg_carton():
    import tensor as t
    import find_metric as fm
    g, diff = find_metric.egg_carton_metric()
    R = t.Riemann(g, dim=2, sys_title='egg_carton', flat_diff=diff)
    """
    # this works :
    from sympy.abc import u,v
    u_,v_ = R.system.coord_functions()
    du,dv = R.system.base_oneforms()
    metric = R.metric.subs({u:u_,v:v_,'dv':dv,'du':du})
    """
    C = Christoffel_2nd(metric=R.metric)
    return C
Ejemplo n.º 5
0
def mobius_strip():
    import find_metric as fm
    import tensor as t
    g, diff = fm.mobius_strip()
    R = t.Riemann(g, dim=2, sys_title='mobius_strip', flat_diff=diff)
    #metric=R.metric
    from sympy.diffgeom import TensorProduct, Manifold, Patch, CoordSystem
    manifold = Manifold("M", 2)
    patch = Patch("P", manifold)
    system = CoordSystem('mobius_strip', patch, ["u", "v"])
    u, v = system.coord_functions()
    du, dv = system.base_oneforms()
    from sympy import cos
    metric = (cos(u / 2)**2 * v**2 / 4 + cos(u / 2) * v + v**2 / 16 +
              1) * TensorProduct(du, du) + 0.25 * TensorProduct(dv, dv)
    C = Christoffel_2nd(metric=metric)
    return C
Ejemplo n.º 6
0
import find_metric as fm
g = fm.kerr_metric()
import tensor as t
R = t.Riemann(g, 'kerr_metric', 4)
RC = R.Christoffel_tensor()
RR = R.Ricci_tensor()
scalarRR = R.scalar_curvature()

print "\nThe Kerr curve element has the following metric"
print g
print "\nThe Ricci tensor is given as"
print RR
print "\nand the scalar curvature is"
print scalarRR