Computes the Generalized Kronecker Delta.

delta(n, p = 1)

Arguments

n

number of elements for each dimension.

p

order of the generalized Kronecker delta, p=1 for the standard Kronecker delta.

Value

array representing the generalized Kronecker delta tensor.

References

Guidotti, E. (2020). "calculus: High dimensional numerical and symbolic calculus in R". https://arxiv.org/abs/2101.00086

See also

Other tensor algebra: contraction(), diagonal(), einstein(), epsilon(), index()

Examples

### Kronecker delta 3x3
delta(3)
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#> [2,]    0    1    0
#> [3,]    0    0    1

### generalized Kronecker delta 3x3 of order 2
delta(3, p = 2)  
#> , , 1, 1
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    0
#> [3,]    0    0    0
#> 
#> , , 2, 1
#> 
#>      [,1] [,2] [,3]
#> [1,]    0   -1    0
#> [2,]    1    0    0
#> [3,]    0    0    0
#> 
#> , , 3, 1
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0   -1
#> [2,]    0    0    0
#> [3,]    1    0    0
#> 
#> , , 1, 2
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    1    0
#> [2,]   -1    0    0
#> [3,]    0    0    0
#> 
#> , , 2, 2
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    0
#> [3,]    0    0    0
#> 
#> , , 3, 2
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0   -1
#> [3,]    0    1    0
#> 
#> , , 1, 3
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    1
#> [2,]    0    0    0
#> [3,]   -1    0    0
#> 
#> , , 2, 3
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    1
#> [3,]    0   -1    0
#> 
#> , , 3, 3
#> 
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    0
#> [3,]    0    0    0
#>