Can't compute a double integral by using If command with Mathematica 10.2

I used to do this computation with Mathematica 9.0:

Hold[Simplify[Integrate[Integrate[
If[{x^2/a^2 + y^2/b^2 <= 1}, 1, 0],
{y, -Infinity, Plus[Infinity]}],
{x, -Infinity, Plus[Infinity]}], {a > 0, b > 0}]]

or alternative notation

Simplify[\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(-\[Infinity]\), \(+\[Infinity]\)]\(\((
\*SubsuperscriptBox[\(\[Integral]\), \(-\[Infinity]\), \(+\[Infinity]\)]\((If[{x^2/a^2 + y^2/b^2 <= 1}, 1, \.010])\) \[DifferentialD]y)\) \[DifferentialD]x\)\), {a >    0, b > 0}]  

and get a b Pi. However when I try to compute the same on Mathematica 10.2, it gets stuck. What’s going on? Thank your for your valuable time.

It looks like you were trying to paste Traditional Math notation.

Please run Hold and InputForm on your integral:

putYourIntegralHere//Hold//InputForm

This will show the actual code that you are using, which you can then post here.

Thank your for your valuable time. There you go:

Hold[Simplify[Integrate[Integrate[
If[{x^2/a^2 + y^2/b^2 <= 1}, 1, 0],
{y, -Infinity, Plus[Infinity]}],
{x, -Infinity, Plus[Infinity]}], {a > 0, b > 0}]]

Best regards,
Juan F. Avila

In[2]:= Integrate[
If[x^2/a^2 + y^2/b^2 <= 1, 1, 0], {y, -Infinity,
Infinity}, {x, -Infinity, Infinity}]

Out[2]= \[Pi]/Sqrt[1/(a^2 b^2)]

In 10.1

In[1]:= Simplify[Integrate[Integrate[If[{x^2/a^2+y^2/b^2<=1},1,0], {y,-Infinity,Infinity}], {x,-Infinity,Infinity}], {a>0,b>0}]

Out[1]= a b Pi

In[2]:= Simplify[Integrate[Integrate[If[x^2/a^2+y^2/b^2<=1,1,0], {y,-Infinity,Infinity}], {x,-Infinity,Infinity}], {a>0,b>0}]

Out[2]= a b Pi

In[3]:= Simplify[Integrate[Integrate[Boole[x^2/a^2+y^2/b^2<=1], {y,-Infinity,Infinity}], {x,-Infinity,Infinity}], {a>0,b>0}]

Out[3]= a b Pi

In[4]:= Simplify[Integrate[Integrate[Piecewise[{{1,x^2/a^2+y^2/b^2<=1}}, 0], {y,-Infinity,Infinity}], {x,-Infinity,Infinity}], {a>0,b>0}]

Out[4]= a b Pi

In[5]:= Simplify[Integrate[Integrate[Which[x^2/a^2+y^2/b^2<=1,1,True,0], {y,-Infinity,Infinity}], {x,-Infinity,Infinity}], {a>0,b>0}]

Out[5]= a b Pi

Try copying some of the code people posted below. Do you get the same resutls? If not, please run “Quit” to make sure that the kernel is fresh and has no previously defined values.