Check - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

withPhysics

`*`,`.`,Annihilation,AntiCommutator,Antisymmetrize,Assume,Bra,Bracket,Check,Christoffel,Coefficients,Commutator,CompactDisplay,Coordinates,Creation,D_,Dagger,Decompose,Define,Dγ,DiracConjugate,Einstein,EnergyMomentum,Expand,ExteriorDerivative,Factor,FeynmanDiagrams,FeynmanIntegral,Fundiff,Geodesics,GrassmannParity,Gtaylor,Intc,Inverse,Ket,KillingVectors,KroneckerDelta,LagrangeEquations,LeviCivita,Library,LieBracket,LieDerivative,Normal,NumericalRelativity,Parameters,PerformOnAnticommutativeSystem,Projector,Psigma,Redefine,Ricci,Riemann,Setup,Simplify,SortProducts,SpaceTimeVector,StandardModel,Substitute,SubstituteTensor,SubstituteTensorIndices,SumOverRepeatedIndices,Symmetrize,TensorArray,Tetrads,ThreePlusOne,ToContravariant,ToCovariant,ToFieldComponents,ToSuperfields,Trace,TransformCoordinates,Vectors,Weyl,`^`,dAlembertian,d_,diff,g_,gamma_

(1)

Setupmathematicalnotation=true

mathematicalnotation=true

(2)
  

To check the free and repeated indices found in tensor expressions for correctness, first Define the tensor objects of your problem.

DefineA,B,C

Defined objects with tensor properties

A,B,C,γμ,σμ,μ,gμ,ν,εα,β,μ,ν

(3)
  

Consider now an expression where the (spacetime) tensors A, B, and C appear in products and sums.

exprAμ,νBμ,ρ+Cν,ρ

exprAμ,νBμ,ρ+Cν,ρ

(4)
  

By inspecting this expression, you can see that μ is a repeated index, so the sum rule over μ ranging from 1 to the dimension of the spacetime is assumed, and ν and ρ 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).

Checkexpr

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.

Checkexpr,all

The repeated indices per term are: ...,...,..., the free indices are: ...

μ,,ν,ρ

(6)

Checkexpr,free,quiet

ν,ρ

(7)

Checkexpr,repeated,quiet

μ,

(8)
  

When the free or repeated indices are incorrect, an error interruption points to the problem found.

Aμ,νBμ,ρ+Cμ,ρ

Aμ,νBμ,ρ+Cμ,ρ

(9)

Check

Found different free indices in different operands of a sum; in operand 1: ν,ρ, in operand 2: μ,ρ, in Aμ,νBμ,ρ+Cμ,ρ

Error, (in Physics:-Check) found different free indices in different operands of a sum

  

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)

CheckAμ,νBμ,ρ=Cμ,ρ,all

Free indices on both sides of the equation are different: found ν,ρ on the left-hand side and μ,ρ on the right-hand side

Error, (in Physics:-Check) free indices on both sides of the equation are different

CheckAμ,νBμ,ρ=Cν,ρ,all

The repeated indices per term are: ...,...,..., the free indices are: ...

μ,ν,ρ=,ν,ρ

(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).

CheckAμ,νBμ,ρ+Cν,ρ=0,all

The repeated indices per term are: ...,...,..., the free indices are: ...

μ,,ν,ρ

(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:

unwithPhysics,`*`

macro`&*`=Physics:-`*`:

  

Now set prefixes for identifying anticommutative and noncommutative variables.

Setupanticommutativeprefix=Q,noncommutativeprefix=Z

anticommutativeprefix=Q,noncommutativeprefix=Z

(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 `*`

PQ1&*Q1+Q3&*Q4&*1+Q5Q7&*Q6

PQ1Q1+Q3Q5Q7+Q4Q6

(13)
  

Although perhaps it is not evident on inspection, this product is ill-formed.

CheckP

Error, (in Physics:-Check) found more than 1 anticommutative object in the commutative product: Q5*Q7

  

Analogously, products can be ill-formed regarding other types of problems.

Q1&*Q1+Q3&*Q4&*1+Z5Z7&*Q6

Q1Q1+Q3Z5Z7+Q4Q6

(14)

Check

Error, (in Physics:-Check) found more than 1 noncommutative object in the commutative product: Z5*Z7

Q1&*Q1+Q3&*Q4&*1+Q5Z7&*Q6

Q1Q1+Q3Q5Z7+Q4Q6

(15)

Check

Error, (in Physics:-Check) found anticommutative and noncommutative objects in the commutative product Q5*Z7

  

When the products Check okay, a message is displayed.

Q1&*Q1+Q3&*Q4&*1+A5Q7&*Q6

Q1Q1+Q3A5Q7+Q4Q6

(16)

Check

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

Define, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[`*`], Setup