# Integration of an expression yields wrong result

I'm trying to find a general expression for the definite integral of

 Cos[2 h phi - 2 h theta] G0 (Cos[(v π)/6 - theta] K1 +
Cos[(v π)/2 - 3 theta] K3) (Cos[(k π)/6 - theta] K1 +
Cos[(k π)/2 - 3 theta] K3)


with respect to theta, from 0 to 2 π, where h, v, k are non-negative integers and phi is supposed to be a variable. However, the expression

Integrate[ Cos[2 h phi - 2 h theta] G0
(Cos[(v π)/6 - theta] K1 +
Cos[(v π)/2 - 3 theta] K3)
(Cos[(k π)/6 - theta] K1 +
Cos[(k π)/2 - 3 theta] K3), {theta, 0, 2 Pi},
Assumptions -> {h ∈ Integers , v ∈ Integers ,
k ∈ Integers , h >= 0 , v >= 0 , k >= 0}]


yields a function that is not existent if I plug in h=0, even though a constant term should come out. The same is true for h=1. Does anyone see where I'm making a mistake? I'm using Wolfram Mathematica 10.0.

• If you can try without subscripts, then if it still does not work, please post your input. Hard to even read code with subscripts. No need to use Subscripts. – Nasser Jan 13 '15 at 10:48

You should take the limits, not plug in values:

expr=G0*(K3*Cos[(k*Pi)/2 - 3*theta] + K1*Cos[(k*Pi)/6 - theta])*
Cos[2*h*phi - 2*h*theta]*(K3*Cos[3*theta - (Pi*v)/2] +
K1*Cos[theta - (Pi*v)/6]);

r = Integrate[expr, {theta, 0, 2 Pi}];
Limit[r, h -> 1]


Limit[r, h -> 0]


Use some values

Limit[r, h -> 1] /. {K1 -> 1, K2 -> 2, K3 -> 3, v -> 4, G0 -> 5, phi -> 6, k -> 7} // N


Compare to just pluggin in h=0 and h=1