How do I speed up the symbolic calculation of Riemann tensor?

asked 0 years ago

aneet gravatar image

updated 0 years ago

I've been trying to use sagemath for a derivation in general relativity. For a particular step I need to calculate the riemann tensor of a perturbation metric (This metric has no particular form) and the cell did not execute for even after 16 hours of run time. Here's the snippet of my code. can someone help me in defining a metric in some other way, probably indicial notation or something else so that the process can speed up?

here's a minimal code:

h=M.metric('h') for i in range(4): for j in range(4): h[i, j] = function(f'h{i}{j}')(t, x, y, z) h[i, j] = h[j, i]

h[:] riemann=h.riemann() riemann.display()

Preview: (hide)

Comments

1

please provide a minimal code example

FrédéricC gravatar imageFrédéricC ( 0 years ago )

Try to give the metric in a closed form as much as you can: For example, use a function f(t,x) instead of t3+xt+x2.

tolga gravatar imagetolga ( 0 years ago )
1

You could try to use a simplification chain lighter than the default one, since this is where most of the CPU time is spent. See https://doc.sagemath.org/html/en/refe...

eric_g gravatar imageeric_g ( 0 years ago )

here's a minimal code:

h=M.metric('h')
for i in range(4):
    for j in range(4):
        h[i, j] = function(f'h{i}{j}')(t, x, y, z)
        h[i, j] = h[j, i]

h[:]
riemann=h.riemann()
riemann.display()
aneet gravatar imageaneet ( 0 years ago )

If all of the elements of your metric are nonzero and strictly depend on each coordinate, then the Riemann tensor calculation should take a serious amount of time. A lighter simplification suggestion of @eric_g seems like the only way to have a result (useful or not). However, I would first think about the restrictions I could put on the metric (e.g. no time dependence, no g_{tr} terms, etc.).

tolga gravatar imagetolga ( 0 years ago )