the intrinsic
notation with exterior derivatives, the Hodge or star operator, etc.,
the use of index
notation in inputs
the coordinate
changes.
Let q be the point charge, K' a reference frame moving with it and K the refertence frame of the observer. We assume that K and K'coincides in the space at t=0 and that q moves along the z axis. The relation between the coordinates of a point in K and K'can be given by

being
and
with c=1. To translate this information into TTC, one has
to declare two coordinate systems, say lab K and moving
K' with coordinates {t, x, y, z}and {T, X, Y, Z}, respectively.
In[1]:= InputCoordinates[lab, {t, x, y, z}];
In[2]:= InputCoordinates[moving, {T, X, Y, Z}];
The relation between the coordinate systems moving and lab
is declared using InputCoordinateChange. We input the change that
performs the transformation moving In[3]:= gamma = 1/Sqrt[1-v^2];
In[4]:= InputCoordinateChange[moving, lab,
{ T -> gamma (t - v z),
Z -> gamma (z - v t),
X -> x,
Y -> y }];
The electromagnetic potentials can be joined as a single 1-form
![]()
and the electromagnetic tensor field can be defined through the 2-form

In K' the expression of A is
![]()
and from it we can compute the electromagnetic field F taking
the exterior derivative.
In TTC , dt' is entered as ZZ[moving][T]. To avoid
to write ZZ[moving] every time we can define first e
and then define A in the K' system, which we will call Amoving
In[5]:= e = ZZ[moving]; In[6]:= Amoving = - q/Sqrt[X^2 + Y^2 + Z^2] e[T] -q Out[6]= ------------------ dT 2 2 2 Sqrt[X + Y + Z ] In[7]:= Fmoving = ExteriorD[Amoving] q X q Y Out[7]= -(-----------------) dT*^dX - ----------------- dT*^dY - 2 2 2 3/2 2 2 2 3/2 (X + Y + Z ) (X + Y + Z ) q Z > ----------------- dT*^dZ 2 2 2 3/2 (X + Y + Z )The result obtained is the expected one
![]()
and
![]()
being
Next, we compute the electromagnetic field as seen by the observer simple changing F from K' to K. This process is performed in TTC with Change. We have called Flab the 2-form in K.
In[8]:= Flab = Change[moving, lab][Fmoving];
In[9]:= TensorComponent[Flab][-{t, x}]
q x
Out[9]= -(-----------------------------------------)
2
2 2 2 (-(t v) + z) 3/2
Sqrt[1 - v ] (x + y + -------------)
2
1 - v
In[10]:= TensorComponent[Flab][{-t, -z}] // Short
q t v
Out[10]//Short= ---------------------------------------- + <<2>> +
2
2 3/2 2 2 (-(t v) + z) 3/2
(1 - v ) (x + y + -------------)
2
1 - v
2
q v z
> <<2>> + ------
<<2>>
TensorComponent helps in reading the components of Flab.
The electric field in K is given by
![]()
with
The components of the magnetic field can also be read from Flab,
but it is better to obtain these components in cylindrical coordinates
with the z-axis as the polar axis. So, we define cyl coordinates
with symbols {t, r, phi, z} and perform the change lab
cyl.
In[11]:= InputCoordinates[cyl, {t, r, phi, z}]
Out[11]= {XX, {X1, X2, X3}}
{lab, {t, x, y, z}}
{moving, {T, X, Y, Z}}
{cyl, {t, r, phi, z}}
In[12]:= InputCoordinateChange[lab, cyl,
{ x -> r Cos[phi],
y -> r Sin[phi],
z -> z }]
Out[12]= {x -> r Cos[phi], y -> r Sin[phi], z -> z}
In[13]:= Fcyl = Change[lab, cyl][Flab];
In[14]:= TensorComponent[Fcyl][{-r, -z}] // Simplify
q r v
Out[14]= -(----------------------------------------------------)
2 2 2 2 2 2
2 -r + r v - t v + 2 t v z - z 3/2
Sqrt[1 - v ] (----------------------------------)
2
-1 + v
In[15]:= TensorComponent[Fcyl][-{r, phi}]
Out[15]= 0
In[16]:= TensorComponent[Fcyl][-{phi, z}]
Out[16]= 0
You can see that ![]()
being
the
Hodge operator. We can be check easily the first of equations computing
the exterior derivative of Flab.
In[17]:= ExteriorD[Flab] // TensorSimplify[{Simplify}]
Out[17]= 0
In order to verify the second equation, we need to declare the flat space-time
metric. This can be done with InputMetric.
In[18]:= u = ZZ[lab] Out[18]= ZZ[lab] In[19]:= g = - u[t, t] + u[x, x] + u[y, y] + u[z, z] Out[19]= -dt*.dt + dx*.dx + dy*.dy + dz*.dz In[20]:= InputMetric[mink, lab, g] Out[20]= -dt*.dt + dx*.dx + dy*.dy + dz*.dz In[21]:= InputMetricSign[mink, lab, -1];Now, taking J=0, we can check the second Maxwell equation as
In[22]:= ExteriorD[Hodge[mink][Flab]] // TensorSimplify[{Simplify}]
Out[22]= 0
Until now we have used intrinsic notation. However there are situations
where the index notation is a more powerful language. A simple example
can be the expression of the stress-energy tensor in terms of F.
![]()
In this equation
is
understood as a tensor (not a form). To transform forms into tensor we
can use ExteriorToOuter. Afterwards, we compute
using
the TTC index notation, which is very close to the handwritten
notation.
In[23]:= F = ExteriorToOuter[Flab] // TensorSimplify[{Simplify}];
In[24]:= StressEnergy = ( F[-i, -k] F[-j, k] - 1/4 \
F[-k, -l] F[k, l] g[-i, -j] )/(4 Pi) // Index[mink];
From this you can select individual components. For example the energy
density is In[25]:= TensorComponent[StressEnergy][-t, -t] // Simplify 2 2 2 2 2 2 2 2 2 2 2 2 q (-1 + v ) (t v + x + v x + y + v y - 2 t v z + z ) Out[25]= -------------------------------------------------------------- 2 2 2 2 2 2 2 2 2 3 8 Pi (t v + x - v x + y - v y - 2 t v z + z )
![]()
being
![]()
To translate this into TTC we first declare the coordinates null and the metric vaidya in these coordinates. We fix the simplification level and the internal implification rules.The following commands are self-explanatories.
In[2]:= InputCoordinates[null, {u, r, th, ph}]
General::spell1:
Possible spelling error: new symbol name "null"
is similar to existing symbol "Null".
Out[2]= {XX, {X1, X2, X3}}
{null, {u, r, th, ph}}
In[3]:= e = ZZ[null];
In[4]:= g = (1 - 2 M[u]/r) e[u, u] + e[u, r] + e[r, u] -
r^2 e[th, th] - r^2 Sin[th]^2 e[ph, ph];
In[5]:= InputMetric[vaidya, null, g]
2 M[u] 2
Out[5]= (1 - ------) du*.du + du*.dr + dr*.du - r dth*.dth -
r
2 2
> r Sin[th] dph*.dph
In[6]:= InputSimplifyLevel[4];
In[7]:= InputTTCSimplify[{Expand, Factor};
Mathematica prints a warning because our symbol null is
similar to their built-in object Null. As you can see, the output
for tensors expanded in the natural basis are very close to the handwritten
notation. The inverse metric In[8]:= G = InverseMetric[vaidya, null]; 2 Csc[th] -2 -r + 2 M[u] Out[8]= -(--------) Dph*.Dph - r Dth*.Dth + ----------- Dr*.Dr + 2 r r > Dr*.Du + Du*.Dr In[9]:= ShowChristoffel[vaidya, null] Non null Christoffel symbols K: 1 M[u] K = -(----) 1 1 2 r 1 K = r 3 3 1 2 K = r Sin[th] 4 4 2 2 2 r M[u] - 2 M[u] - r M'[u] K = --------------------------- 1 1 3 r 2 M[u] K = ---- 1 2 2 r 2 K = -r + 2 M[u] 3 3 2 2 K = (-r + 2 M[u]) Sin[th] 4 4 3 1 K = - 2 3 r 3 K = -(Cos[th] Sin[th]) 4 4 4 1 K = - 2 4 r 4 K = Cot[th] 3 4The stress-energy pseudotensor of Landau and Lifshitz has the following expression

In the TTC index notation only tensorial objects can be
included and so in TTC we have defined a pseudotensor
object: ChristoffelTensor, which we have used in the definition
of
Translated into TTC language this can be written in a file, say vaidya01.dat,
K = ChristoffelTensor[vaidya, null]; tLL := 1/(16 Pi)( (G[i, l] G[k, m] - G[i, k] G[l, m]) * (2 K[n, -l, -m] K[p, -n, -p] - K[n, -l, -p] K[p, -m, -n] - K[n, -l, -n] K[p, -m, -p]) + G[i, l] G[m, n] * (K[k, -l, -p] K[p, -m, -n] + K[k, -m, -n] K[p, -l, -p] - K[k, -n, -p] K[p, -l, -m] - K[k, -l, -m] K[p, -n, -p]) + G[k, l] G[m, n] * (K[i, -l, -p] K[p, -m, -n] + K[i, -m, -n] K[p, -l, -p] - K[i, -n, -p] K[p, -l, -m] - K[i, -l, -m] K[p, -n, -p]) + G[l, m] G[n, p] * (K[i, -l, -n] K[k, -m, -p] - K[i, -l, -m] K[k, -n, -p]) ) // Index[vaidya]
and loaded in a TTC session with TTCGet. Then, you can compute the stress-energy pseudotensor giving the command tLL to TTC.
In[10]:= TTCGet[path/vaidya01.dat] In[11]:= tLL // Short 2 Csc[th] Out[11]//Short= -------- Dph*.Dph + <<9>> 4 8 Pi rThe output has been shorted, but you can see that
![]()
The Weyl tensor can be defined in terms of the Riemann tensor as
![]()
To obtain the Weyl tensor, it is convenient to begin computing the full covariant Riemann tensor with Riemann, the Ricci tensor with Ricci and the curvature escalar with Curvature.
In[12]:= Riemann[vaidya, null] // Short 2 M[u] Out[12]//Short= ------ du*.dr*.du*.dr + <<30>> + 3 r 2 Sin[th] <<1>> > -------------<<2>> 2 r In[13]:= Ricci[vaidya, null] -2 M'[u] Out[13]= -------- du*.du 2 r In[14]:= Curvature[vaidya, null] Out[14]= 0The definition of Weyl can be written in a file, say vaidya02.dat
delta = IdentityTensor[null, 1, -1] Rim = Riemann[vaidya, null] Ric = Ricci[vaidya, null] Cur = Curvature[vaidya, null] Weyl := Rim[i, j, -k, -l] - 2 delta[.<<i, .<<-k] Ric[j>>., -l>>.] + (1/3) delta[.<<i, -k>>.] * delta[.<<j, -l>>.] Cur // Index[vaidya]
and afterwards loaded and computed. Again we have minimized the output. If you want the complete expression of the Weyl tensor the postfix //Short command have to be omitted.
In[15]:= TTCGet[path/weyl.m] In[16]:= Weyl // Short 2 M[u] Out[16]//Short= ------ Dph*.Dth*.dth*.dph + <<22>> + 3 r 2 M[u] > ------ <<2>> 3 rThe vaidya metric can also be analyzed using the null tetrad

We define the new noncoordinate basis and give their relation with the old coordinate basis. This is performed with InputBasis and InputBasisChange respectively.
In[17]:= InputBasis[{null, nt}];
In[18]:= n = ZZ[{null, nt}];
In[19]:= InputBasisChange[{null, nt}, null,
{n[1] -> v[1],
n[2] -> (1/2 - M[u]/r) v[1] + v[2],
n[3] -> -r/Sqrt[2] (v[3] + I Sin[th] v[4]),
n[4] -> -r/Sqrt[2] (v[3] - I Sin[th] v[4])}];
The correctness of the basis change can be checked with BasisVectorChange
and
BasisFormChange.
In[20]:= BasisFormChange[null, {null, nt}] // ColumnForm
Out[20]= du -> nt[1]
-r + 2 M[u]
dr -> ----------- nt[1] + nt[2]
2 r
1 1
dth -> -(---------) nt[3] - --------- nt[4]
Sqrt[2] r Sqrt[2] r
I Csc[th] I Csc[th]
dph -> --------- nt[3] - --------- nt[4]
Sqrt[2] r Sqrt[2] r
In[21]:= BasisVectorChange[null, {null, nt}] // ColumnForm
r - 2 M[u]
Out[21]= Du -> ---------- nt[-2] + nt[-1]
2 r
Dr -> nt[-2]
r r
Dth -> -(-------) nt[-4] - ------- nt[-3]
Sqrt[2] Sqrt[2]
I r Sin[th] I r Sin[th]
Dph -> ----------- nt[-4] - ----------- nt[-3]
Sqrt[2] Sqrt[2]
You can obtain the structure coefficients of the noncoordinate basis with
StructureCoefficient.
The whole set of coefficients can be viewed using ShowStructureCoefficient.
In[22]:= ShowStructureCoefficient[{null, nt}]
Non null structure coefficients:
2 M[u]
c = ----
1 2 2
r
3 r - 2 M[u]
c = ----------
1 3 2
2 r
3 1
c = -(-)
2 3 r
3 Cot[th]
c = -(---------)
3 4 Sqrt[2] r
4 r - 2 M[u]
c = ----------
1 4 2
2 r
4 1
c = -(-)
2 4 r
4 Cot[th]
c = ---------
3 4 Sqrt[2] r
The metric tensor in terms of the null tetrad is easily obtained performing
a basis change in g.
In[23]:= newg = Change[null, {null, nt}][g]
Out[23]= nt[1]*.nt[2] + nt[2]*.nt[1] - nt[3]*.nt[4] - nt[4]*.nt[3]
In[24]:= InputMetric[vaidya, {null, nt}, newg];
In[25]:= TensorToMatrix[newg] // MatrixForm
Out[25]//MatrixForm= 0 1 0 0
1 0 0 0
0 0 0 -1
0 0 -1 0
You can obtain the spin coefficients using again the index notation. In
these examples we have computed

In[26]:= mu = - n[2][-i,.;-j] n[4][i] n[3][j] // Index[vaidya] -r + 2 M[u] Out[26]= ----------- 2 2 r In[27]:= rho = n[1][-i,.;-j] n[3][i] n[4][j] // Index[vaidya] 1 Out[27]= -(-) r In[28]:= gamma = (1/2)( n[1][-i,.;-j] n[2][i] n[2][j] - n[3][-i,.;-j] n[4][i] n[2][j])// Index[vaidya] M[u] Out[28]= ---- 2 2 r
This page is maintained by XavierJaén.