1
$\begingroup$

How can I evaluate a double integral over a region in Mathematica?

For example

$\qquad \iint(x^4+y^2)\,dx\,dy$

for the bounded region $y=x^2$ and $y=x^3$

$\endgroup$
  • $\begingroup$ Have you looked at Integrate? Also, is it supposed to be $y<=x^{2}$ and $y>=x^{3}$. $\endgroup$ – Edmund Dec 10 '15 at 15:47
  • 2
    $\begingroup$ @Nehorai, did you see that question? $\endgroup$ – garej Dec 10 '15 at 15:48
  • $\begingroup$ @garej Yes,I saw this I'm very new in Mathematica so I started with this f[x_,y_]=x^4+y^2; Integrate[f[x,y]*Boole[]] $\endgroup$ – 3SAT Dec 10 '15 at 15:50
  • $\begingroup$ but how can I input the region? $\endgroup$ – 3SAT Dec 10 '15 at 15:52
  • $\begingroup$ @Nehorai, i.e. this way: Integrate[f[x, y]*Boole[{y < x^2 && y > x^3}], {x, 0, 1}, {y, 0, 10}]. $\endgroup$ – garej Dec 10 '15 at 16:17
3
$\begingroup$

In this case, we can look at the region in question and figure it out. The only closed region to integrate would be between x=0 and x=1,

Plot[{x^2, x^3}, {x, 0, 1}, Filling -> {1 -> {2}}]

enter image description here

So you can restrict the x range of the integral to {0,1}, and then the limits for the y integral are the lower and upper curve,

$$ \int_0^1 dx \int_{x^3}^{x^2} dy \,\, x^4+y^2 $$

Integrate[x^4 + y^2, {x, 0, 1}, {y, x^3, x^2}]
(* 9/280 *)

As pointed out by Artes, the order of integration can be reversed, by writing

$$ \int_0^1 dy \int_{y^{1/2}}^{y^{1/3}} dy \,\, x^4+y^2 $$

Integrate[x^4 + y^2, {y, 0, 1}, {x, y^(1/2), y^(1/3)}]
(* 9/280 *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Change the order of integration with respect to x and y and you'll get different values. So I don't find your answer sufficiently rigorous. I'd rather mention somtheing like here Integrate not restricting variable with Assumptions option?. By the way, isn't it a duplicate? $\endgroup$ – Artes Dec 10 '15 at 16:11
  • $\begingroup$ What do you mean get different values, Integrate[x^4 + y^2, {x, 0, 1}, {y, x^3, x^2}] == Integrate[Integrate[x^4 + y^2, {y, x^3, x^2}], {x, 0, 1}] evaluates to True. Edit: um, forget I said that, since Mma actually evaluates the limits in reverse order $\endgroup$ – Jason B. Dec 10 '15 at 16:15
  • $\begingroup$ Something like this Integrate[x^4 + y^2, {y, x^3, x^2}, {x, 0, 1}]. $\endgroup$ – Artes Dec 10 '15 at 16:16
  • $\begingroup$ @Artes, I see your point, modified the answer. The question linked to in the comments above uses Boole in the answer, which is overkill in this situation, in my opinion. $\endgroup$ – Jason B. Dec 10 '15 at 16:27
  • 5
    $\begingroup$ Integrate[x^4 + y^2, {x, y} ∈ ImplicitRegion[x^3 < y < x^2 && x > 0, {x, y}]] is an alternative. $\endgroup$ – J. M.'s technical difficulties Dec 10 '15 at 16:48

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