(cls, i, j)
Evaluates the discrete delta function.

        Examples
        ========

        >>> from sympy.functions.special.tensor_functions import KroneckerDelta
        >>> from sympy.abc import i, j, k

        >>> KroneckerDelta(i, j)
        KroneckerDelta(i, j)
        >>> KroneckerDelta(i, i)
        1
        >>> KroneckerDelta(i, i + 1)
        0
        >>> KroneckerDelta(i, i + 1 + k)
        KroneckerDelta(i, i + k + 1)

        # indirect doctest
Evaluates the discrete delta function.
Evaluates the discrete delta function .
def eval(cls, i, j):
        """
        Evaluates the discrete delta function.

        Examples
        ========

        >>> from sympy.functions.special.tensor_functions import KroneckerDelta
        >>> from sympy.abc import i, j, k

        >>> KroneckerDelta(i, j)
        KroneckerDelta(i, j)
        >>> KroneckerDelta(i, i)
        1
        >>> KroneckerDelta(i, i + 1)
        0
        >>> KroneckerDelta(i, i + 1 + k)
        KroneckerDelta(i, i + k + 1)

        # indirect doctest

        """
        if (i > j) is True:
            return cls(j, i)

        diff = C.Abs(i - j)
        if diff == 0:
            return S.One
        elif diff.is_number:
            return S.Zero
        elif i != 0 and diff.is_nonzero:
            return cls(0, diff.args[0])

        if i.assumptions0.get("below_fermi") and \
                j.assumptions0.get("above_fermi"):
            return S.Zero
        if j.assumptions0.get("below_fermi") and \
                i.assumptions0.get("above_fermi"):
            return S.Zero
        # to make KroneckerDelta canonical
        # following lines will check if inputs are in order
        # if not, will return KroneckerDelta with correct order
        if i is not min(i, j, key=default_sort_key):
            return cls(j, i)
def eval ( cls , i , j ) : if ( i > j ) is True : return cls ( j , i ) diff = C . Abs ( i - j ) if diff == 0 : return S . One elif diff . is_number : return S . Zero elif i != 0 and diff . is_nonzero : return cls ( 0 , diff . args [ 0 ] ) if i . assumptions0 . get ( "below_fermi" ) and j . assumptions0 . get ( "above_fermi" ) : return S . Zero if j . assumptions0 . get ( "below_fermi" ) and i . assumptions0 . get ( "above_fermi" ) : return S . Zero # to make KroneckerDelta canonical # following lines will check if inputs are in order # if not, will return KroneckerDelta with correct order if i is not min ( i , j , key = default_sort_key ) : return cls ( j , i )