kroneckerDelta

Kronecker delta: 1 when the arguments are equal, 0 otherwise.

Category: Mathematics > Mathematical Functions

Syntax

d = kroneckerDelta(m, n)

Returns 1 if m equals n, and 0 otherwise.

d = kroneckerDelta(m)

Same as kroneckerDelta(m, 0).

Description

The Kronecker delta is the discrete counterpart of the Dirac delta. It is the entry pattern of an identity matrix: kroneckerDelta(i, j) is the entry in row i, column j. It is often used to select one term of a sum.

Input arguments

m, n
Numbers or symbolic expressions to compare.

Output arguments

d
1 or 0. With a symbolic argument whose equality cannot be decided, the call stays unevaluated.

Example

Equal and different arguments

kroneckerDelta(2, 2)
kroneckerDelta(1, 2)
kroneckerDelta(0)
Output
ans = 1
ans = 0
ans = 1

Notes

In MatLivre only scalar arguments are accepted; use a comparison such as m == n for arrays.

See also

eye dirac heaviside isequal