 Check - Maple Help

Physics[Check] - check the occurrence of more than one noncommutative or anticommutative object in commutative products and the correctness of the free and repeated spacetime indices in a mathematical expression Calling Sequence Check(expression, indices = truefalse, kind_of_indices, products = truefalse, quiet) Parameters

 expression - any mathematical expression or relation between expressions indices = truefalse - (optional) boolean value indicating whether to check the free and repeated indices in expression for correctness (default value is true) kind_of_indices - (optional) one of the keywords free, repeated, or all; return a list or set with the specified kind of indices found products = truefalse - (optional) boolean value indicating whether to check commutative products regarding incorrect presence of anti or noncommutative objects (default value is true) quiet - (optional) indicates that the check should proceed without displaying messages on the screen Description

 • The Check command receives a mathematical expression or a relation between expressions (such as an equation) and checks for incorrect free or repeated spacetime indices or ill-formed commutative products involving noncommutative or anticommutative objects.
 NOTE: when the tensorial indices of a relation are being checked and the left-hand side or right-hand side is equal to 0, the relation is first transformed into the left-hand minus right-hand sides, then processed, and the output is returned accordingly, not as a relation - see the Examples section.
 • When checking the repeated and free indices of tensor objects (see Physics,Define), Check takes into account the sum rule for repeated indices. That is, it gives an error when the same index appears more than once in a product, or when the free indices of the summands of a given expression or that of the sides of a relation (for example, of an equation), are not the same.
 • If only the expression to be checked is given, Check makes the check of the indices mentioned and either returns NULL, displaying the message The repeated and free indices in the given expression check ok., or interrupts with an error pointing to the problem detected.
 • To avoid this checking of indices, use the optional argument indices = false.
 • When any of the optional keywords free, repeated, or all are given, instead of NULL, Check returns all, the free, or the repeated indices per term, respectively, as explained in the following examples.
 • When the Physics package is loaded, a more general * product operator is also loaded. Unlike the default Maple product operator (herein called the commutative product operator), the operator loaded with Physics does not assume commutativity of its operands, and instead operates like a commutative, anticommutative, or noncommutative product operator, depending on the operands. However, after loading Physics, the original commutative product operator is still available as :-*, and can be invoked as a function.
 • Regarding commutative products constructed by :-*, Check scans the received expression for incorrect occurrences with more than one noncommutative or anticommutative operand.
 • If the expression checks okay, a related message is displayed. Otherwise, an error message is triggered, and the commutative product involving not commutative objects is pointed out.
 • To avoid this checking of products, use the optional argument products = false. Examples Check free and repeated indices found in tensor expressions

 > $\mathrm{with}\left(\mathrm{Physics}\right)$
 $\left[{\mathrm{*}}{,}{\mathrm{.}}{,}{\mathrm{Annihilation}}{,}{\mathrm{AntiCommutator}}{,}{\mathrm{Antisymmetrize}}{,}{\mathrm{Assume}}{,}{\mathrm{Bra}}{,}{\mathrm{Bracket}}{,}{\mathrm{Check}}{,}{\mathrm{Christoffel}}{,}{\mathrm{Coefficients}}{,}{\mathrm{Commutator}}{,}{\mathrm{CompactDisplay}}{,}{\mathrm{Coordinates}}{,}{\mathrm{Creation}}{,}{\mathrm{D_}}{,}{\mathrm{Dagger}}{,}{\mathrm{Decompose}}{,}{\mathrm{Define}}{,}{\mathrm{Dγ}}{,}{\mathrm{Einstein}}{,}{\mathrm{EnergyMomentum}}{,}{\mathrm{Expand}}{,}{\mathrm{ExteriorDerivative}}{,}{\mathrm{Factor}}{,}{\mathrm{FeynmanDiagrams}}{,}{\mathrm{FeynmanIntegral}}{,}{\mathrm{Fundiff}}{,}{\mathrm{Geodesics}}{,}{\mathrm{GrassmannParity}}{,}{\mathrm{Gtaylor}}{,}{\mathrm{Intc}}{,}{\mathrm{Inverse}}{,}{\mathrm{Ket}}{,}{\mathrm{KillingVectors}}{,}{\mathrm{KroneckerDelta}}{,}{\mathrm{LeviCivita}}{,}{\mathrm{Library}}{,}{\mathrm{LieBracket}}{,}{\mathrm{LieDerivative}}{,}{\mathrm{Normal}}{,}{\mathrm{NumericalRelativity}}{,}{\mathrm{Parameters}}{,}{\mathrm{PerformOnAnticommutativeSystem}}{,}{\mathrm{Projector}}{,}{\mathrm{Psigma}}{,}{\mathrm{Redefine}}{,}{\mathrm{Ricci}}{,}{\mathrm{Riemann}}{,}{\mathrm{Setup}}{,}{\mathrm{Simplify}}{,}{\mathrm{SortProducts}}{,}{\mathrm{SpaceTimeVector}}{,}{\mathrm{StandardModel}}{,}{\mathrm{SubstituteTensor}}{,}{\mathrm{SubstituteTensorIndices}}{,}{\mathrm{SumOverRepeatedIndices}}{,}{\mathrm{Symmetrize}}{,}{\mathrm{TensorArray}}{,}{\mathrm{Tetrads}}{,}{\mathrm{ThreePlusOne}}{,}{\mathrm{ToContravariant}}{,}{\mathrm{ToCovariant}}{,}{\mathrm{ToFieldComponents}}{,}{\mathrm{ToSuperfields}}{,}{\mathrm{Trace}}{,}{\mathrm{TransformCoordinates}}{,}{\mathrm{Vectors}}{,}{\mathrm{Weyl}}{,}{\mathrm{^}}{,}{\mathrm{dAlembertian}}{,}{\mathrm{d_}}{,}{\mathrm{diff}}{,}{\mathrm{g_}}{,}{\mathrm{gamma_}}\right]$ (1)
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (2)
 To check the free and repeated indices found in tensor expressions for correctness, first Define the tensor objects of your problem.
 > $\mathrm{Define}\left(A,B,C\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{A}{,}{B}{,}{C}{,}{{\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)
 Consider now an expression where the (spacetime) tensors $A$, $B$, and $C$ appear in products and sums.
 > $\mathrm{expr}≔A\left[\mathrm{\mu },\mathrm{\nu }\right]B\left[\mathrm{\mu },\mathrm{\rho }\right]+C\left[\mathrm{\nu },\mathrm{\rho }\right]$
 ${\mathrm{expr}}{≔}{{B}}_{{\mathrm{\mu }}{,}{\mathrm{\rho }}}{}{{A}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\mu }}\phantom{{\mathrm{\nu }}}}{+}{{C}}_{{\mathrm{\nu }}{,}{\mathrm{\rho }}}$ (4)
 By inspecting this expression, you can see that $\mathrm{\mu }$ is a repeated index, so the sum rule over $\mathrm{\mu }$ ranging from 1 to the dimension of the spacetime is assumed, and $\mathrm{\nu }$ and $\mathrm{\rho }$ are free indices, the same in both terms of the sum. So everything is correct, and the Check command returns NULL (that is, it just displays the message).
 > $\mathrm{Check}\left(\mathrm{expr}\right)$
 $\mathrm{The repeated and free indices in the given expression check ok.}$ (5)
 To avoid displaying the message, use the optional keyword quiet, as in Check(expr, quiet). To actually return the free and repeated indices, use the optional parameter kind_of_indices.
 > $\mathrm{Check}\left(\mathrm{expr},\mathrm{all}\right)$
 $\mathrm{The repeated indices per term are:}{}\left[\left\{\mathrm{...}\right\}{,}\left\{\mathrm{...}\right\}{,}\mathrm{...}\right]{}\mathrm{, the free indices are:}{}\left\{\mathrm{...}\right\}$
 $\left[\left\{{\mathrm{\mu }}\right\}{,}{\varnothing }\right]{,}\left\{{\mathrm{\nu }}{,}{\mathrm{\rho }}\right\}$ (6)
 > $\mathrm{Check}\left(\mathrm{expr},\mathrm{free},\mathrm{quiet}\right)$
 $\left\{{\mathrm{\nu }}{,}{\mathrm{\rho }}\right\}$ (7)
 > $\mathrm{Check}\left(\mathrm{expr},\mathrm{repeated},\mathrm{quiet}\right)$
 $\left[\left\{{\mathrm{\mu }}\right\}{,}{\varnothing }\right]$ (8)
 When the free or repeated indices are incorrect, an error interruption points to the problem found.
 > $A\left[\mathrm{\mu },\mathrm{\nu }\right]B\left[\mathrm{\mu },\mathrm{\rho }\right]+C\left[\mathrm{\mu },\mathrm{\rho }\right]$
 ${{A}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{B}}_{{\mathrm{\mu }}{,}{\mathrm{\rho }}}{+}{{C}}_{{\mathrm{\mu }}{,}{\mathrm{\rho }}}$ (9)
 > $\mathrm{Check}\left(\right)$
 When checking indices in equations (more generally, relations), the free indices of the left-hand and right-hand sides are expected to be the same, or an error message interrupting the computation is displayed, and the output is presented also as an equation (relation)
 > $\mathrm{Check}\left(A\left[\mathrm{\mu },\mathrm{\nu }\right]B\left[\mathrm{\mu },\mathrm{\rho }\right]=-C\left[\mathrm{\mu },\mathrm{\rho }\right],\mathrm{all}\right)$
 > $\mathrm{Check}\left(A\left[\mathrm{\mu },\mathrm{\nu }\right]B\left[\mathrm{\mu },\mathrm{\rho }\right]=-C\left[\mathrm{\nu },\mathrm{\rho }\right],\mathrm{all}\right)$
 $\mathrm{The repeated indices per term are:}{}\left[\left\{\mathrm{...}\right\}{,}\left\{\mathrm{...}\right\}{,}\mathrm{...}\right]{}\mathrm{, the free indices are:}{}\left\{\mathrm{...}\right\}$
 $\left(\left[\left\{{\mathrm{\mu }}\right\}\right]{,}\left\{{\mathrm{\nu }}{,}{\mathrm{\rho }}\right\}\right){=}\left(\left[{\varnothing }\right]{,}\left\{{\mathrm{\nu }}{,}{\mathrm{\rho }}\right\}\right)$ (10)
 For practical reasons, this request of having the same free indices on both sides of an equation (more generally, a relation) is disregarded when one of these two sides is equal to 0, in which case the equation is first transformed into the left-hand minus right-hand sides, then processed, and the output is returned accordingly, not as a relation. So, for example, the output for the following equation is the same as the one you obtain for Check(A[mu,nu]*B[mu,rho] + C[nu,rho], all).
 > $\mathrm{Check}\left(A\left[\mathrm{\mu },\mathrm{\nu }\right]B\left[\mathrm{\mu },\mathrm{\rho }\right]+C\left[\mathrm{\nu },\mathrm{\rho }\right]=0,\mathrm{all}\right)$
 $\mathrm{The repeated indices per term are:}{}\left[\left\{\mathrm{...}\right\}{,}\left\{\mathrm{...}\right\}{,}\mathrm{...}\right]{}\mathrm{, the free indices are:}{}\left\{\mathrm{...}\right\}$
 $\left[\left\{{\mathrm{\mu }}\right\}{,}{\varnothing }\right]{,}\left\{{\mathrm{\nu }}{,}{\mathrm{\rho }}\right\}$ (11) Check noncommutative products

 Note that when loading Physics at the beginning of this Examples section we have loaded the * operator that comes with the package, designed to handle anticommutative and noncommutative operands in products. For the purpose of illustrating Check with noncommutative variables, unload that command, and set a macro to refer to it instead:
 > $\mathrm{unwith}\left(\mathrm{Physics},\mathrm{*}\right)$
 > $\mathrm{macro}\left(\mathrm{&*}=\mathrm{Physics}:-\mathrm{*}\right):$
 Now set prefixes for identifying anticommutative and noncommutative variables.
 > $\mathrm{Setup}\left(\mathrm{anticommutativeprefix}=Q,\mathrm{noncommutativeprefix}=Z\right)$
 $\left[{\mathrm{anticommutativeprefix}}{=}\left\{{Q}\right\}{,}{\mathrm{noncommutativeprefix}}{=}\left\{{Z}\right\}\right]$ (12)
 So in what follows, variables prefixed by $Q$ or $Z$, followed by a positive integer, are considered anticommutative and noncommutative, respectively.
 Now consider the following product constructed by the generalized product operator of the Physics package (in what follows, &* represents this operator, due to the macro used), and also using the global product operator *
 > $P≔\left(\mathrm{Q1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q1}+\mathrm{Q3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q4}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}1+\mathrm{Q5}\mathrm{Q7}\right)\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{Q6}$
 ${P}{≔}{\mathrm{Q1}}{}\left({\mathrm{Q1}}{+}{\mathrm{Q3}}{}\left({\mathrm{Q5}}{}{\mathrm{Q7}}{+}{\mathrm{Q4}}\right)\right){}{\mathrm{Q6}}$ (13)
 Although perhaps it is not evident on inspection, this product is ill-formed.
 > $\mathrm{Check}\left(P\right)$
 Analogously, products can be ill-formed regarding other types of problems.
 > $\left(\mathrm{Q1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q1}+\mathrm{Q3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q4}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}1+\mathrm{Z5}\mathrm{Z7}\right)\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{Q6}$
 ${\mathrm{Q1}}{}\left({\mathrm{Q1}}{+}{\mathrm{Q3}}{}\left({\mathrm{Z5}}{}{\mathrm{Z7}}{+}{\mathrm{Q4}}\right)\right){}{\mathrm{Q6}}$ (14)
 > $\mathrm{Check}\left(\right)$
 > $\left(\mathrm{Q1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q1}+\mathrm{Q3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q4}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}1+\mathrm{Q5}\mathrm{Z7}\right)\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{Q6}$
 ${\mathrm{Q1}}{}\left({\mathrm{Q1}}{+}{\mathrm{Q3}}{}\left({\mathrm{Q5}}{}{\mathrm{Z7}}{+}{\mathrm{Q4}}\right)\right){}{\mathrm{Q6}}$ (15)
 > $\mathrm{Check}\left(\right)$
 When the products Check okay, a message is displayed.
 > $\left(\mathrm{Q1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q1}+\mathrm{Q3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{Q4}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}1+\mathrm{A5}\mathrm{Q7}\right)\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&*\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{Q6}$
 ${\mathrm{Q1}}{}\left({\mathrm{Q1}}{+}{\mathrm{Q3}}{}\left({\mathrm{A5}}{}{\mathrm{Q7}}{+}{\mathrm{Q4}}\right)\right){}{\mathrm{Q6}}$ (16)
 > $\mathrm{Check}\left(\right)$
 $\mathrm{The products in the given expression check ok.}$ (17)
 > 
 To avoid displaying the message, use the optional keyword quiet, as in Check(%, quiet). See Also