# General relativity and computing with tensors

In Riemannian Geometry (or Pseudo-Riemannian too), all of the operations performed are in general position dependent. For example, the metric tensor $g_{\mu\nu}(x)$ is dependent on position $x^i$ for $i=0,\cdots,N$.

Since the raising and lowering of components in a rank-n tensor is based on the metric tensor then the act of raising and lowering of components seems to be position dependent as well (my assumption, please confirm true/false).

And, I am also assuming that even performing a contraction is position dependent.

Therefore, I am assuming that when you are actually working on a problem, computing actual numbers for a solution that all of these operations that we normally display merely by index manipulation are position dependent and therefore computation-heavy operations.

However, if this assumption is correct then I am confused about the general case of deriving the Ricci Tensor from the Riemannian Curvature tensor via contraction operation. Sure, given a well formed coordinate system (Spherical?) such operations are maintained in functional form with variables $r, \theta, and\, \phi$ but is this always the case? Or, is this contraction producing the Ricci tensor performed for each individual position in the domain of computation?

Please confirm or correct my assumptions. Alternatively, point me to some resource that describes how one goes about computing with tensors in the general sense (where an obviously simple Euclidean space is not assumed).

• You're given the Riemann tensor (as a function of position) and the metric tensor (as a function of position) and then you apply the formula to obtain the Ricci tensor (as a function of position). What exactly is your question about that? Just that this seems in general a bit difficult? It is, in general. Oct 27, 2016 at 17:33
• If I were dealing with a functional form where derivatives are always able to be taken resulting in functional form I have no issues. However, I am thinking in a general case where this is not feasible or more likely the problem being solved is based on multiple coordinate patches that are different from each other. Oct 27, 2016 at 17:36
• GR is notoriously laborious to work with in practice, if that's what you mean. Some early algebra systems were written specifically to take the labour out of it. But a lot of computations in physical systems are either laborious, numerically extremely intensive or both: that's the nature of the game.
– user107153
Oct 27, 2016 at 22:34

How complicated or expensive the problem/computations become at the end highly depends on what you do and what one really is interested in.

In the scope of your question lets look at a simple problem (which involves numerical solutions) and how one would really tackle it: A spherical symmetric, static, cold compact star composed of an ideal fluid. This is the setting of the Tolman-Oppenheimer-Volkoff (TOV) equation. After some algebra, which works in the symmetries one is left with the task of solving 3 differential equations: two for the only two open metric potentials and 1 for the pressure gradient. The Einstein equations come down to just 3 differential equations. I can bring them to this state just by working in my symmetries. One does not need any specific values of the tensor fields. To bring down/simplify expressions one does not need the functional forms: eg. I can lower or raise indices with the metric where and when ever I want for that I do not need to know how my metric explicitly looks like in the end: $x_\mu=g_{\mu\nu}x^\nu$ holds for all $x_\mu\in \mathbb{R}^4$ and I can write this down without having any clue about the metric or how the metric potentials look like. All preliminary tensor algebra looks works like that.

So to completely describe the star and its spacetime one only needs to solve those 3 differential equations numerically. What one is left with after are three functions $P(r)$, $\nu(r)$ and $\lambda(r)$. $P(r)$ describes the pressure gradient of the star and with an equation of state this specifies the configuration completely and $\nu(r)$ and $\lambda(r)$ are the metric potentials from the line element: $$ds^2=-e^{\nu(r)}dt^2+e^{\lambda(r)}dr^2+r^2(d\theta^2+\sin^2\theta d\phi^2).$$

Now that we know all missing parts we can compute anything related to the problem: geodesics, total internal energy, surface gravity everything one can think of. The total internal energy would be something like $$M_{TW}=\int (T_{i}^{~i}-T_{t}^{~t})\sqrt{-g}dV =4\pi \int_0^R dr~ r^2e^{(\nu(r)+\lambda(r))/2}(\rho(r)+3P(r)).$$ Computing that numerically is straight forward once we have our metric potentials and pressure gradient as numerical solutions. So that we do not know analytical solutions for our metric potentials and pressure gradients is not a problem in the end because we really do not need to have them analytically.

If one is really interested in high end numerical General relativistic calculations in 4D I would recommend literature on Numerical Relativity. Or you could look at software packages/codes like LORENE or Whisky. Those codes implement tensor fields and operations on and with them. Those codes are able to solve the Einstein equations (+Maxwell,...) on spacetime grids numerically exact. Depending on the problem at hand however one will always try to work in the symmetries to reduce the dimensionality as much as possible. In the scope of those codes the Einstein equations in general do not decouple and very involved numerical methods are necessary to solve those coupled differential equations.

• I am not sure if this answers my question or not. I think I need time to think about your comments and also look into Numerical Relativity a bit more (I had already looked at a few resources). Checked out LORENE briefly a few moments ago but could not locate Whiskey as I need to discover a way to refine my google search without some article popping up about physicists getting drunk on whiskey because they are having trouble with their tensors and things of that ilk. Oct 28, 2016 at 21:57

Thinking about it in abstract geometrical terms might help. So, you have a (pseudo-)Riemannian manifold but you don't have to consider coordinates.

In calculations, you're considering a point on the manifold, let's say $\mathbf{x}$. All quantities are either evaluated at that point or they are integrals over specified regions. One cannot trivially compare values of fields at different points and that's why we use Christoffel symbols $\mathbf{\Gamma}$, i.e. connections. They allow us to take into account the metric structure of the manifold and go between different coordinate patches.

Raising, lowering and contracting indices is accomplished by multiplication with $g^{\mu \nu} (x)$. So what happens there?

Consider a vector-valued function $A^\mu (x)$. This function takes a point on the manifold, parametrized by $x$, and it maps it to a contravariant vector at that point, i.e. to an element of the cotangent vector space at that point.

Similarly, $A_{\mu} (x)$ maps the point to a covariant vector, i.e. an element of the tangent vector space at that point.

The metric tensor, on the other hand, is perhaps best viewed as a function that takes two arguments and spits out a scalar. Specifically, it takes a tangent vector and a cotangent vector and maps them to a scalar. The thing is, you have a different (co)tagent space at each point on the manifold (they constitute the (co)tangent bundle, by the way) and you obviously can't work with vectors from different vector spaces. That's why $\mathbf{g}$ is a function of position, you have to specify a point and both vectors have to be defined in spaces at that point on the manifold.

With that being said, raising and lowering simply amounts to looking at the metric with one slot empty, i.e. $$g^{\mu \nu}A_\nu \leftrightarrow \mathbf{g} ( \mathbf{A}, \, \, )$$ $$g_{\mu \nu}A^\nu \leftrightarrow \mathbf{g} ( \, \, , \mathbf{A} )$$

Contraction should be obvious at this point, although it's just slightly more complicated to talk about it.

The point (no pun intended) is, those operations are all taken at the same point.

• thanks for the effort you put into your answer. However, I already know all that -- been through several GR texts already. My question was more about computational work. Maybe the extreme condition that I am interested is where the metric tensor and everything else is nothing other than numbers and you have these numbers for all the points of interest -- that is, no analytical or functional form. Albeit, that is the extreme -- I am currently thinking through the issue with some helps of numerical relativity resources on-line. Oct 29, 2016 at 18:27
• No, the metric tensor doesn't take a tangent vector and a cotangent vector to a scalar. It takes two tangent vectors to a scalar, or two cotangent vectors to a scalar, or a tangent vector to a cotangent vector or vice-versa. Jan 30, 2020 at 5:37

Your intuition is correct. When we denote a tensor by its elements, say $$g_{\mu\nu}$$, we really mean $$g_{\mu\nu}(x^\sigma)$$, where $$x^\sigma$$ denotes the functional dependence on the coordinates.

So yes, when we contract a tensor, say :

$$J_{\mu}=J^\nu g_{\mu\nu}$$

We really mean : $$J_{\mu}(x^\sigma)= J^\nu(x^\sigma)g_{\mu\nu}(x^\sigma)$$ But we almost never write it, because it is redundant. However, when we do a change of coordinates, that's when it becomes actually important to at least have in mind what's happening. Let's denote

$$J^{\mu'}_{\nu}=\frac{\partial x'{}^{\mu}}{\partial x^\nu}$$

As well as :

$$J^{\mu}_{\nu'}=\frac{\partial x^{\mu}}{\partial x'{}^\nu}$$

If you haven't used the "primes on the indices" notation don't worry, it's just a neat trick to make less mistakes and remember formulas easier.

Then, we usually use the transformation rule :

$$V'^{\mu'}=V^{\nu}J^{\mu'}_{\nu}$$

Which tells us how the components of the $$V^\mu$$ transform into $$V'{}^\mu$$ in the new coordinates. But here, we have to be careful when we restore the x dependence. To be correct, the equation reads :

$$V'^{\mu'}(x'^{\sigma})=V^{\nu}(x^{\sigma})J^{\mu'}_{\nu}(x^{\sigma})$$

Notice how transforming the element $$V^{\nu}(x^{\sigma})$$, gives us $$V'^{\mu'}(x'^{\sigma})$$ which is evaluated at the transformed coordinates location. Of course, both $$x'^{\sigma}$$ and $$x^{\sigma}$$ denote the same physical point on the manifold, expressed in different coordinates.

To answer the last question about the Ricci, yes, the contraction is understood to be performed at each point in spacetime. To re-iterate, in full detail you have :

$$R(x^\sigma)=R_{\mu\nu}(x^\sigma) g^{\mu\nu}(x^\sigma)$$

Then one might ask oneself : why then do we say that the Ricci scalar is invariant under change of coordinates ? It can't be, since it may depend on the coordinates. And this is somewhat true. If we apply the fully detailed change of coordinates formula, for the Ricci scalar (or any other scalar) we get :

$$R'(x'^{\sigma})=R(x^{\sigma})$$

and this is what we mean really when we say that a scalar tensor is "constant" under reparametrisation.

Let us take an easy example. Consider spherical coordinates $$(r,\theta,\phi)$$, and assume that the metric is such that the Ricci scalar is :

$$R = r \cos(\theta)$$

Now say we change to cartesian coordinates. If we apply the formula for scalars, we have that

$$R'(x,y,z)=R(r,\theta,\phi)=r\cos(\theta)$$

Now, on the LHS we want something that depends on $$(x,y,z)$$. That's when the formula for the change of coordinates kick in. We need to express $$r=r(x,y,z)$$, and $$\theta=\theta(x,y,z)$$. Luckily I conveniently chose the formula, and we can immediately see that $$r\cos(\theta)=z$$. Therefore :

$$R'(x,y,z)=z$$

Thus, the Ricci scalar expressed in both coordinates is $$R(r,\theta,\phi)=r\cos(\theta)$$ and $$R'(x,y,z)=z$$. Now we can see a bit better why we say they are "constant". Indeed, the "functions" R and R' are different, the first is $$R(a,b,c)=a\cos(b)$$ and the second $$R'(a,b,c)=c$$. However, they are the same thing once we connect the fact that, due to the change of coordinates, $$r\cos(\theta)=z$$.

Raising and lowering, as you said, depends on the metric and - therefore - is position-dependent, if the metric is variable. Examples include these: $$g^{μν} A_ν = A^μ, \\ g^{ντ} {R^μ}_{τρσ} = {R^{μν}}_{ρσ}.$$ On the other hand, contraction is always understood to apply to an index one raised and one lowered. If they were already that way, then there is no further raising or lowering involved, no metric and therefore no dependency on position. Examples: $$R_{νσ} = {R^{μ}}_{νμσ}, \\ R = R^ν_ν.$$ Contractions that involve raising or lowering first, however, are metric-dependent and - for variable metrics - position depndent, simply because of the raising and lowering done before-hand. Example: $$R = g^{μν} R_{μν}.$$

So, in the two examples involving $$R$$: $$R$$ is related to $$R^ν_ν$$ in a way that's independent of the metric and position, but $$R$$ is related to $$R_{μν}$$ in a way that's dependent on the metric and maybe also on the position.