0

I wanted to verify the integral $\int\limits_0^{2\pi}\frac{d\phi}{(a^2+b^2)+(a^2-b^2)\cos(n\phi)}=\frac{\pi}{ab}$ (where $b>a>0$ and $n$ is a positive integer).

Individual values of $n$ work:

$Assumptions = {b > a > 0};

Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[x]), {x, 0, 2Pi}]
*** Pi/(ab) *** 

Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[2 x]), {x, 0, 2Pi}]
*** Pi/(ab) *** 

Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[3 x]), {x, 0, 2Pi}]
*** Pi/(ab) ***

and so on.

But then, when I want to solve it for general $n$, I get:

$Assumptions = {b > a > 0, n \[Element] Integers, n >= 1};

Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[n x]), {x, 0, 2 Pi}]]
*** Pi/(abn) ***

What is going on? (I'm using 11.0.1.0 on OSX.)

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Ziofil
  • 2,470
  • 16
  • 30
  • 1
    Please don't use the [tag:bugs] tag when asking new questions (see tag description). – Szabolcs Aug 02 '17 at 18:25
  • Understood, thanks. – Ziofil Aug 02 '17 at 18:39
  • I'm not sure this is the issue, but I noticed you wrote $cos^2$ initially but cos[] (not squared) in the code. – FalafelPita Aug 02 '17 at 18:39
  • Oh, that's a typo, I'll fix it now, thanks. – Ziofil Aug 02 '17 at 18:40
  • 3
    When I did Block[{$Assumptions = {b > a > 0, n \[Element] Integers, n >= 1}} , Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[n x]), {x, 0, 2 Pi}]], I got 0. (v10.0 on Mac OSX). – march Aug 02 '17 at 18:41
  • 3
    Even without Block I get zero for v 11.1.1 on Windows 10. – bbgodfrey Aug 02 '17 at 18:48
  • 2
    Furthermore, Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[n x]), {x, 0, 2 Pi}, Assumptions -> {a ∈ Reals, b ∈ Reals, n ∈ Integers, n >= 1}], followed byFullSimplify[%, {b > a > 0, n ∈ Integers, n >= 1}]givesπ/(a b n), not0. Also,GenerateConditions -> True` doesn't. Looks like a bug to me. – bbgodfrey Aug 02 '17 at 19:04
  • 1
    Bug still present in MMA 11.2.0 – user58955 Sep 19 '17 at 14:56

1 Answers1

5

There are similar integrals with bugs, some of which have been fixed, such as Suspected bug in Integrate.

It seems that the branch cuts in the antiderivative are ignored, the antiderivative containing an ArcTan:

Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[n x]), x]
(*  ArcTan[(b Tan[(n x)/2])/a]/(a b n)  *)

One way to get the desired result is to integrate over just one period and multiply:

n*Integrate[1/((a^2 + b^2) + (a^2 - b^2) Cos[n x]), {x, 0, 2 Pi/n}, 
  Assumptions -> {b > a > 0, n ∈ Integers, n >= 1}]
(*  π/(a b)  *)

It should be reported to WRI, so that they might try to fix it.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • 2
    It's quite difficult to figure out or in other ways work with parametrized branch cuts. I would be surprised if this can be improved any time soon. – Daniel Lichtblau Aug 02 '17 at 22:17