Assuming[Element[n, Integers], Integrate[Sin[x]*Sin[n*x],{x,0,Pi}]]
returns 0, which is obviously wrong for n=1.
Assuming[n==1, Integrate[Sin[x]*Sin[n*x],{x,0,Pi}]]
does return Pi/2 (so in particular not 0).
Just evaluating the integral yields
-Sin[n*Pi]/(-1+n^2)
which is indetermined for n=1.
Can someone explain to me what Mathematica is doing and how to obtain a correct result?
Limit[-(Sin[n \[Pi]]/(-1 + n^2)), n -> 1]. – b.gates.you.know.what Feb 11 '14 at 11:23Integrate[Sin[x]*Sin[n*x], {x, 0, Pi}, Assumptions -> Element[n, Integers]]does not return 0. I thought thatAssuming[something, Integrate[...]]andIntegrate[..., Assumptions -> something]were always equivalent. IsAssumingaffecting something used internally byIntegrate? – Szabolcs Feb 11 '14 at 13:41Assuming[a, b]was effectivelyBlock[{$Assumptions = a}, b]. I may be wrong, though. – rcollyer Feb 11 '14 at 14:00