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

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[$\mathrm{\mu },\mathrm{\nu },\mathrm{\rho },\mathrm{\tau }$], symmetric = {{$\mathrm{\mu },\mathrm{\nu }$}, {$\mathrm{\rho },\mathrm{\tau }$}, ...}, antisymmetric = {{$\mathrm{\alpha },\mathrm{\delta }$}, {$\mathrm{\gamma },\mathrm{\beta }$}, ...}, options)

Parameters

 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 = {{$\mathrm{\mu },\mathrm{\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 = {{$\mathrm{\alpha },\mathrm{\delta }$}, ...} - (optional) specifies that the objects being defined are antisymmetric under the interchange of positions between the indices in each of the subsets indicated options - (optional) arguments given in any order; any of: symmetric, antisymmetric, query, clear, redo, and quiet

Description

 • 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}_{}^{\mathrm{\mu },\mathrm{\nu }}={\partial }_{}^{\mathrm{\mu }}\left({A}_{}^{\mathrm{\nu }}\right)-{\partial }_{}^{\mathrm{\nu }}\left({A}_{}^{\mathrm{\mu }}\right)$. 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.

Options

 • 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: ${A}_{\mathrm{\mu },\mathrm{\nu },\mathrm{\rho },\mathrm{\tau }}$ is symmetric with respect to permuting the indices $\left\{\mathrm{\mu },\mathrm{\nu }\right\}$, and also permuting the indices $\left\{\mathrm{\rho },\mathrm{\tau }\right\}$. 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, ${A}_{\mathrm{\mu },\mathrm{\nu },\mathrm{\rho },\mathrm{\tau }}={A}_{\mathrm{\nu },\mathrm{\mu },\mathrm{\rho },\mathrm{\tau }}$ $=-{A}_{\mathrm{\nu },\mathrm{\mu },\mathrm{\tau },\mathrm{\rho }}$.
 • clear
 Clear previous definitions. If given with no additional information, clear removes all definitions in the current session.
 If given with tensors  $A,B,\dots$, clear removes the specified definitions.
 • query
 Query about previous definitions in the current session. For example, Define(query), where query is any of query, history, indices, functionality, and structure.
 • quiet
 Proceed without displaying messages on the screen.
 • redo
 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.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

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

 > $\mathrm{Define}\left(\right)$
 $\mathrm{Defined as tensors}$
 $\left\{{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (2)

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 spacetime metrics g_, the Pauli matrices, and the Dirac matrices.

The simplest way to define a tensor, say $B$, by passing $B$, ${B}_{\mathrm{\mu }}$ or ${B}_{\mathrm{\mu }}\left(X\right)$ to Define, as in

 > $\mathrm{Define}\left(B\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{B}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (3)

Unlike passing ${B}_{\mathrm{\mu }}$ or ${B}_{\mathrm{\mu }}\left(X\right)$ , 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

 > $\mathrm{Define}\left(B,\mathrm{query}\right)$
 $\mathrm{Tensor structured as}\left[\mathrm{name}{,}\mathrm{indices}{,}\mathrm{variables}\right]:$
 $\left[{B}{,}\left[{0}{,}{0}{,}{0}\right]{,}{0}\right]$ (4)

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$

 > ${\mathrm{LeviCivita}}_{\mathrm{α},\mathrm{β},\mathrm{μ},\mathrm{ν}}{B}_{\mathrm{μ}}{B}_{\mathrm{ν}}$
 ${{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{B}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{}{{B}}_{\phantom{{}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\nu }}}$ (5)
 > $\mathrm{Define}\left(B,\mathrm{query}\right)$
 $\mathrm{Tensor structured as}\left[\mathrm{name}{,}\mathrm{indices}{,}\mathrm{variables}\right]:$
 $\left[{B}{,}\left[{0}{,}{0}{,}{0}\right]{,}{0}\right]$ (6)

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

 > $\mathrm{Simplify}\left(\right)$
 ${0}$ (7)
 > $\frac{\partial }{\partial {B}_{\mathrm{~nu}}}{B}_{\mathrm{μ}}$
 ${{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}$ (8)

To differentiate with respect to the covariant components, pass ${B}_{\mathrm{\nu }}$ instead of ${B}_{}^{\mathrm{\nu }}$ as differentiation variable. Define a system of coordinates for experimentation

 > $\mathrm{Coordinates}\left(X\right)$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right)\right\}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right)\right\}$
 $\left\{{X}\right\}$ (9)

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 ${A}_{\mathrm{\mu }}\left(X\right)$

 > $\mathrm{PDEtools}:-\mathrm{declare}\left(F\left(X\right),A\left(X\right)\right)$
 ${F}{}\left({X}\right){}{\mathrm{will now be displayed as}}{}{F}$
 ${A}{}\left({X}\right){}{\mathrm{will now be displayed as}}{}{A}$ (10)
 > ${F}_{\mathrm{μ},\mathrm{ν}}={\mathrm{d_}}_{\mathrm{μ}}\left({A}_{\mathrm{ν}}\left(X\right)\right)-{\mathrm{d_}}_{\mathrm{ν}}\left({A}_{\mathrm{μ}}\left(X\right)\right)$
 ${{F}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}{{\mathrm{d_}}}_{{\mathrm{μ}}}{}\left({{A}}_{{\mathrm{ν}}}{}\left({X}\right){,}\left[{X}\right]\right){-}{{\mathrm{d_}}}_{{\mathrm{ν}}}{}\left({{A}}_{{\mathrm{μ}}}{}\left({X}\right){,}\left[{X}\right]\right)$ (11)
 > $\mathrm{Define}\left(\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{{A}}_{{\mathrm{\mu }}}{,}{{B}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (12)

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 ${F}_{\mathrm{\mu },\mathrm{\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 ${F}_{\mathrm{\mu },\mathrm{\nu }}$ - each occurrence of it gets automatically normalized

 > ${F}_{\mathrm{ν},\mathrm{μ}}$
 ${-}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}$ (13)
 > ${F}_{\mathrm{μ},\mathrm{ν}}+{F}_{\mathrm{ν},\mathrm{μ}}$
 ${0}$ (14)

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:

 > ${A}_{\mathrm{μ}}{A}_{\mathrm{ν}}{F}_{\mathrm{μ},\mathrm{ν}}$
 ${{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{A}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{}{{A}}_{\phantom{{}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\nu }}}$ (15)
 > $\mathrm{Simplify}\left(\right)$
 ${0}$ (16)

Defining ${F}_{\mathrm{\mu },\mathrm{\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

 > ${F}_{[]}$
 ${{F}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}0& \frac{\partial }{\partial \mathrm{x1}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x2}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x1}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x3}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x1}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x4}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)\\ \frac{\partial }{\partial \mathrm{x2}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x1}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& 0& \frac{\partial }{\partial \mathrm{x2}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x3}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x2}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x4}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)\\ \frac{\partial }{\partial \mathrm{x3}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x1}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x3}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x2}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& 0& \frac{\partial }{\partial \mathrm{x3}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x4}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)\\ \frac{\partial }{\partial \mathrm{x4}}{}{A}_{1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x1}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x4}}{}{A}_{2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x2}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& \frac{\partial }{\partial \mathrm{x4}}{}{A}_{3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)-\left(\frac{\partial }{\partial \mathrm{x3}}{}{A}_{4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right)& 0\end{array}\right]\right)$ (17)

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

 > ${F}_{\mathrm{nonzero}}$
 ${{F}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left\{\left({1}{,}{2}\right){=}{\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x1}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x2}}\right)\right){,}\left({1}{,}{3}\right){=}{\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x1}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x3}}\right)\right){,}\left({1}{,}{4}\right){=}{\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x1}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x4}}\right)\right){,}\left({2}{,}{1}\right){=}{\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x2}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x1}}\right)\right){,}\left({2}{,}{3}\right){=}{\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x2}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x3}}\right)\right){,}\left({2}{,}{4}\right){=}{\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x2}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x4}}\right)\right){,}\left({3}{,}{1}\right){=}{\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x3}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x1}}\right)\right){,}\left({3}{,}{2}\right){=}{\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x3}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x2}}\right)\right){,}\left({3}{,}{4}\right){=}{\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x3}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x4}}\right)\right){,}\left({4}{,}{1}\right){=}{\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x4}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x1}}\right)\right){,}\left({4}{,}{2}\right){=}{\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x4}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x2}}\right)\right){,}\left({4}{,}{3}\right){=}{\mathrm{diff}}{}\left({{A}}_{{3}}{}\left({X}\right){,}{\mathrm{x4}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{4}}{}\left({X}\right){,}{\mathrm{x3}}\right)\right)\right\}$ (18)

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

 > ${F}_{1,1}$
 ${0}$ (19)
 > ${F}_{1,2}$
 ${\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x1}}\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x2}}\right)\right)$ (20)
 > ${F}_{1,\mathrm{~2}}$
 ${\mathrm{diff}}{}\left({{A}}_{{\mathrm{~2}}}{}\left({X}\right){,}{\mathrm{x1}}\right){+}{\mathrm{diff}}{}\left({{A}}_{{1}}{}\left({X}\right){,}{\mathrm{x2}}\right)$ (21)
 > ${F}_{\mathrm{~1},2}$
 ${-}\left({\mathrm{diff}}{}\left({{A}}_{{2}}{}\left({X}\right){,}{\mathrm{x1}}\right)\right){-}\left({\mathrm{diff}}{}\left({{A}}_{{\mathrm{~1}}}{}\left({X}\right){,}{\mathrm{x2}}\right)\right)$ (22)

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

 > ${F}_{\mathrm{~mu},\mathrm{~nu}}=\mathrm{Matrix}\left(4,4,\left\{\left(1,2\right)=\mathit{E__1},\left(1,3\right)=\mathit{E__2},\left(1,4\right)=\mathit{E__3},\left(3,4\right)=\mathit{H__1},\left(2,4\right)=-\mathit{H__2},\left(2,3\right)=\mathit{H__3}\right\},\mathrm{shape}=\mathrm{antisymmetric}\right)$
 ${{F}}_{{\mathrm{~mu}}{,}{\mathrm{~nu}}}{=}\left(\left[\begin{array}{cccc}0& \mathit{E__1}& \mathit{E__2}& \mathit{E__3}\\ -\mathit{E__1}& 0& \mathit{H__3}& -\mathit{H__2}\\ -\mathit{E__2}& -\mathit{H__3}& 0& \mathit{H__1}\\ -\mathit{E__3}& \mathit{H__2}& -\mathit{H__1}& 0\end{array}\right]\right)$ (23)
 > $\mathrm{Define}\left(\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{{A}}_{{\mathrm{\mu }}}{,}{{B}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (24)
 > ${F}_{1,2}$
 $\mathrm{E__1}$ (25)
 > ${F}_{\mathrm{~1},2}$
 ${-}\mathrm{E__1}$ (26)
 > ${F}_{\mathrm{μ},\mathrm{ν},\mathrm{matrix}}$
 ${{F}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}0& \mathit{E__1}& \mathit{E__2}& -\mathit{E__3}\\ -\mathit{E__1}& 0& \mathit{H__3}& \mathit{H__2}\\ -\mathit{E__2}& -\mathit{H__3}& 0& -\mathit{H__1}\\ \mathit{E__3}& -\mathit{H__2}& \mathit{H__1}& 0\end{array}\right]\right)$ (27)
 > ${F}_{\mathrm{~mu},\mathrm{ν},\mathrm{matrix}}$
 ${{F}}_{{\mathrm{~mu}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}0& -\mathit{E__1}& -\mathit{E__2}& \mathit{E__3}\\ \mathit{E__1}& 0& -\mathit{H__3}& -\mathit{H__2}\\ \mathit{E__2}& \mathit{H__3}& 0& \mathit{H__1}\\ \mathit{E__3}& -\mathit{H__2}& \mathit{H__1}& 0\end{array}\right]\right)$ (28)

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

 > $\mathrm{Define}\left(\mathrm{redo},{A}_{\mathrm{μ},\mathrm{ν},\mathrm{ρ},\mathrm{σ}}\left(x,y,z\right),\mathrm{symmetric}=\left\{\mathrm{μ},\mathrm{ρ}\right\},\mathrm{antisymmetric}=\left\{\mathrm{ν},\mathrm{σ}\right\}\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{{A}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\rho }}{,}{\mathrm{\sigma }}}{,}{{B}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (29)
 > $\mathrm{Define}\left(A,\mathrm{query}\right)$
 $\mathrm{Tensor with symmetry properties defined as:}{A}_{1,2,3,4}\mathrm{, where}\left\{\mathrm{antisymmetric}=\left\{\left[2{,}4\right]\right\}{,}\mathrm{symmetric}=\left\{\left[1{,}3\right]\right\}\right\}\mathrm{, and structured as}\left[\mathrm{name}{,}\mathrm{indices}{,}\mathrm{variables}\right]:$
 $\left[{A}{,}\left[{4}{,}{0}{,}{0}\right]{,}{3}\right]$ (30)
 > $\mathrm{Define}\left(\mathrm{indices}\right)$
 $\mathrm{Used as indices in tensors:}$
 $\left\{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\rho }}{,}{\mathrm{\sigma }}\right\}$ (31)
 > $\mathrm{Define}\left(\mathrm{functionality}\right)$
 $\mathrm{Used as variables in tensor functions:}$
 $\left\{{x}{,}{\mathrm{x1}}{,}{\mathrm{x2}}{,}{\mathrm{x3}}{,}{\mathrm{x4}}{,}{y}{,}{z}\right\}$ (32)
 > $\mathrm{Define}\left(\mathrm{history}\right)$
 $\mathrm{History of definitions of tensors:}$
 $\left\{{B}{,}{{A}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\rho }}{,}{\mathrm{\sigma }}}{,}{{B}}_{{\mathrm{\mu }}}{,}{{B}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}{,}{{B}}_{\phantom{{}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\nu }}}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{F}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{B}}_{{\mathrm{\mu }}}{,}{{B}}_{{\mathrm{\nu }}}{,}{{F}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (33)
 >