# Integration over region given by inequality [duplicate]

Sometimes we need to integrate over some bounded region given by inequality/inequalities. Consider the following simplest example of area of an ellipse (LaTeX code):

$\int_S dx dy$, where $S = \{ x^2/a^2 + y^2/b^2 \leq 1\}$.

Is it possible to do this directly in Mathematica? If possible, how to do it?

• Welcome to Mathematica.SE!. Please, post the Mathematica code you tried. Feb 10, 2013 at 21:52
• Check the > Scope > Integrals over Regions part of the Integrate documentation for some examples
– ssch
Feb 10, 2013 at 21:56
• Feb 10, 2013 at 22:18
• @ssch Oh, I didn't realize there is a tutorial on this topic. I only searched the examples in vain. Thanks. Feb 10, 2013 at 22:30
• I think this question puts the issue more clearly and concisely than the referenced question that it allegedly duplicates. Feb 11, 2013 at 0:51

Integrate[Boole[x^2/a^2 + y^2/b^2 <= 1], {x, -a, a}, {y, -b, b},

Function Boole delineates the region; the Assumptions option is needed for symbolic a and b in order to allow Mathematica actually to evaluate the integral; if a and b are numeric, that option is superfluous.
• If you integrate over the entire plane Integrate[ Boole[x^2/a^2 + y^2/b^2 <= 1],{x,-Infinity,Infinity}, {y, -Infinity, Infinity}] it will still get evaluated but return a Piecewise with conditions on a and b
• @ssch: Yes, but I was trying to avoid any problems (which don't arise in this particular example) with behavior at infinity. I don't know whether that's a concern in a more general situation: I'd expect the Boole expression to prevent problems, but will it always -- what does Mathematica actually do here? Feb 11, 2013 at 14:14