Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question

migrated from math.stackexchange.com Jun 10 '12 at 11:03

This question came from our site for people studying math at any level and professionals in related fields.

1 Answer 1

up vote 13 down vote accepted

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}]
share|improve this answer
    
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. –  Ragib Zaman Jun 7 '12 at 12:27
    
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. –  Christian Ivicevic Jun 7 '12 at 12:34
    
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. –  J. M. Jun 10 '12 at 11:48
    
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. –  murray Jun 10 '12 at 20:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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