I executed this command in Mathematica
FullSimplify[Integrate[Sin[x] Sin[k x ], {x, 0, Pi}], Element[k, Integers]]
and got 0. However, if I execute the same command with k=1.
Integrate[Sin[x] Sin[k x] /. {k -> 1}, {x, 0, Pi}]
I get the correct answer, Pi/2. Is this normal? I would expected a conditional based on k=1.
The integral:
Integrate[Sin[x] Sin[k x], {x, 0, Pi}]
evaluates to:
-(Sin[k \[Pi]]/(-1 + k^2))
If you do Simplify[%, Element[k,Integers]]
, it will assume Sin[k \[Pi]]
being zero. The flaw is, Simplify
will assume 0
multiplies any non-directly-zero symbol being reduced to 0
, even if could be undefined:
0 / x (*Evaluates to 0*)
ReleaseHold[Hold[0 / x] /. x->0] (*boom*)
This is explained in detail within Possible Issues section of Simplify
.
All of above applies to FullSimplify