# Integrate does not accept my integrand expression

I want to calculate the symbolic integral, but I could not obtain the final results from Mathematica.

$Assumptions = R > 0 && f > 0 && m ∈ Integers; a1[a_] := Log[R Sqrt[2 (1 - Cos[a])]]; b[a_] := R (1 - Cos[a]); c[a_] := R Sin[a]; d2[a_] := 2 R R (1 - Cos[a]); d4[a_] := d2[a]^2; Ebb[a_] := -a1[a] + b[a]^2/d2[a]; Ebc[a_] := b[a] c[a]/d2[a]; Ecc[a_] := -a1[a] + c[a]^2/d2[a]; fb[a_] := f Cos[m a]; fc[a_] := f Sin[m a];  when I calcualted wb ingetral as follows: wb = Integrate[Ebb[a] fb[a] + Ebc[a] fc[a], {a, 0, 2 π}]  I found the result was not calculated -- I got the output: Where did I make a mistake? Could you tell me how to do one bit more complicated integral by your method, please? I used the same method as you provided, but failed this time. Here I just introduced another angle u besides the angle a, and made fb and fc a little more complicated. But I guess that these minor changes should not affect your method to be applied. a1[a_, u_] := Log[R Sqrt[2 (1 - Cos[u - a])]]; b[a_, u_] := R (1 - Cos[u - a]); c[a_, u_] := R Sin[u - a]; d2[a_, u_] := 2 R R (1 - Cos[u - a]); d4[a_, u_] := d2[a, u]^2; Ebb[a_, u_] := -a1[a, u] + b[a, u]^2/d2[a, u]; Ebc[a_, u_] := b[a, u] c[a, u]/d2[a, u]; Ecc[a_, u_] := -a1[a, u] + c[a, u]^2/d2[a, u]; fb[a_] := Refb Cos[m a] - Infb Sin[m a]; fc[a_] := Refc Cos[m a] - Infc Sin[m a];$Assumptions = True;
wb = Integrate[Ebb[a, u] fb[a] + Ebc[a, u] fc[a], {a, 0, 2 \[Pi]},
Assumptions -> R > 0 && Refb > 0 && Infb > 0 && Refc > 0 && Infc > 0 && m \[Element] Integers && {u, 0, 2 \[Pi]}]

1/2 (-((2 Infb Sin[m \[Pi]]^2)/m) + (Refb Sin[2 m \[Pi]])/m + (1/(m^2))Infb (-Hypergeometric2F1[1, -m, 1 - m, E^(-I u)] +
Hypergeometric2F1[1, m, 1 + m, E^(-I u)] -
Cos[2 m \[Pi]] Hypergeometric2F1[1, m, 1 + m,
Cos[u] - I Sin[u]] + 2 m Log[R] - 2 m Cos[2 m \[Pi]] Log[R] +
m Log[2 - 2 Cos[u]] - m Cos[2 m \[Pi]] Log[2 - 2 Cos[u]] +
Hypergeometric2F1[1, -m, 1 - m,
Cos[u] - I Sin[u]] (Cos[2 m \[Pi]] - I Sin[2 m \[Pi]]) +
I Sin[2 m \[Pi]] -
I Hypergeometric2F1[1, m, 1 + m, Cos[u] - I Sin[u]] Sin[
2 m \[Pi]]) + (1/(m^2)) I Refb (1 - Cos[2 m \[Pi]] -
Hypergeometric2F1[1, -m, 1 - m, E^(-I u)] -
Hypergeometric2F1[1, m, 1 + m, E^(-I u)] +
Cos[2 m \[Pi]] Hypergeometric2F1[1, m, 1 + m,
Cos[u] - I Sin[u]] +
Hypergeometric2F1[1, -m, 1 - m,
Cos[u] - I Sin[u]] (Cos[2 m \[Pi]] - I Sin[2 m \[Pi]]) +
I Hypergeometric2F1[1, m, 1 + m, Cos[u] - I Sin[u]] Sin[
2 m \[Pi]] + 2 I m Log[R] Sin[2 m \[Pi]] +
I m Log[2 - 2 Cos[u]] Sin[2 m \[Pi]]) - (Refb (m Cos[u] Sin[2 m \[Pi]] - 2 Sin[m \[Pi]]^2 Sin[u]))/(-1 +
m^2) + (Infb (2 m Cos[u] Sin[m \[Pi]]^2 +
Sin[2 m \[Pi]] Sin[u]))/(-1 + m^2) + (1/(-1 + m^2)) 2 Sin[m \[Pi]] (Sin[m \[Pi]] (Refc Cos[u] - Infc m Sin[u]) +
Cos[m \[Pi]] (Infc Cos[u] + m Refc Sin[u])))


The help of Limit failed this time:

Limit[wb, m -> #] & /@ Range[-2, 2]


The final result is too long, so I do not copy it here. I am not sure where I made a mistake.

• v8.0.4 evaluates to 0. – xzczd Apr 19 '14 at 11:05
• No. I wonder there is a bug in Mathematica. If I chose m=2, I can obtain f\Pi/2. But I could not get the final result by symbolic calculation. – Hao Wu Apr 19 '14 at 11:07
• You're right. Seems to be a bug at least to v8.0.4. BTW, if I introduce the assumptions with Assumption option of Integrate, the calculation seems to last forever. Maybe you can report it to Wolfram company? – xzczd Apr 19 '14 at 11:52
• It is strange. My friend used maple to obtain the final result f\Pi/m for the generalization of m. And if I did not give the assumptions, and then integrate the same integrand from 0 to 2Pi and from -Pi to Pi give us two different results. – Hao Wu Apr 19 '14 at 12:21
• The integration with Assumptions option inside Integrate just finished and it gave back the input 囧. A friend of mine has also tried Maple 18 but it gave back the input (Maybe it's because he isn't good at Maple? ). Also, when m = 0, the result isn't actually f Pi/m but f Pi (1 - 2 Log[R]). As to the integration without assumptions, the results of that from 0 to 2 Pi and from -Pi to Pi seem to be the same when Element[m, Integers], and though a direct substitution of m won't work, we can get a simplified result for a specific m with Limit. – xzczd Apr 19 '14 at 13:42

Seems to be a bug. Maybe you can report it to Wolfram company.

Here's just some observations with v8.0.4.

If the assumptions are introduced by $Assumptions, the result is apparently incorrect: $Assumptions = R > 0 && f > 0 && m ∈ Integers;
Integrate[Ebb[a] fb[a] + Ebc[a] fc[a], {a, 0, 2 π}]

0


but things will be different if we turn to Assumptions inside Integrate:

$Assumptions = True; wb = Integrate[Ebb[a] fb[a] + Ebc[a] fc[a], {a, 0, 2 π}, Assumptions -> R > 0 && f > 0 && m ∈ Integers]  1/4 f (-(1/(m^2)) I E^(-2 I m π) (-1 + E^(2 I m π)) (-1 + E^(2 I m π) + 2 EulerGamma m + 2 E^(2 I m π) EulerGamma m + I m π + I E^(2 I m π) m π - 2 m Log[R] - 2 E^(2 I m π) m Log[R] + 2 m PolyGamma[0, -m] + 2 E^(2 I m π) m PolyGamma[0, m]) + (2 Sin[2 m π])/m - (2 Sin[2 m π])/(1 + m))  A direct substitution of m to this wb will lead to errors: wb /. List /@ Thread[m -> Range[-2, 2]]  Warnings… {Indeterminate, Indeterminate, Indeterminate, Indeterminate, Indeterminate}  But we can get correct result with the help of Limit: Limit[wb, m -> #] & /@ Range[-2, 2]  {(f π)/2, 0, f π (1 - 2 Log[R]), f π, (f π)/2}  Though the form looks different, the integrals taken by$[-\pi,\pi]$and$[0,2\pi]$are in fact the same: wb2 = Integrate[Ebb[a] fb[a] + Ebc[a] fc[a], {a, 0, 2 π}, Assumptions -> R > 0 && f > 0 && m ∈ Integers]; Limit[ans, m -> #] & /@ Range[-4, 4] // FullSimplify  {(f π)/4, (f π)/3, (f π)/2, 0, f π (1 - 2 Log[R]), f π, (f π)/2, (f π)/3, (f π)/4}  Finally, the real problem may lie in Simplify: Simplify[wb, m ∈ Integers]  0  Notice that it probably cannot be called a bug of Simplify because this behavior seems to be already covered by the Possible Issues of the documents of Simplify and FullSimplify. So, just a guess, Integrate have internally use Simplify to simplify the final result and this lead to the incorrect result of the first sample. ($Assumptions is also used by Simplify.) I think I used to see a post that comes to the similar conclusion in this site, but I can't find it right now.

BTW, if you want to get a simplified but incomplete result, you can try:

Simplify[FunctionExpand@wb, m ∈ Integers]

(f π)/m


Some of the solutions are lost, it's not surprising because it's mentioned in the Possible Issues of the document of FunctionExpand that some transformations used by FunctionExpand are only generically valid.

• Thank you very much. Your comments are very helpful. But why are the integrals taken by [0,2 π] and [-π, π] different? – Hao Wu Apr 22 '14 at 11:27
• @HaoWu Check my edit. BTW, my friend still can't get f Pi/m with his Maple 18 even with the assumption m!=0, can you provide the code? – xzczd Apr 22 '14 at 12:07
• I am not a maple user. I will ask my friend how he did it. Oh, I found my result from Mathematica 9 is a bit different from yours by the same way. My result is (1/(4 m^2))E^(-2 I m [Pi]) (-1 + E^(2 I m [Pi])) f (I + m [Pi] - 2 I m HarmonicNumber[-1 - m] + 2 I m Log[R] + E^(2 I m [Pi]) (-I + m [Pi] - 2 I m (EulerGamma - Log[R] + PolyGamma[0, m]))) . After using Limit[wb, m -> #] & /@ Range[-2, 2], it gives {(f [Pi])/2, f [Pi], -2 f [Pi] Log[R], f [Pi], (f [Pi])/2} – Hao Wu Apr 22 '14 at 12:32
• Sorry, I do not know why, but when I rerun Mathematica 9, it gives the same result as yours this time. – Hao Wu Apr 22 '14 at 12:54