# Simplify simple symbolic expression with KroneckerDelta

In short, my question is about finding a method for performing an automatic substitution f[a]/.{a->b}, where b depends on the form of f. Let me give here an example.

Suppose I have an expression like

A[b] B[d] KroneckerDelta[b, d + 1]


I would like to simplify this expression to get

A[d + 1] B[d]


(I know that this mapping can be mathematically incorrect, but this is what I would need to do).

In this example, applying /.b->d+1 would indeed give the desired result. The problem is that my full expression is a very long equation of the type

A1[b] B1[d] KroneckerDelta[b, d + 1] +
A2[b] B2[d] KroneckerDelta[b, d - 1] +
A3[b] B3[d] KroneckerDelta[b, d] + ...


and I cannot do the above substitution manually per each term. Therefore, I'm looking for a method to get

(A1[b] B1[d] KroneckerDelta[b, d + 1] /. b->d+1 ) +
(A2[b] B2[d] KroneckerDelta[b, d - 1] /. b->d-1) +
(A3[b] B3[d] KroneckerDelta[b, d] /.b->d) + ...

• Please learn how to typeset in MathJax. Sep 17 at 18:04
• The latter is not equivalent to the former even for the nonnegative integers. You ask something like how to do 2+2==5. Sep 17 at 18:14
• you mention they're in a summation—but are they in an explicit Sum[...], or are we trying to implement Einstein convention? if the former, it would be better to manipulate the whole Sum expression. Sep 17 at 18:41
• Maybe A[b] B[d] KroneckerDelta[b, d + 1] /. b -> d + 1. Sep 17 at 20:15
• @Henrik Schumacher Why not writing your solution as the regular answer? I think it would be useful. Sep 19 at 20:21