# Manipulations with tensors that keep so(3,1) symmetry manifest

I am doing some manipulations with tensors in curved background. There are, however, coordinates, where Lorentz symmetry is manifest. So, on one hand, I am dealing with particular coordinates and, on the other hand, I don't want to deal with tensors component by component, because there is Lorentz symmetry around that simplifies things.

For example, we have a vector field of the form $$A_\mu = a_{\mu}F(x^\nu x_\nu,x^\lambda b_\lambda)$$ where $$a_\mu$$ and $$b_\lambda$$ are constant covectors and $$x^\nu$$ is a coordinate and $$F$$ - some unknown function of scalar arguments. I would like to be able to evaluate efficiently expressions like $$D_\mu A_\nu$$ where the Christoffel symbols are also expressed in terms of $$x^\mu$$ and some constant parameters/Lorentz vectors (it would be nice to implement evaluation of the Christoffel symbols automatically, but anyway I already computed them). In computations, I would like Mathematica to do things like $$\partial_\mu F(x^2,bx)=\frac{\partial F}{\partial x^2}2x_\mu + \frac{\partial F}{\partial bx}b_\mu, \qquad \partial_\mu x^\nu =\delta^\nu_{\mu}$$ and so on and then to be able to contract indices. What is the best way to achieve that? I assume, I can use xCoba and introduce (co)vector fields for $$a$$, $$x$$ and $$b$$. But then Mathematica will not take into account, for example, that $$\partial_\mu a_\nu =0$$ unless I assign to $$a_\mu$$'s components some constant values $$a_1$$, $$a_2$$, $$a_3$$ and $$a_4$$. On the other hand, if I do assign some concrete values to the components, I am afraid, I will get $$a^\mu b_\mu$$ in the form $$a^1b_1+a^2b_2+a^3b_3+a^4b_4$$, which is a mess. Or, may be it is better to deal with Mathematica's built in tensor manipulations?

I looked through suggested similar questions and it seems that Cartesian tensor gradient will do the job with differentiation. Essentially, to the best of my understanding, I am supposed to teach Mathematica how derivatives act on each expression that one encounters. But then I will also need to contract indices, e.g. $$x^\mu\eta_{\mu\nu}\to x_\nu, \qquad x^\mu x^\mu \eta_{\mu\nu} \to x^2.$$ Should I also then teach Mathematica all contraction rules? How does it work in practice?

• There’s a Mathematica package called xAct that will help you with this. Try it out and let me know if it works for you. Oct 14 '18 at 20:44
• I am studying it right now. xCoba that I mentioned above is a part of xAct that allows to work in particular coordinates. But so far it seems that xAct allows to work either in a completely coordinate-independent manner, which would not let me substituting concrete expressions for tensor fields (because this breaks diffeos) or one can substitute expressions in particular coordinates using xCoba, but then I am lead to deal with components, which does not take into account simplifications arising from residual Lorentz symmetry. But I keep reading, may be I will find the right tool :) Oct 14 '18 at 21:49

For a situation like this, the best way to proceed in xAct is to use xTensor only:

<<xActxTensor
\$PrePrint = ScreenDollarIndices;


I use here Latin indices, but you can easily change all of this to use Greek indices:

DefManifold[M, 4, {a, b, c, d}]

DefMetric[-1, g[-a, -b], CD]

DefTensor[A[c], M]
DefTensor[B[c], M]
DefTensor[x[c], M]

DefScalarFunction[F]


Declare the differentiation properties of those objects:

x /: PD[a_][x[b_]] := delta[a, b]
A /: PD[a_][A[b_]] := 0
B /: PD[a_][B[b_]] := 0


Construct the scalars you need:

x2 = x[-a] x[a];
Bx = B[-a] x[a];


Now you can perform the operation you wanted, with the result you wanted:

PD[-a][F[x2, Bx]] // ContractMetric


This is how the result looks in output: • It works! Thanks a lot! Oct 15 '18 at 16:25