# Integrate fails for generic parameters but works for any specific values (v. 10.0.x bug)

Bug introduced in 9.0 and fixed in 10.1

I was trying to get the following integral

Integrate[Sqrt[y/x] (Sin[t]^2 Cos[t])/(x+y+2 Sqrt[x y] Cos[t]), {t,0,Pi},
Assumptions -> {x > 0, y > 0, x > y}]


RFalse[x_,y_]=Pi(1/(8y)-(3y)/(8x^2))


This is wrong as the result is

RTrue[x_,y_]=-(Pi y)/(4x^2)


However, if one gives definite value for the parameters Mathematica calculates the integral correctly. Running

x1 = RandomReal[{10, 20}];
y1 = RandomReal;
Chop[Integrate[Sqrt[y1/x1] (Sin[t]^2 Cos[t])/(x1+y1+2 Sqrt[x1 y1] Cos[t]),
{t,0,Pi}]-RTrue[x1,y1]]==0


returns True, while

Chop[Integrate[Sqrt[y1/x1] (Sin[t]^2 Cos[t])/(x1+y1+2 Sqrt[x1 y1] Cos[t]),
{t,0,Pi}]-RFalse[x1,y1]]==0


returns False.

Many integrals of this type do not give the correct answer.

Any idea?

• What do you mean by Mathematica answers RFalse[x_,y_]=Pi(1/(8y)-(3y)/(8x^2))? That's quite a strange answer! – Dr. belisarius Apr 24 '15 at 13:47
• Also, just in case, your Integrate[ ] has a syntax error. I'm downvoting until you correct it – Dr. belisarius Apr 24 '15 at 13:51
• After correcting your integration expression to Integrate[Sqrt[y/x] (Sin[t]^2 Cos[t])/(x + y + 2 Sqrt[x y] Cos[t]), {t, 0, Pi}, Assumptions ->{x > 0, y > 0, x > y}] with version 10.1 I get the expected -((Pi*y)/(4*x^2)) – Bob Hanlon Apr 24 '15 at 13:52
• @BobHanlon I posted that as an answer a few seconds after your comment. Deleting – Dr. belisarius Apr 24 '15 at 13:54
• I don't think this question should be closed. The OP has found a real bug in V10.0.x, – m_goldberg Apr 24 '15 at 16:23

$Version  "10.0 for Mac OS X x86 (64-bit) (September 10, 2014)" As entered Mathematica returns the wrong result. Integrate[Sqrt[y/x] (Sin[t]^2 Cos[t])/(x + y + 2 Sqrt[x y] Cos[t]), {t, 0, Pi}, Assumptions -> {x > 0, y > 0, x > y}]  Pi*(1/(8*y) - (3*y)/(8*x^2)) However, a workaround is to convert the trig functions to exponentials Integrate[Sqrt[y/x] (Sin[t]^2 Cos[t])/(x + y + 2 Sqrt[x y] Cos[t]) // TrigToExp, {t, 0, Pi}, Assumptions -> {x > 0, y > 0, x > y}]  -((Pi*y)/(4*x^2)) • So is this a bug? – LLlAMnYP Apr 24 '15 at 15:34 • @LLlAMnYP - Looks like one to me, but I never studied entomology. – Bob Hanlon Apr 24 '15 at 15:38 • Thank you for confirming this and for the workaround. – Daniele Binosi Apr 24 '15 at 16:17 This appears to be a bug in V10.0.x which was fixed in V10.1.0. $Version

"10.1.0  for Mac OS X x86 (64-bit) (March 24, 2015)"

Integrate[Sqrt[y/x] (Sin[t]^2 Cos[t])/(x + y + 2 Sqrt[x y] Cos[t]), {t, 0, Pi},

-((π y)/(4 x^2))