In[1]:= MetricNames
Out[1]= {Euclidean, XX, {X1, X2, X3}}
In[2]:= Metric[Euclidean, XX]
Out[2]= dX1*.dX1 + dX2*.dX2 + dX3*.dX3
In[3]:= InputCoordinates[XX, 4]
Out[3]= {XX, {X1, X2, X3, X4}}
In[4]:= Metric[Euclidean, XX]
Out[4]= dX1*.dX1 + dX2*.dX2 + dX3*.dX3 + dX4*.dX4
We define the spherical coordinates In[5]:= InputCoordinates[sph, {r, th, ph}]; e = ZZ[sph];
In[6]:= InputMetric[euclidean, sph,
e[r, r] + r^2 e[th, th] + r^2 Sin[th]^2 e[ph, ph] ]
2 2 2
Out[6]= dr*.dr + r dth*.dth + r Sin[th] dph*.dph
In[7]:= MetricNames
Out[7]= {Euclidean, XX, {X1, X2, X3}}
{euclidean, sph, {r, th, ph}}
In[8]:= g = Metric[euclidean, sph]
2 2 2
Out[8]= dr*.dr + r dth*.dth + r Sin[th] dph*.dph
Given a 2-covariant metric tensor
![]()
its inverse is the 2-contravariant tensor
![]()
being
the inverse matrix
of
. InverseMetric
and MetricDet are the functions that compute the inverse metric
and the determinant of
.
In[9]:= InverseMetric[euclidean, sph] 2 Csc[th] -2 Out[9]= -------- Dph*.Dph + r Dth*.Dth + Dr*.Dr 2 r In[10]:= MetricDet[euclidean, sph] 4 2 Out[10]= r Sin[th]ScalarProduct computes the scalar product of two vectors or 1-forms and Unitary gives the normalized version of a vector or form. Next, we obtain the norm of the vector
In[11]:= ScalarProduct[euclidean][e[-3], e[-3]] 2 2 Out[11]= r Sin[th] In[12]:= Unitary[euclidean][e[-3]] // PowerExpand Csc[th] Out[12]= ------- Dph r
![]()
with tensor components
![]()
By using the volume element it is possible to define an isomorphism
relating the k-forms and the (n-k)-forms. This task is performed by the
Hodge star operator
, that
when acts upon the basis elements of the k-forms gives:
![]()
Then, if
is a k-form,
the components of
(viewed
as a tensor) are:
![]()
In physics, the result of applying the Hodge star operator to a tensor
is known as the dual of a tensor and their components are given by the
above expression.
The inverse operator is
The corresponding functions in TTC are VolumeForm,
Hodge
and InverseHodge. On the other hand TTC does not
assume any default sign for the signature of the metric. You can use InputMetricSign[g,b,1
(-1)] if you want to avoid TTC
ask for it
In[2]:= InputCoordinates[sph, {r, th, ph}]; e = ZZ[sph];:
In[3]:= g = e[1, 1] + r^2 e[2, 2] + r^2 Sin[th]^2 e[3, 3];
In[4]:= InputMetric[euclidean, sph, g];
In[5]:= w = r e[r] - r Sin[th] e[ph]
Out[5]= r dr - r Sin[th] dph
In[6]:= wH = Hodge[euclidean][w] // PowerExpand
Enter the sign of MetricDet[euclidean, sph],
Interrupt[ ] or Dialog[ ]: +1
3
Out[6]= -r dr*^dth + r Sin[th] dth*^dph
In[7]:= % // ExteriorToOuter
3
Out[7]= -r dr*.dth + r dth*.dr + r Sin[th] dth*.dph -
3
> r Sin[th] dph*.dth
In[8]:= VolumeForm[euclidean, sph] // PowerExpand
2
Out[8]= r Sin[th] dr*^dth*^dph
In[9]:= InverseHodge[euclidean][%] // PowerExpand
Out[9]= 1
![]()
and those of the second kind are obtained from the previous ones by
![]()
The function Christoffel can compute both of them.
Here, we declare the polar coordinates
in
the plane and the euclidean metric written in these coordinates and then
compute the second kind Christoffel symbol
In[2]:= InputCoordinates[polar, {r, phi}]; e = ZZ[polar];
In[3]:= g = e[1, 1] + r^2 e[2, 2];
In[4]:= InputMetric[euclidean, polar, g]
2
Out[4]= dr*.dr + r dphi*.dphi
In[5]:= Christoffel[euclidean, polar][1, -2, -2]
Out[5]= -r
We can also use the coordinate symbols with the corresponding signs instead
of the numerical indices in Christoffel. Next, we compute the
first kind Christoffel symbol
.
In fact the first time we use Christoffel over a metric/coordinates
the whole of Christoffel symbols are computed. See Functions
that stores the result. For this the time for the first call of Christoffel
can be very diferent than other calls
In[20]:= Christoffel[euclidean, polar][-r, -phi, -phi] Out[20]= -rShowChristoffel yields a list of all the basic connection coefficients. Those with zero value and those related by the index symmetry
In[21]:= ShowChristoffel[euclidean, polar] Out[21]= 1 K = -r 2 2 2 1 K = - 1 2 r
![]()
The covariant derivative receives different names in the bibliography as absolute derivative (Choquet pp.301) and gradient ( Misner pp.208). TTC implements this operator with AbsoluteD.
In an analogous way, the covariant derivative of the tensor T
of kind (p,q) in the direction of the vector u is another tensor
of kind (p,q) designated by
and
related
to by
![]()
that is to say,
![]()
The implementation of this operator is CovariantD.
Next, we take polar coordinates in the plane and compute the covariant
(or absolute) derivative of the vector
obtaining
as a result
and later the
covariant derivative of the vector
in
the direction of
obtaining
In[2]:= InputCoordinates[polar, {r, phi}]; e = ZZ[polar];
In[3]:= g = e[1, 1] + r^2 e[2, 2];
In[4]:= InputMetric[euclidean, polar, g]
In[5]:= AbsoluteD[euclidean][e[-1]]
1
Out[5]= - Dphi*.dphi
r
In[6]:= CovariantD[euclidean][e[-1]][ e[-1] + r e[-2] ]
Out[6]= 2 Dphi
![]()
Because of the symmetries it is usually better to work with the 4--covariant
tensor
. The corresponding
TTC
operator is Riemann.
From the Riemann tensor one can compute the Ricci tensor
with
Ricci
and the curvature scalar
with
Curvature.
Let's see an example of computing Riemann and related objects. We declare
the spherical coordinates {th, ph} with name sph2 and
the metric SPH for a 2-sphere of radius a and compute ,
,
and
R
In[2]:= InputCoordinates[sph2, {th, ph}]; e = ZZ[sph2];
In[3]:= InputMetric[SPH, sph2,
a^2 (e[1, 1] + Sin[th]^2 e[2, 2]) ];
In[4]:= Riemann[SPH, sph2]
2 2
Out[4]= a Sin[th] dth*.dph*.dth*.dph -
2 2
> a Sin[th] dth*.dph*.dph*.dth -
2 2
> a Sin[th] dph*.dth*.dth*.dph +
2 2
> a Sin[th] dph*.dth*.dph*.dth
In[5]:= Ricci[SPH, sph2]
2
Out[5]= dth*.dth + Sin[th] dph*.dph
In[6]:= Curvature[SPH, sph2]
2
Out[6]= --
2
a
![]()
The m tangent vectors in
are
.
When the dimension of S is m=n-1 then the normal form
n
can
be written ( not unitary)
![]()
If N is the dual unitary vector obtained from n, the second
fundamental form k is the 2--covariant tensor
with
components
![]()
The TTC functions used to compute these objects are TangentVector, NormalForm, FirstFundamentalForm and SecondFundamentalForm. The surface has to be declared using InputCoordinateChange.
Next, we define the surface of a torus in E3.
One has to declare the coordinates of both spaces and the map (u,v)
(x,y,z).
In[1]:= InputCoordinates[cart3, {x, y, z}];
In[2]:= InputCoordinates[param, {u, v}];
In[3]:= e = ZZ[cart3,];
In[4]:= InputMetric[Euclidean, cart3,
e[1, 1] + e[2, 2] + e[3, 3] ];
In[5]:= InputCoordinateChange[ cart3, param,
{ x -> (a + b Cos[u]) Cos[v],
y -> (a + b Cos[u]) Sin[v],
z -> b Sin[u] } ]
Out[5]= {x -> (a + b Cos[u]) Cos[v],
> y -> (a + b Cos[u]) Sin[v], z -> b Sin[u]}
We obtain the tangent vectors to the surface by using TangentVector.
The last argument indicates the number of the vector (which is negative since it is a subindex).
In[6]:= TangentVector[cart3, param][-1] Out[6]= b Cos[u] Dz - b Sin[u] Sin[v] Dy - b Cos[v] Sin[u] Dx In[7]:= TangentVector[cart3, param][-2] Out[7]= (a + b Cos[u]) Cos[v] Dy - (a + b Cos[u]) Sin[v] Dx In[8]:= n = NormalForm[Euclidean, cart3, param] Out[8]= -(b Cos[u] (a + b Cos[u]) Cos[v]) dx - > b Cos[u] (a + b Cos[u]) Sin[v] dy - > b (a + b Cos[u]) Sin[u] dzFinally, we compute the first and second fundamental forms of the torus.
In[39]:= FirstFundamentalForm[Euclidean, cart3, param] 2 2 Out[39]= b du*.du + (a + b Cos[u]) dv*.dv In[40]:= SecondFundamentalForm[Euclidean, cart3, param] // PowerExpand Enter the sign 1 or -1 of the modulus of the NormalForm[Euclidean, cart3, param], Interrupt[ ] or Dialog[ ]: 1 Out[40]= b du*.du + Cos[u] (a + b Cos[u]) dv*.dv
Through this process,
is
used in several places. To avoid this repeated use of InverseMetric,
TTC
stores the values it has found so that the computation is done efectively
only the first time it is called.
There are other functions like InverseMetric that store values they have found::
Christoffel JacobianMatrix Ricci Curvature MetricDet SecondFundamentalForm FirstFundamentalForm NormalForm StructureCoefficient InverseMetric Riemann VolumeForm
For more details about the way TTC stores things and the way you can benefit of it see Big calculus
This page is maintained by XavierJaén.