define a Physics tensor, its structure, and the (anti)symmetry of its indices under permutation - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Physics : Physics Package : Physics/Define

Physics[Define] - define a Physics tensor, its structure, and the (anti)symmetry of its indices under permutation

Calling Sequence

Define( )

Define(A, B, ..., options)

Define(A[mu,nu,rho,tau], symmetric = {{mu,nu}, {rho,tau}, ...}, antisymmetric = {{alpha,delta}, {gamma,beta}, ...}, options)


A, B, ...


functions or names, indexed or not, being defined as objects having tensorial properties in the frame of the Physics package. A can also be an equation, where the left-hand side is such a function or name with free indices and the right-hand side is a tensorial expression with the same free indices

symmetric = {{mu,nu}, ...}


(optional) specifies that the objects being defined are symmetric (don't change value) under the interchange of positions between the indices in each of the subsets indicated

antisymmetric = {{alpha,delta}, ...}


(optional) specifies that the objects being defined are antisymmetric under the interchange of positions between the indices in each of the subsets indicated



(optional) arguments given in any order; any of: symmetric, antisymmetric, query, clear, redo, and quiet



Define is used to define a name or a function as a tensor in the context of the Physics package. After this definition:


the display of contracted indices, one covariant and the other one contravariant;


a check of the number of indices against the number of indices in its definition;


differentiation and simplification of contracted indices in products using Einstein's summation convention for repeated indices;


simplification taking into account the symmetry properties that may have been indicated during the definition of the tensor;


will happen automatically or when using Simplify, diff and other differential operators of Physics, and will happen only for these names or functions defined using Define. In brief, the Physics package will compute using the rules of tensor algebra only with these objects.


The command Define() with no argument returns the tensors defined in that moment.


The typical use of Define, for instance to define a tensor, say A[mu] with one index, is as in Define(A) or Define(A[mu]), Define(A[mu](X)). The second and third manners also tell the system that A has only one index, otherwise the number of indices will be automatically derived and recorded the first time A appears in an expression handled by commands of Physics.


A different, also typical, situation happens when defining a tensor in terms of an arbitrary tensorial expression, say as in Fμ,ν=μAννAμ. For this purpose, as shown in the Examples section, use Define(A = tensorial expression), where the free indices of the left-hand side are expected to be the same as the free indices of the right-hand side, that can include, in addition, other repeated (contracted) indices. The right-hand side can also be a procedure that, when applied to the indices of the left-hand side, returns a tensorial expression with the same free indices, or just a Matrix or Array with the same dimension as the number of indices of the left-hand side (the tensor being defined).


When defining a tensor using a defining equation you can also pass to Define additional information indicating symmetry properties as explained in the Options section below related to the simpler definitions as in Define(A[mu]).


Defining tensors using tensorial equations has the following advantages, none of which exist when defining tensors the other ways:


the natural symmetry properties of the tensorial expression in the right-hand side, even when not indicated explicitly, will automatically be taken into account when A enters expressions, as it happens for all the tensors predefined in Physics


when A has numerical indices, covariant or contravariant (numbers prefixed with ~), it will automatically return the expression used in its definition with the values of these indices.


the keywords matrix, nonzero and others explained in g_ for the spacetime metric and other tensors predefined in Physics are all automatically keywords of the newly defined tensor A as well.


If you define an object already defined, Define performs a check for consistency between the previous and the given definitions, and interrupts with an error if there are inconsistencies. To clear previous definitions, use the optional argument clear; if given alone, it will clear all the previous definitions, otherwise it will clear only the definitions of the tensors specified. To clear and redefine a previously defined tensor (that is, define it ignoring previous definitions of it), use the optional argument redo, together with the new definition.


When the dimension of the spacetime is changed in the middle of a session, all definitions previously made by using Define are automatically cleared.



antisymmetric and symmetric


To define symmetry properties for some or all of the indices of an object being defined with the Define command, use the following guidelines:


To define the indices as totally symmetric or antisymmetric with respect to permutations, add the keyword symmetric or antisymmetric,respectively, to the calling sequence. For example, Define(A[mu, nu, rho, tau], symmetric), or just Define(A, symmetric).


If many objects are being defined at once with any of these two keywords, the symmetry properties are assumed to hold for all of them.


To define more detailed symmetry properties (for one Tensor at a time) use, for example, Define(A[mu, nu, rho, tau], symmetric = {{mu,nu}, {rho,tau}}),


so that: Amu,nu,rho,tau is symmetric with respect to permuting the indices mu,nu, and also permuting the indices rho,tau. In the same way, you can simultaneously define symmetric and antisymmetric properties of different kinds. For example, Define(A[mu,nu,rho,tau], symmetric = {mu,nu}, antisymmetric = {rho,tau}), so that for the commands in the Physics package, Amu,nu,rho,tau=Anu,mu,rho,tau =Anu,mu,tau,rho.




Clear previous definitions. If given with no additional information, clear removes all definitions in the current session.


If given with tensors  A,B,, clear removes the specified definitions.




Query about previous definitions in the current session. For example, Define(query), where query is any of query, history, indices, functionality, and structure.




Proceed without displaying messages on the screen.




To re-define an object that has already been defined, where the new definition is not the same as the old, use either the clear option and then define the object again, or do both in one go using the redo option.






When called with no arguments, Define returns a set of all tensors defined at the moment.


Defined as tensors



In the above, since no tensors have been defined yet, the output shows just those predefined in Physics: the differentiation tensor operator d_, the antisymmetric D-dimensional LeviCivita tensor, the KroneckerDelta, the spacetime metrics g_, the Pauli matrices, and the Dirac matrices.

The simplest way to define a tensor, say B, by passing B, Bmu or BmuX to Define, as in


Defined objects with tensor properties



Unlike passing Bmu or BmuX , when passing only B as in the above, nothing is known about the number of indices of B. To query about the structure of a defined tensor, use


Tensor structured as name,indices,variables:



where in this output, the second list explains the structure of the indices, meaning: "0 spacetime index, 0 spinor indices, and 0 gauge indices"; the third element in the output above tells the number of variables (arguments) on which B depends up to this point in the session.

The first time B enters a computation, the system performs a background check and derives the number of indices and functionality of B





Tensor structured as name,indices,variables:



After defining a tensor with Define, and only for these tensors, simplification and differentiation automatically takes into account Einstein's sum rule for repeated indices







To differentiate with respect to the covariant components, pass Bnu instead of Bν as differentiation variable. Define a system of coordinates for experimentation


Default differentiation variables for d_, D_ and dAlembertian are: X=x1,x2,x3,x4

Systems of spacetime Coordinates are: X=x1,x2,x3,x4



Define now a totally antisymmetric tensor, where the antisymmetry is implicit in the tensorial expression that defines the tensor. Use the PDEtools declare facility to avoid redundant display of functionality as in AmuX 


Fx1,x2,x3,x4will now be displayed asF

Ax1,x2,x3,x4will now be displayed asA






Defined objects with tensor properties



Note that the definition above simultaneously defines F and A (also, defining any of them or both in advance is not a problem). Because of defining Fmu,nu as a tensorial equation instead of passing just the left-hand side of (11), the natural symmetries of the expression in the right-hand side of (11) are from herein automatically taken into account when computing with Fmu,nu - each occurrence of it gets automatically normalized







These natural symmetry properties of the right-hand side of (11) are also used when simplifying expressions involving contracted products of F[mu,nu]. For example:







Defining Fmu,nu using an equation with a tensorial equation on the right-hand side, you can also see the components of F all at once, as with the other tensors of Physics




and to see the contravariant components, enter F with contravariant indices, prefixed by ~, as in F[~mu, ~nu, matrix].

To see all the nonzero components use




Note the display of derivatives indexed due to the use of declare lines above. You can always see what is behind of this compact display using show.

You can also see each covariant or contravariant or mixed components giving numerical values to the indices













The defining equation can also have a Matrix or Array in the right-hand side; for example:





Defined objects with tensor properties















When a tensor got defined indicating the indices, or after its first use with indices, the system knows the number of indices expected and will interrupt computations with an error message in case the tensor is found in expressions with a different number of indices. To reuse the name of the tensor with a different number of indices, use the redo option of Define (equivalent to using first the clear option, and then Define again). Define here A now as a tensor with four indices and some new symmetry properties


Defined objects with tensor properties




Tensor with symmetry properties defined as: A1,2,3,4, where antisymmetric=2,4,symmetric=1,3, and structured as name,indices,variables:




Used as indices in tensors:




Used as variables in tensor functions:




History of definitions of tensors:



See Also

Coordinates, d_, PDEtools[declare], Physics, Physics conventions, Physics examples, Setup

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam