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) + ...
  • $\begingroup$ Please learn how to typeset in MathJax. $\endgroup$ Sep 17 at 18:04
  • $\begingroup$ The latter is not equivalent to the former even for the nonnegative integers. You ask something like how to do 2+2==5. $\endgroup$
    – user64494
    Sep 17 at 18:14
  • $\begingroup$ 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. $\endgroup$
    – thorimur
    Sep 17 at 18:41
  • $\begingroup$ Maybe A[b] B[d] KroneckerDelta[b, d + 1] /. b -> d + 1. $\endgroup$ Sep 17 at 20:15
  • 1
    $\begingroup$ @Henrik Schumacher Why not writing your solution as the regular answer? I think it would be useful. $\endgroup$ Sep 19 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.