Simplify sum of Kronecker delta
Why not work with symbolic tensors instead? For example, your sum can be represented as:
s = TensorContract[
TensorProduct[
IdentityMatrix[j],
IdentityMatrix[k],
A
],
{{2, 5}, {4, 6}}
];
The built-in function TensorReduce
is not quite able to simplify this, but you can install my TensorSimplify
paclet to enable simplification. Install with:
PacletInstall[
"TensorSimplify",
"Site" -> "http://raw.githubusercontent.com/carlwoll/TensorSimplify/master"
]
Once installed, load the package with:
<<TensorSimplify`
Finally, let's try TensorSimplify
on your example:
TensorSimplify[s, Assumptions -> A ∈ Matrices[{j, k}]]
A
One approach is to use DiscreteDelta instead of KroneckerDelta. With this substitution, the setup is:
$Assumptions = Element[a | b, Integers] && 1 <= a <= J && 1 <= b <= K;
expr = Sum[DiscreteDelta[a - j]*DiscreteDelta[b - k]*A[j, k], {j, 1, J}, {k, 1, K}]
A[Ceiling[a], Ceiling[b]]
Amazingly, it isn't even necessary to invoke Simplify, though I suppose it might in more complicated situations. To see that this substitution of DiscreteDelta for KroneckerDelta is correct, observe that
KroneckerDelta[a, j] == DiscreteDelta[a - j] // FullSimplify
True