7

Here is some Mathematica code:

kroneckerIntegral = Integrate[Sin[m*Pi*x]*Sin[n*Pi*x], {x, 0, 1}, Assumptions -> {n \[Element] Integers, m \[Element] Integers}]
FullSimplify[kroneckerIntegral, {n \[Element] Integers, m \[Element] Integers}]
FullSimplify[Integrate[Sin[m*Pi*x]*Sin[m*Pi*x], {x, 0, 1}], {m \[Element] Integers}]

The resulting Mathematica output of these three lines is:

$$\frac{n \sin (\pi m) \cos (\pi n)-m \cos (\pi m) \sin (\pi n)}{\pi m^2-\pi n^2}$$ $$0$$ $$\frac{1}{2}$$

So essentially kroneckerIntegral can be written in terms of a Kronecker delta as $\frac{\delta_{mn} - \delta_{-nm}}{2}$, which is also a direct result of the well known Fourier orthogonality relations.

Now how do I get Mathematica to simplify the integral to that expression? The reason I want to do this is because I have some long calculation that involves a few of these integrals and it would be convenient to tell Mathematica e.g. in form of a rule that I need this expression in terms of the Kronecker delta.

Wolpertinger
  • 167
  • 9

1 Answers1

4

Edit: updated with Jens' correct term.


Not sure if this is exactly what you are looking for, but it gets you close? Uses Inactivate to do a replace of the integral...

term = Inactivate[ Integrate[Sin[m*Pi*x]*Sin[m*Pi*x], {x, 0, 1}] ]
kroneckerTerm = term/.term->1/2(KroneckerDelta[m,n]-KroneckerDelta[m,-n])

kroneckerTerm/.{n->2,m->3}

(*  0 *)

kroneckerTerm/.{n->2,m->2}

(*  1/2 *)

If you are trying to do a find and replace on some really large expression, you can inactivate the whole thing, do a replace, and Activate it. For example...

bigterm = Inactivate[
          Integrate[Sin[m*Pi*x]*Sin[m*Pi*x], {x, 0, 1}] + 
          Integrate[Sin[m*Pi*x]*Sin[m*Pi*x], {x, 0, 1}]^2 + 
          Sin[Integrate[Sin[m*Pi*x]*Sin[m*Pi*x], {x, 0, 1}]]
          ];

(bigterm/. term -> 1/2 (KroneckerDelta[m, n] - KroneckerDelta[m, -n]))//Activate

(*  1/2 (-KroneckerDelta[m, -n] + KroneckerDelta[m, n])  
   + 1/4 (-KroneckerDelta[m, -n] + KroneckerDelta[m, n])^2  
   + Sin[1/2 (-KroneckerDelta[m, -n] + KroneckerDelta[m, n])]  *)
MikeY
  • 7,153
  • 18
  • 27