7
$\begingroup$

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}]

Mathematica answers

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[10];
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?

$\endgroup$
  • $\begingroup$ What do you mean by Mathematica answers RFalse[x_,y_]=Pi(1/(8y)-(3y)/(8x^2))? That's quite a strange answer! $\endgroup$ – Dr. belisarius Apr 24 '15 at 13:47
  • $\begingroup$ Also, just in case, your Integrate[ ] has a syntax error. I'm downvoting until you correct it $\endgroup$ – Dr. belisarius Apr 24 '15 at 13:51
  • $\begingroup$ 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)) $\endgroup$ – Bob Hanlon Apr 24 '15 at 13:52
  • $\begingroup$ @BobHanlon I posted that as an answer a few seconds after your comment. Deleting $\endgroup$ – Dr. belisarius Apr 24 '15 at 13:54
  • 3
    $\begingroup$ I don't think this question should be closed. The OP has found a real bug in V10.0.x, $\endgroup$ – m_goldberg Apr 24 '15 at 16:23
5
$\begingroup$
$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))

$\endgroup$
  • $\begingroup$ So is this a bug? $\endgroup$ – LLlAMnYP Apr 24 '15 at 15:34
  • 3
    $\begingroup$ @LLlAMnYP - Looks like one to me, but I never studied entomology. $\endgroup$ – Bob Hanlon Apr 24 '15 at 15:38
  • $\begingroup$ Thank you for confirming this and for the workaround. $\endgroup$ – Daniele Binosi Apr 24 '15 at 16:17
3
$\begingroup$

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},
  Assumptions -> {x > 0, y > 0, x > y}]
-((π y)/(4 x^2))
$\endgroup$
  • $\begingroup$ Also version 8 for the Mac was free of the bug. $\endgroup$ – Daniele Binosi Apr 24 '15 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.