Ask Your Question

Computing the Chern–Pontryagin invariant

asked 2024-01-12 08:26:08 +0200

JackHughes14 gravatar image

Hi there,

I'm currently trying to construct the so called Chern–Pontryagin invariant for (say) Schwarzschild spacetime, which is a term constructed as the Riemann tensor contracted with its dual:

$ P_4 = R_{\alpha \beta \mu \nu} \varepsilon^{\alpha \beta \rho \sigma} R_{\rho \sigma}^{\mu \nu}, $

where $\varepsilon$ is the volume form (or effectively the Hodge dual in this set up).

This term cannot be broken up into two independent contractions which we then trace over, since in this case the trace will vanish identically. Therefore the contraction has to appear as is, in one single computation.

I thought about constructing this as a sequence of for loops (regardless of how long it would take)

Id = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                for m in range(4):
                    for n in range(4):
                        Id = R_down['_ijkl']*dual['^ijmn']*R_up['^kl_mn']

But this always returns the TypeError: 'the second item of * must be a tensor with specified indices'.

How can I perform the type of triple tensor contraction appearing above in general? Note that the problem would be the same as for computing the topological Euler density, which involves a double dual:

$ \varepsilon^{\alpha \beta \gamma \delta} R^{\mu \nu}_{\alpha \beta} R^{\rho \sigma}_{\gamma \delta} \varepsilon_{\mu \nu \rho \sigma} $

Any ideas?

Many thanks.

edit retag flag offensive close merge delete



I do not think that you will need loops. Please check this page to see that the Kretschmann scalar is defined and calculated as

R = g.riemann()
K = R.down(g)['_{abcd}'] * R.up(g)['^{abcd}']

and the types are:


Tensor field Riem(g) of type (1,3) on the 4-dimensional Lorentzian manifold M
Scalar field on the 4-dimensional Lorentzian manifold M

You will need to make sure that the type of your "dual" is correct and update your code accordingly.

tolga gravatar imagetolga ( 2024-01-12 20:52:34 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2024-01-13 14:38:44 +0200

eric_g gravatar image

You have to access to the tensor components by directly passing the indices to the operator [], not via a string (as @tolga 's comment pointed out, string access shall be used outside loops). Moreover, you have to substitute Id = by Id +=. So the code should be something like

Id = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                for m in range(4):
                    for n in range(4):
                        Id += R_down[i,j,k,l]*dual[i,j,m,n]*R_up[k,l,m,n]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2024-01-12 08:26:08 +0200

Seen: 158 times

Last updated: Jan 13