9
$\begingroup$

Given in my homework I have to compute (by hand) $$\iint\limits_{x^2+y^2\leq 1}(x^2+y^2)\,\mathrm dx\,\,\mathrm dy.$$ My solution so far: Let $f(x,y)=x^2+y^2$ and $K=\{(x,y)\in\mathbb{R}^2:x^2+y^2\leq 1\}$. With the transformation of polar coordinates $\varphi:(r,\phi)\mapsto(r\cdot\cos\phi,r\cdot\sin\phi)=(x,y)$ and the determinant of the Jacobian matrix $|\det D_\varphi|=r$ we can rewrite the set as $K=\{(r\cdot\cos\phi,r\cdot\sin\phi):r\in[0,1],\phi\in[0,2\pi]\}$ and our integrand too as $f(x,y)=x^2+y^2=r^2$. $$\iint\limits_K f(x,y)\,\mathrm dx\,\mathrm dy=\int\limits_0^1\int\limits_0^{2\pi}r^2\cdot |\det D_\varphi|\,\mathrm d\phi\,\mathrm dr=2\pi\int\limits_0^1r^3\,\mathrm dr=\left.2\pi\cdot\frac{1}{4}r^4\right|_0^1=\frac{\pi}{2}.$$

I now want to check the result with a CAS. I am pretty new to Mathematica so I just didn't found any clue on how to enter such an integral for computation. Any help out there?

$\endgroup$
0

2 Answers 2

16
$\begingroup$

In Mathematica:

Integrate[Integrate[x^2 + y^2, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}], {y, -1, 1}]

Or, shorter:

Integrate[x^2 + y^2, {y, -1, 1}, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}]

The main trick is to calculate the bound on $x$ based on the current value of $y$, which is what you need to make the integration bounds explicit. Indeed, $x_{max}=\sqrt{1-y^2}$. This is something you can do in most integral-calculating math software.

You can also define the region implicitly, see this.

For this specific problem, that would give:

Integrate[(x^2 + y^2) Boole[x^2 + y^2 <= 1], {y, -100, 100}, {x, -100, 100}]

Where the "100" bounds are just to limit the computation. However, Mathematica is even smart enough to calculate:

Integrate[(x^2 + y^2) Boole[x^2 + y^2 <= 1], {y, -Infinity, 
  Infinity}, {x, -Infinity, Infinity}]
$\endgroup$
4
  • $\begingroup$ Rather than writing this particular problem as an iterated integral, I wonder if it could be written as a "pure" double integral. Not all double integrals can be simply written as iterated integrals. $\endgroup$
    – Ragib Zaman
    Jun 7, 2012 at 12:27
  • $\begingroup$ The last version with Integrate[(x^2 + y^2) Boole[x^2 + y^2 <= 1], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}] is awesome. I will stick to the Boole function. $\endgroup$ Jun 7, 2012 at 12:34
  • $\begingroup$ You're indeed supposed to be using infinite limits when using the Boole[] form of the integral; the assumption is that the integrand is zero outside the boundary described within the Boole[] function, so it all works out. $\endgroup$ Jun 10, 2012 at 11:48
  • $\begingroup$ For checking a paper-and-pencil evaluation, definitely the method using Boole is the way to go: that way, if you incorrectly described the limits on x in terms of y (or vice versa) by hand, you wouldn't repeat the same error when doing the Mathematica evaluation. $\endgroup$
    – murray
    Jun 10, 2012 at 20:26
6
$\begingroup$

As noted, Boole[] is the go-to method for older versions of Mathematica. Now, thanks to version 10's support for regions, one can easily enter

Integrate[x^2 + y^2, {x, y} ∈ ImplicitRegion[x^2 + y^2 <= 1, {x, y}]]

to obtain the expected answer.

$\endgroup$
1
  • 2
    $\begingroup$ Or in this case you could use a special region: Integrate[x^2 + y^2, {x, y} ∈ Disk[]]. $\endgroup$
    – Greg Hurst
    Oct 15, 2015 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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