Skip to main content
1 of 6

How to get a general answer using Integrate[]

The following two codes give conflicting answers, when integrating sin(kpix)sin(2npix) from 0 to 1, where both k and n are positive integers.

Code 1 assumes that k,n are independent integers: Integrate[Sin[kPix]Sin[2nPix],{x,0,1},Assumptions->{k[Element]Integers,n[Element]Integers}] The result given by mathematica is 0.

Code 2 assumes that k=2n and n is integer: Integrate[Sin[kPix]Sin[2nPix],{x,0,1},Assumptions->{n[Element]Integers,k=2n}] The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a general result. Isn't Code 1 supposed to give a general result?