abstract index notation and differential geometry

I am wondering if there are ways to use abstract index notation in sage. For example, could I define the tensor:

$$C^c_{ab}=\frac{1}{2}g^{cd}(\tilde{\nabla_a} g_{bd}+\tilde{\nabla_b} g_{ad} - \tilde{\nabla_d} g_{ab})$$

this particular object describes the difference between two connections, $\nabla_a$ and $\tilde{\nabla}_b$. Can we define objects like this an manipulate them in Sage? My confusion comes from the common definition of the connection, a la

nabla = g.connection()


Which is not directly a 1-tensor. Specifically, I would like to define a metric, $g_{ab}$, and a conformal transformation $\tilde{g_{ab}}=\Omega^2 g_{ab}$, the corresponding connections, and determine the tensor $C^a_{bc}$ for this particular case. (and of course, we know the answer because this the standard approach to conformal transformations in GR).

edit retag close merge delete

Sort by » oldest newest most voted

Yes there is a partial support of index notation in Sage, see the section "Tensor calculus" of the tutorial. Here is a full example to compute the tensor field $C^c_{\ \ ab}$ that you mention:

sage: M = Manifold(2, 'M')
sage: X.<u,v> = M.chart()
sage: g = M.metric('g')
sage: g[0,1] = -1/2
sage: g.display()
g = -1/2 du*dv - 1/2 dv*du
sage: Omega = M.scalar_field(2/(sqrt(1+u^2)*sqrt(1+v^2)))
sage: tg = M.metric('tg', latex_name=r'\tilde{g}')
sage: tg.set(Omega^2*g)
sage: tg.display()
tg = -2/((u^2 + 1)*v^2 + u^2 + 1) du*dv - 2/((u^2 + 1)*v^2 + u^2 + 1) dv*du
sage: tnabla = tg.connection()
sage: ig = g.inverse()
sage: tng = tnabla(g)
sage: C = 1/2*ig['^{cd}']*(tng['_{bda}'] + tng['_{adb}'] - tng['_{abd}'])
sage: C
Tensor field of type (1,2) on the 2-dimensional differentiable manifold M
sage: C.display()
u/(u^2 + 1) d/du*du*du + v/(v^2 + 1) d/du*du*dv + u/(u^2 + 1) d/dv*dv*du + v/(v^2 + 1) d/dv*dv*dv
sage: C[:]
[[[u/(u^2 + 1), v/(v^2 + 1)], [0, 0]], [[0, 0], [u/(u^2 + 1), v/(v^2 + 1)]]]
sage: C[0,0,0]
u/(u^2 + 1)


EDIT (31 May 2020): the above code requires the latest version of SageMath, i.e. 9.1. Indeed, the syntax

C = 1/2*ig['^{cd}']*(tng['_{bda}'] + tng['_{adb}'] - tng['_{abd}'])


which involves a sum of tensors in index notation, is not understood in older versions of SageMath. See the 9.1 release notes.

more

Hi Eric: Where can I download 9.1 for windows?. It does not seems to be in the mirrors!

Daniel Volinski

( 2020-05-31 20:31:32 +0100 )edit

Thanks: I will have to work out getting the latest version on my system before testing/marking correct, but it does seem that you've got a solution here.

( 2020-06-02 00:43:51 +0100 )edit

Ok that does seem to be a partial solution, but it doesn't allow the metric to be represented with abstract indices. For example, the answer to this problem is generically $C^c_{ab}=2\delta ^c_{(a}\nabla_{b)}\ln \Omega-g_{ab}g^{cd}\nabla_d \ln \Omega$.

( 2020-06-04 21:22:28 +0100 )edit