7/27/2019 Clculo_Tensorial_com_o Maple
1/25
Classroom Tips and Techniques: Tensor Calculus with the Differential Geometry Package
Robert J. Lopez
Emeritus Professor of Mathematics and Maple FellowMaplesoft
Introduction
The Tensorsubpackage of theDifferentialGeometry package supplants the now-deprecated tensorpackage in Maple. The tensorpackage made essential use of the also-deprecated linalgpackage, soalthough worksheets that used these deprecated packages still work, it is imperative to move to usingthe new formalisms in the Tensorpackage.
This article is a "survivor's guide" for implementing tensor calculus in the new Tensorpackage. Itexplains the constructs in this package from the perspective of classical (i.e., indicial) tensor notation.
TheDifferentialGeometry package itself contains some 34 command but also six subpackages,themselves contributing to a total of some 184 commands. These subpackages, and a measure oftheir "size" are listed in Table 1.
Subpackage Number of Commands
Tensor 61
Tools 21
JetCalculus
GroupActions 9
Library 4
LieAlgebras 33
Table 1 Subpackages in theDifferentialGeometry package
The complexity of mastering theDifferentialGeometry package is further increased whensubpackages such as GroupActions themselves have subpackages (MovingFrames). Acomprehensive tutorial in the completeDifferentialGeometry package would require more than atextbook, so clearly, this is not our ambition here. Fortunately, the package itself contains two sets of
useful tutorials, a comprehensive collection ofLessons, and a set ofTutorials. TheLessons
worksheets provide a systematic approach to learning the commands in theDifferentialGeometry,Tensor,LieAlgebras andJetCalculus subpackages. Each lesson also contains a set of exercises thatrange in difficulty from simple computations to programming problems. Solutions are given. Thetutorials present specialized applications of theDifferentialGeometry package.
7/27/2019 Clculo_Tensorial_com_o Maple
2/25
Our more modest goal for this article is to show how to enter covariant and contravariant tensors,compute their covariant derivatives, obtain the equations of parallel transport and geodesics, andcompute the basic tensors of general relativity.
Initializations
Declaring the Frame inDifferentialGeometry
Before a vector or tensor can be entered, aframe must be declared by stating its variables and givingit a name. For example, to declare as the Cartesian space with variables and , execute
frame name: R2
The default behavior forDifferentialGeometry is that from this point onward, the prompt would bemodified to display the frame name for as long as that frame were the active one. Thus, without ourhaving suspended this default with the Preferences command in the Initializations section, the
prompt following the DGsetup command would be the one shown in Table 2.
R2 O
Table 2 The default modification of theprompt
We have elected to suspend this default behavior for three reasons. First, interactive editing of aworksheet can create a confusing display. If in a section where one frame name appears in allprompts, a new frame is defined, the subsequent prompts that show the earlier name do not change to
show the new name. Only a "new" prompt will display the new frame name. The result is aworksheet with prompts showing different frame names where they might not be relevant. Suchmisplaced prompts have to be deleted manually if they are not to provide incorrect information.
Second, these modified prompts are persistent - they cannot be removed by any Maple command.They have to be removed by deletion. (The Maple interface command that modifies prompts doesnot cascade the change through existing prompts. It only modifies new prompts.)
Finally, if the commands are executed in Document Blocks, and not at prompts, there will be novisible prompt to modify. Thus, the modified prompt is a worksheet paradigm that does not carry
7/27/2019 Clculo_Tensorial_com_o Maple
3/25
through all of Maple usage. For all these reasons, we will not have frame names visible in ourprompts.
The Contravariant/Covariant Paradigms
Anyone who had taken even a perfunctory dip into the waters of tensor calculus knows there are twowords, covariantand contravariant, that must be faced. We will not be able to enter a tensor in theTensorpackage without making the distinction between these two terms. Using the Einsteinsummation convention (repeated indices, one raised and one lowered, are summed), Table 3 definescontravariant and covariant vectors.
VectorType
Basis Type Transformation Law
Contravariant
Tangents to coordinate curves
Covariant Gradients (Normal to coordinatesurfaces)
Table 3 Contravariant and covariant vectors
In the rightmost column of Table 3 uses the notation and for components expressed in the -
coordinate system, but and for components in the -coordinate system. Texts also denote the
new coordinate system bu the use of an overbar on the component, or a prime on the left side of the
variable.
The components and are the contravariantand covariantcomponents, respectively, of the vector
V. The basis vectors and are reciprocal, so that . Thus, an orthonormal
basis is self-reciprocal. That is why the distinction between contravariant and covariant basis doesnot matter in Cartesian spaces.
If is the mapping from to via functions of the form , then the gradient vectors are
the rows of the Jacobian matrix , where the upper index is interpreted as a row index,
and the lower index , as a column index.
If is the mapping from to via functions of the form , then the tangent vectors are
the columns of the Jacobian matrix .
To facilitate the implementation of the contravariant transformation law, writing the components as
7/27/2019 Clculo_Tensorial_com_o Maple
4/25
a column vectorv means the sums with the Jacobian matrix are along a row and across the columnsof the matrix. Hence, the matrix product implements the contravariant transformation.
Writing the components as the row vectorw means the sums with the Jacobian matrix are down a
column but across the rows. Hence, the matrix product implements the covariant
transformation. This inherent distinction between tangent bases and normal bases induces thedistinction between contravariant and covariant. Using column and row vectors to express this
difference is a convenient visual device in classical tensor calculus.
The Tensor as a Multilinear Object
If is a vector space, say, with basis , then a rank-two tensor is a multilinear object
from , the direct product of with itself, having doubly-indexed basis objects . The
tensor is actually the object
linear in both indices. Of course, the are the contravariant components of the tensor; and just asfor vectors, there would be the equivalent covariant components, . There are even mixed tensors
that transform contravariantly in one index but covariantly in another.
In actual practice, one manipulates just the components of the tensor, and almost never explicitlyexhibits the basis objects. However, in theDifferentialGeometry package, vectors and tensors requirean explicit use of the basis objects.
Bases and Their Duals
The basis for could be entered as
or could be extracted from Maple with the DGinfo command from the Tools package.
(To type the underscore in math (2D) mode, press the escape character (\) first. Alternatively, entersuch expressions in text (linear, 1D) mode and convert to math mode via the Context Menu.)
The reciprocal (or dual) basis is then
7/27/2019 Clculo_Tensorial_com_o Maple
5/25
or
In actual fact, is considered a differential form, more in keeping with the modern approach todifferential geometry.
Representing Vectors asDifferentialGeometry Objects
In theDifferentialGeometry package, the contravariant vector whose components are
is given by
or by
The evalDG and the DGzip commands are two of the simpler ways to create an object whose datastructure is intrinsic to theDifferentialGeometry package. When using the evalDG command, the
asterisk is the explicit multiplication operator. If this vector had been entered in math mode, the echoof the asterisk would be a centered dot. The alternative to the asterisk would be the space.
The covariant vector whose components are is entered as
or as
There does not seem to be a simple way to represent a vector as a column or row vector. The Toolssubpackage provides the DGinfo command with which the components of a vector can be extracted.Its use is illustrated by
7/27/2019 Clculo_Tensorial_com_o Maple
6/25
or by
Representing Tensors asDifferentialGeometry Objects
A rank-two contravariant tensor would be entered as
The construct corresponds to the dyadic basis element , etc.
A rank-two covariant tensor would be entered as
The construct corresponds to the dyadic basis element , etc.
The components of a tensor can be recovered with the DGinfo command
or with the convert command.
The components of the rank-two tensor are often represented as the entries of a matrix. If a matrix isused for such a representation, it is possible to convert the matrix to aDifferentialGeometry tensor.
Contraction of Indices
Given two tensors of conformable dimensions, say and
7/27/2019 Clculo_Tensorial_com_o Maple
7/25
, forming the sum of products is
the operation contraction of indices. Recall that the Einstein summation convention indicates a sumon the same index when it appears once raised and once lowered. This operation, implemented in theTensorpackage with the command ContractIndices, is illustrated for the two tensors
from the previous section. To simplify data entry, we rename the first as T and the second, as V.
The four possible contractions that result in a rank-two tensor are given in Table 4, where their
components are displayed as elements of matrices.
Table 4 Four rank-two tensors formed by contraction of and
7/27/2019 Clculo_Tensorial_com_o Maple
8/25
Careful inspection of the four tensors in Table 4 (see especially the rightmost column) shows thatthey are all different.
The Metric Tensor
The geometry of a manifold is first captured in the covariant metric tensor or its
contravariant counterpart . There is no "calculus" in tensor calculus without first obtainingthis essential tensor. Hence, it is imperative that there be efficient ways to obtain this tensor. Severalof these techniques will be illustrated for the Cartesian plane on which polar coordinates have beenimposed.
Method 1 - Obtain as a Matrix and Convert to a Tensor
Define the map with equations of the form via
and the radius (position) vector via
Then, a representation of the basis vectors is given by
7/27/2019 Clculo_Tensorial_com_o Maple
9/25
so that a matrix whose entries are is
To convert this to the metric tensor in polar coordinates, we need to define the polar frame with
in which case we then have
The covariant form of this metric tensor, , can be obtained with
The matrix representing is the inverse of the matrix representing .
Method 2 - Transform the Cartesian Metric Tensor
Begin with the contravariant metric tensor on the Cartesian space :
Define the transformation from Cartesian to polar coordinates as
and use it to convert the Euclidean metric to
7/27/2019 Clculo_Tensorial_com_o Maple
10/25
Raising and Lowering Indices
The same vectorV can be given with respect to the natural tangent basis vectors or with respect to
the reciprocal basis of gradient basis vectors . Thus, one has . The conversion
between contravariant and covariant components ofV is effected by contraction with the metric
tensor:
or
Example 1
Given the contravariant vector
the covariant components are given by the RaiseLowerIndices command in the Tensorpackage.Thus, we have
where "g" denotes the covariant metric tensor . Alternatively, given the covariant vector
the contravariant components are
where " " denotes the contravariant metric tensor .
The Connection Coefficients
Once the metric tensor is known, the way the basis vectors change from point to point can bedetermined. It turns out that the rate of change of the basis vectors can be expressed as linear
7/27/2019 Clculo_Tensorial_com_o Maple
11/25
combinations of these same vectors. The coefficients of these linear combinations are called theconnection coefficients, or the Christoffel symbols. Depending on the form used for these symbols,they are called the Christoffel symbols of thefirst kindor thesecond kind. Since there is a built-incommand that provides the Christoffel symbols of the second kind, we will obtain those via
Classical texts in differential geometry use the notation , , or for Christoffel symbols
of the second kind, and or for Christoffel symbols of the first kind. Consequently, thecorrect interpretation of the output of the Christoffel command is captured, painstakingly andlaboriously, in Table 5.
Table 5 Christoffel symbols of thesecond kind for polar coordinates
The closest the Tensorpackage comes to articulating the Christoffel symbols is
where the list maps to . Thus, the middle index in the list is the raised one, and the first and
third are the lower ones.
Example 2
For polar coordinates, show that
Thus, show that the derivative of a basis vector can beexpressed as a linear combination of the basis vectors, and thatthe coefficients of these linear combinations are the Christoffelsymbols.
7/27/2019 Clculo_Tensorial_com_o Maple
12/25
To show that derivatives of basis vectors can be expressed as linear combinations of basis vectors,begin by expressing in terms of . This is done in Table 6 where the symbols i andj
are introduced explicitly and naming clashes are avoided by introducing the alternate namesfor .
Table 6 Expressing in terms of
Table 7, which lists the derivatives of the basis vectors, shows that the Christoffel symbols indeedare the coefficients in the linear combinations of basis vectors that express the derivatives of thebasis vectors.
= 0
=
=
=
Table 7 Differentiation of basis vectors in polarcoordinates
Table 8 provides a formula for computing Christoffel symbols of the second kind from thecomponents of the metric tensor.
Table 8 Christoffel symbols in terms of themetric tensor
7/27/2019 Clculo_Tensorial_com_o Maple
13/25
A practical notational shortcut is the use of for the differentiation operator . The formula in
Table 8 would be easier to write (and even remember) if this notational device is used.
The Covariant Derivative
In calculus, is the directional derivative of the scalar function taken in the direction of the
unit vectoru. The gradient vector arises naturally from the calculation of the derivative
which is how the directional derivative is defined when , , and .
Of course, this calculation extends to higher dimensions. But more important, note how starting witha scalar function , the vector quantity must be defined, and the desired directional derivative is adot product of this gradient vector with the direction vector.
The covariant derivative arises in much the same way, that is, from defining a directional derivativeof a vector. The new object that must be created is the covariant derivative, a rank-two tensor, andthe actual rate of change of the vector in a given direction is the "dot product" of this new tensor witha vector specifying the direction. In particular, Table 9 gives the expressions for the covariantderivative of contravariant and covariant vectors, a mixed tensor, and the metric tensor.
Contravariantvector
Covariant vector
Mixed tensor
Metric tensor
Table 9 Formulas for covariant derivatives
In polar coordinates, covariant derivatives of the contravariant and covariant vectors
7/27/2019 Clculo_Tensorial_com_o Maple
14/25
respectively, are obtained in the Tensorpackage with the CovariantDerivative command. It requiresas a second argument the connection coefficients, which can be given either as the Christoffelsymbols (of the second kind)
or as the connection
(In the Tensorpackage, the Christoffel symbols are not separated. The argument to the Connectioncommand is the same sum of terms that the Tensorpackage uses to express the Christoffel symbols.)
The covariant derivative of the contravariant vector is
more easily read as the array
The covariant derivative of the covariant vector is
7/27/2019 Clculo_Tensorial_com_o Maple
15/25
more easily read as the array
The Directional Covariant Derivative
The covariant derivative is the rank-two tensor that arises when the directional derivative of the
vector is defined. As such, it is the generalization of the gradient vector that arises when thedirectional derivative of the scalar function is defined. Just as the directional derivative of the scalar
function requires a dot product with a direction vector, so too does the directional derivative of the
vector. Thus, the directional derivative of the vector in the direction is given by , the
contraction of the covariant derivative with the direction vector.
This calculation is implemented in the Tensorpackage via the commandDirectionalCovariantDerivative.
Example 3
The derivative of the contravariant vector
in the direction of the vector
7/27/2019 Clculo_Tensorial_com_o Maple
16/25
is given by
If we write the covariant derivative as the array
and write the directional covariant derivative as the column vector
we can more easily see that the sum in is well modeled by the product of the matrix with
the direction vector.
Parallelism and Geodesics
The contravariant vector defined along , the curve, is said to be parallel along if
7/27/2019 Clculo_Tensorial_com_o Maple
17/25
the absolute (or intrinsic) derivative along vanishes.
Definition 1 Parallelism along a curve
The ParallelTransportEquations command in the Tensorpackage generates the equations impliedby Definition 1.
Example 4
In polar coordinates , let the curve be given by
The contravariant vector
is parallel along if the equations implied by
hold. To access the components of this vector and write the individual equations, use
where the extra syntax isolates the two equations in a unique order. Maple provides a solution forthese equations and the initial conditions .
7/27/2019 Clculo_Tensorial_com_o Maple
18/25
where again, we provide extra syntax for extracting and processing items uniquely. We are
looking for some evidence that along the curve the vector remains parallel. Since the
polar plane is coincident with the Cartesian plane, we will look for this evidence in Cartesiancoordinates.
We begin by writing the curve in radius (position) vector form:
Then, we form the vector and evaluate it along .
Figure 1 is a graph of along with vectors that have been transported parallel to the initial vector.Even without the graph it's clear from the algebraic expression for the field along that it'sconstant in the Euclidean sense, and hence, parallel.
7/27/2019 Clculo_Tensorial_com_o Maple
19/25
0 10 20
5
10
Figure 1 Parallel field along the curve
The contravariant vector represents a parallel vector fieldif its covariant derivative vanishes.
Definition 2 Parallel vector field
Example 5
The covariant derivative of the vector field
is, in array form,
7/27/2019 Clculo_Tensorial_com_o Maple
20/25
The vanishing of this covariant derivative requires solving a set of four partial differentialequations, the general solution of which is
For any initial direction of the vector as a vector in polar coordinates, the equivalent vector inCartesian coordinates is
Hence, we have a constant vector field, parallel in the Euclidean plane.
Let be arc length along , the curve defined by .If the unit tangent vector along is parallel along , then
is a geodesic. The condition that must satisfy is
Definition 3 Geodesics
Example 6
The equations for geodesic curves in polar coordinates are
7/27/2019 Clculo_Tensorial_com_o Maple
21/25
If we use the overdot to express differentiation with respect to , we can write these equations as
These equations are consistent with Definition 3, as we see by recalling the Christoffel symbols inTable 5. From Definition 3 we have
In the first equation, and the remaining Christoffel symbols are zero; in the second,
and the other Christoffel symbols are zero.
The general solution of the geodesic equations in polar coordinates is
The first solution is a radial line segment; the second, an arbitrary line segment - both in accordwith our expectations for geodesics in the plane.
Curvature
The commutator formula for covariant differentiation is
7/27/2019 Clculo_Tensorial_com_o Maple
22/25
where
and . The mixed rank-four tensorR is generally called the Riemann-Christoffel curvature
tensor of the second kind. Other names include curvature tensor, Riemann tensor, Riemann-Christoffel tensor, and mixed Riemann-Christoffel tensor. Moreover, variations in the formula itself
appear in the literature, especially when the repeated covariant differentiation is denoted by
or . There is an inherent reversal of the lexical order with respect to the operator order. When
the reversed lettering is translated to , a minus sign is introduced into the definition. The reader
is cautioned to be most careful when comparing Maple to the literature.
The Riemann-Christoffel curvature tensor of the first kind is defined as and is
sometimes called the covariant curvature tensor, and even the Riemann tensor. Again, great caremust be taken when reading and comparing different texts.
The Riemann curvature tensor (see how easily these phrases creep into one's writing?) measures thecurvature of a space. A space in which this tensor is zero is calledflat, and the Cartesian plane is flatno matter what coordinate system is imposed, as we see from
the curvature tensor for the plane under polar coordinates.
A more interesting surface is that of the unit sphere centered at the origin. The metric tensor for thissurface is obtained by the following calculations.
Consequently, the Riemann-Christoffel curvature tensor of the second kind is
7/27/2019 Clculo_Tensorial_com_o Maple
23/25
or better yet,
From this, we construct the explicit representation in Table 10.
Table 10 Nonzero components of for
the sphere
The Riemann-Christoffel curvature tensor of the first kind is
or better yet,
From this, we construct Table 11.
Table 11 Nonzero components of forthe sphere
Notice that for a space of dimension there is just one distinct component needed to describe the
complete tensor, and this component is generally taken as . In general, there are
distinct components of the Riemann curvature tensor of the first kind, so for there 6, but forthere are 20.
7/27/2019 Clculo_Tensorial_com_o Maple
24/25
In theDifferentialGeometry package, the Ricci tensor is defined as . Obtained by this
definition, the tensor is
Obtained with the RicciTensor command, this tensor is
We see that the tensor is the same under either computation.
The Ricci scalar, given by
2
is defined as , a definition we can test via
2
For a two-dimensional manifold the Gaussian (or total) curvature is given by , where is
the determinant of the array representing the metric tensor . Since for the sphere ,
can be computed in the Tensorpackage via
1
Finally, we note that is the Einstein tensor. For the sphere, this tensor is
so that it vanishes, as we can verify by inspection after obtaining via
7/27/2019 Clculo_Tensorial_com_o Maple
25/25
Since , and the array form of is the identity matrix, is the zero matrix.
Legal Notice: Maplesoft, a division of Waterloo Maple Inc. 2009. Maplesoft and Maple aretrademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable forany damages resulting from the use of this material. This application is intended for non-commercial,non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profitactivities.