# Why does Mathematica spit this back out?

I'm struggling with the integral, $$\iint\sqrt{4a^2-x^2-y^2}dxdy$$ taken over the upper half disk of radius a centered at (a, 0).

When I type it into Mathematica (10.2), Mathematica spits it back out. Here's my code.

Integrate[Sqrt[4a^2-x^2-y^2]Boole[x^2+y^2<2a x], {x, 0, 2a}, {y, 0, a}]


The output Mathematica produces is just the fancy version (2 dimensional) of this. This integration is easy, I've even done it by hand. Why can't Mathematica do it?

• You could put a Assumptions -> a > 0 as an option. Dec 10, 2015 at 19:40
• Well, unlike Mathematica, you assume that $a$ is real and positive, no? (Thus, follow wxffles's suggestion.) Dec 10, 2015 at 19:55

As J.M. noted, when you do it by hand, you presume that you are working with real variables and, probably, that a > 0. Mathematica doesn't make such assumptions by default, so you need to give it a hint.

For example,

Integrate[Sqrt[4 a^2 - x^2 - y^2] Boole[x^2 + y^2 < 2 a x],
{x, 0, 2 a}, {y, 0, a}, Assumptions -> a > 0]


will give

4/9 a^3 (-4 + 3 π)


which is perhaps what you are expecting.

Another way of writing this integral in Mathematica is

Integrate[Sqrt[4 a^2 - x^2 - y^2],
{x, y} ∈ ImplicitRegion[x^2 + y^2 < 2 a x && y > 0, {x, y}]]


Here the necessary assumptions are implicit in the region expression and a more complete answer is given.

This gives the result without assumptions:

Integrate[Sqrt[4 a^2 - x^2 - y^2] , Element[{x, y},
RegionIntersection[Disk[{a, 0}, a], ImplicitRegion[y > 0, {x, y}]]]]


Piecewise[{{(4*a^3*(-4 + 3*Pi))/9, a > 0}}, 0]

(A little bit faster than the Boole approach as well )

reg = ImplicitRegion[(x - a)^2 + y^2 <= a^2 && 0 <= y <= a, {x, y}]
Integrate[Sqrt[4*a^2 - x^2 - y^2], {x, y} \[Element] reg, Assumptions -> a > 0]

4/9 a^3 (-4 + 3 Pi)


Interestingly, this should also work, but it runs forever!

reg = Disk[{a, 0}, a, {0, Pi}]
Integrate[Sqrt[4*a^2 - x^2 - y^2], {x, y} \[Element] reg, Assumptions -> a > 0]

• This doesn't seem to be an answer; merely an observation. Dec 11, 2015 at 11:44