the Kronecker delta - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Physics : Physics/KroneckerDelta

Physics[KroneckerDelta] - the Kronecker delta

Calling Sequence

KroneckerDelta[m, n]


m, n


the indices, as names representing integer numbers or the numbers themselves



KroneckerDelta[m, n], displayed as δ__m,n, is a computational representation for the Kronecker Delta, that is: it returns 1 or 0, according to whether the indices are equal or different, or so assumed using assuming. When equality cannot be proved or disproved KroneckerDelta[m, n] returns unevaluated, echoing the input.


Note: Since Maple 2019, KroneckerDelta[m, n] is not implemented as a tensor (of type Physics:-Library:-PhysicsType:-Tensor), even if m and n are letters representing spacetime or space tensor indices, unless:


one of such spacetime or space indices is contravariant, preceded with ~, as in ~n, while the other remains covariant, in which case KroneckerDelta[m, ~n] is automatically transformed into the spacetime metric g_[m, n] which is a tensor;


the indices are of type Physics:-Library:-PhysicsType:-<spinorindex, su2index, su2matrixindex, su3index, su3matrixindex, or gaugeindex>, in which case KroneckerDelta[m, ~n] represents the (tensor) metric of the corresponding space and is used to contract the corresponding indices.


Consequently &delta;__m,m with the two indices equal and covariant, returns the number 1 when KroneckerDelta is not a tensor, and Einstein's sum rule for repeated indices is applied otherwise, resulting in the trace, the dimension of the space to which the indices belong (e.g. for su3 indices the dimension is 8 and for su3matrix indices the dimension is 3).


If, on the other hand, you prefer to work with KroneckerDelta[m, n] always as a tensor, for example in quantum mechanics by setting the spacetime to be Euclidean and of dimension 3 (something you can accomplish using Setup), you can set a macro, or Define a tensor representing the Kronecker δ tensor also for space or spacetime indices. See the example at the end of the Examples section.


The %KroneckerDelta command is the inert form of KroneckerDelta, so it represents the same mathematical operation but without performing it. To perform the operation, use value.


Some automatic checking and normalization are carried out each time you enter KroneckerDelta[...]. The checking is concerned with possible syntax errors. The automatic normalization takes into account the symmetry of KroneckerDelta[m,n] with respect to interchanging the positions of the indices m and n.


The %KroneckerDelta command is the inert form of KroneckerDelta, so it represents the same thing but entering it does not result in performing any computation. To perform the related computations as if %KroneckerDelta were KroneckerDelta, use value.



Setup(mathematicalnotation = true);



KroneckerDelta[2, 2] = KroneckerDelta[m, m];



KroneckerDelta[2, 3];



KroneckerDelta[m, n];



KroneckerDelta is sensitive to assumptions:

(4) assuming m = n;



(4) assuming m <> n;



The symmetry property of KroneckerDelta is automatically taken into account when the indices have symbolic values

KroneckerDelta[m, n] - KroneckerDelta[n, m];



By default, spacetime indices are represented by greek letters and the dimension of spacetime is 4 - you can query about that via

Setup(spacetimeindices, dimension);



Note: Since Maple 2019, KroneckerDelta[m, n] is not considered a tensor (of type Physics:-Library:-PhysicsType:-Tensor), even if m and n are letters representing space or spacetime tensor indices, unless the indices are of type Physics:-Library:-PhysicsType:-<spinorindex, su2index, su2matrixindex, su3index, su3matrixindex, or gaugeindex>. Consequently, the following calls to KroneckerDelta with repeated indices return the dimension

Setup(su2indices = lowercaselatin_ah, su3indices = lowercaselatin_is);



KroneckerDelta[a, a];



type(a, Physics:-Library:-PhysicsType:-su2index);



type(KroneckerDelta[a, b], Physics:-Library:-PhysicsType:-Tensor);



KroneckerDelta[j, j];



type(j, Physics:-Library:-PhysicsType:-su3index);



type(KroneckerDelta[j, k], Physics:-Library:-PhysicsType:-Tensor);



and the following does not return the trace, but the number 1

KroneckerDelta[mu, mu];



type(KroneckerDelta[mu, nu], Physics:-Library:-PhysicsType:-Tensor);



type(mu, Physics:-Library:-PhysicsType:-spacetimeindex);



Care should be taken, however, if you happen to index KroneckerDelta with a space or spacetime index such that one index is covariant and the other contravariant (preceded by ~). In those cases KroneckerDelta is automatically transformed, respectively into the space or spacetime metric, gamma_ or g_ (all displayed with the δ greek letter as is standard in physics textbooks), for which the index repeated represents the trace, respectively equal to the space or spacetime dimension.

KroneckerDelta[mu, ~nu] = g_[mu, ~nu];




Physics:-g_[mu,~nu] = Physics:-g_[mu,~nu]

eval((19), mu = nu);



(19) assuming mu = nu;



There is one scenario, typical in quantum mechanics, in which KroneckerDelta is however used as a tensor to represent the metric of an Euclidean space, often of dimension 3, and that representation is used when expressing commutator rules. For example,

Setup(metric = Euclidean, dimension = 3, su2indices = none, su3indices = none, spacetimeindices = lowercaselatin);

Warning, unable to define the Pauli sigma matrices (Psigma) as a tensor in a spacetime with dimension = 3 where the metric is not Euclidean. You can still refer to the Pauli matrices using Psigmax, Psigmay and Psigmaz

The dimension and signature of the tensor space are set to 3&comma;- - +

The Euclidean metric in cartesian coordinates

Changing the signature of the tensor spacetime to: + + +

Defined Pauli sigma matrices (Psigma): σ1, σ2, σ3




Define now qj and pk as tensors respectively representing position and momentum

Setup(quantumoperators = {p, q}, tensors = {q[j], p[k]}, metric = Euclidean, dimension = 3);

The Euclidean metric in cartesian coordinates



Set the standard commutator rules using tensor notation pj&comma;qk=KroneckerDeltaj,k there the right-hand side is expressed using KroneckerDelta[j,k]

Setup(%Commutator(p[j], q[k]) = KroneckerDelta[j, k]);

Warning, since Maple 2019 KroneckerDelta is not implemented as a tensor unless the indices are of type <spinor, su2, su3 or gauge>indices, not space or spacetime. Thus, the right-hand side of the algebra rule `?`=δj,k has for free tensor indices , while the left-hand side has j&comma;k, of which j&comma;k appear in δj,k. To resolve this problem you can: 1. If the dimension of the tensor indices on the left-hand side is 3, then use su2indices that you can define via Setupsu2indices=lowercaselatin. 2. Use the spacetime metric g_, or the space metric gamma_, instead of KroneckerDelta. If so, check the value of: Setupsignature. 3. Enter: macroKroneckerDelta=g_; or use gamma_ instead of g_. 4. Define a Kronecker δ tensor. In the following, type 'delta' on the left and 'KroneckerDelta' on the right, or copy and paste: Defineδa,b=Matrix3&comma;3&comma;j&comma;kδj,k. After any of the above it is recommended that you set this algebra rule again, with the corrected right-hand side, to avoid problems due to having different free indices on each side of the rule.



The warning message explains the problem: the free indices are not the same at each side of the algebra rule because KroneckerDelta[j, k] is not representing a tensor, even when in an Euclidean space (only) its components do transform like tensor components and are equal to the identity matrix. From the four options indicated, if you are adapting a worksheet written before Maple 2019, the simplest is option 3:

macro(KroneckerDelta = g_):

After that, all occurrences of KroneckerDelta[m, m], now representing g_[m, m] with Einstein's sum over the repeated indices, will automatically return the trace of the metric instead of the number 1:

KroneckerDelta[m, m];



You can undo this mapping of KroneckerDelta into g_ at any time via

macro(KroneckerDelta = KroneckerDelta):

If you are not adapting worksheets of previous releases, however, the best is option 3, because it gives you access to both the tensor and the non-tensor versions of Kronecker δ. Directly copying from the message above and pasting on an input line,

Define(delta[a, b] = Matrix(3, 3, (j, k) -> KroneckerDelta[j, k]));

Defined objects with tensor properties



Check now the components and behavior of this Kronecker delta tensor




delta[1, 1];



SumOverRepeatedIndices(delta[m, m]);



while you still have the non-tensor version

KroneckerDelta[m, m];



You can now reenter the algebra rules in tensor notation, with the right-hand side corrected using the tensor version delta[j, k]

Setup(%Commutator(p[j], q[k]) = delta[j, k]);



Matrix(3, (m, n) -> (%Commutator = Commutator)(p[m], q[n]));



(%Commutator = Commutator)(p[a], q[b]);



expand(eval((33), a = b));










See Also

`.`, Commutator, g_, gamma_, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Setup



The Physics[KroneckerDelta] command was updated in Maple 2020.