# Integration over region given by inequality [duplicate]

This question already has an answer here:

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?

-

## marked as duplicate by Sjoerd C. de Vries, Daniel Lichtblau, rcollyer, whuber, The Toad♦Feb 11 '13 at 19:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

## 1 Answer

Explicitly:

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


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 Feb 10 '13 at 22:19
@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? –  murray Feb 11 '13 at 14:14