# Computing integral over explicit region [closed]

I need to integrate $f(x,y)=y^2-2x^2y+6x^3-3xy+2y-6x$ over $\{y\geq 2x^2-2, y\leq 3x\}$

Im using Boole in the following way;

Integrate[y^2-2x^2y+6x^3-3*x*y+2y-6 Boole[y >= 2*x^2 - 2 && y <= 3*x], {x, -2, 2}, {y, -2, 2}]


But i dont get a result, nor an error.

-

## closed as off-topic by Artes, acl, Öskå, ubpdqn, Michael E2Jul 7 '14 at 12:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – acl, Öskå, ubpdqn, Michael E2
If this question can be reworded to fit the rules in the help center, please edit the question.

You are multiplying Boole[...] with 6, not f[x,y] That is, you should use Integrate[(y^2 - 2 x^2 y + 6 x^3 - 3*x*y + 2 y - 6 x) Boole[y >= 2*x^2 - 2 && y <= 3*x], {x, -2, 2}, {y, -2, 2}] . –  kglr Jul 7 '14 at 2:27
@kguler Fixed, but still, i dont get any result. –  Wyvern666 Jul 7 '14 at 2:29
I get (-3523519 + 1327104 Sqrt[2])/362880 (Mathematica Version 9.0.1.0 Windows 8 - 64 bit) .. You might want to try starting with a clean mma session. –  kglr Jul 7 '14 at 2:31
@kguler What should be in the limits {x, -a, b}, {y, -a, b} ?. I mean, i dont know the integration limits, and thats why i am trying to integrate over the region. –  Wyvern666 Jul 7 '14 at 2:34
@kguler Ha! I think "please start a clean session" ought to be our site's meme by now. –  belisarius Jul 7 '14 at 2:37

If I understand your question correctly - as judged from the text typed - the answer should read (writing - 6x instaed of just - 6 as some others have done, put the function in brackets before multiplying with Boole, also use +- Infinity which is better than some arbitrary (?) finite value like +-2)

Integrate[(y^2 - 2*x^2*y + 6*x^3 - 3*x*y + 2*y - 6*x)*
Boole[y >= 2*x^2 - 2 && y <= 3*x], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]

-(15625/2688)

 N[%]

-5.812872023809524


Best regards, Wolfgang

-
Thanks!, (you are right about the "6x"). –  Wyvern666 Jul 7 '14 at 15:46
Clear["Global*"]
expr = y^2 - 2 x^2 y + 6 x^3 - 3*x*y + 2 y - 6;
Integrate[
expr Boole[y >= 2*x^2 - 2 && y <= 3*x], {x, -Infinity, Infinity},
{y, -Infinity, Infinity}]


-(36625/2688)

Reduce[y >= 2*x^2 - 2 && y <= 3*x, y]


(x == -(1/2) && y == -(3/2)) || (-(1/2) < x < 2 && -2 + 2 x^2 <= y <= 3 x) || (x == 2 && y == 6)

Integrate[expr, {x, -1/2, 2}, {y, -2 + 2 x^2, 3 x}]


-(36625/2688)

-

Amplifying on the answer by Chenmingi: Boole will automatically restrict the integral to the appropriate region so you can integrate from -Infinity to Infinity for each of the variables.

int1 = Integrate[
(y^2 - 2 x^2 y + 6 x^3 - 3*x*y + 2 y - 6) *
Boole[y >= 2*x^2 - 2 && y <= 3*x], {x, -Infinity, Infinity}, {y, -Infinity,
Infinity}]


-(36625/2688)

int1 // N


-13.6254

You can restrict the integration region and get the same result as long as you don't miss any of the specified region -- visualize with Plot (or RegionPlot).

Plot[{2*x^2 - 2, 3 x}, {x, -1/2, 2},
PlotStyle -> Thick,
PlotLegends -> {2*x^2 - 2, 3 x},
Filling -> 1 -> {2},
Frame -> True, Axes -> False]


To get tight bounds

Solve[2*x^2 - 2 == 3 x, x]


{{x -> -(1/2)}, {x -> 2}}

Minimize[{2*x^2 - 2, -1/2 <= x <= 2}, x]


{-2, {x -> 0}}

Maximize[{2*x^2 - 2, -1/2 <= x <= 2}, x]


{6, {x -> 2}}

int1 == Integrate[
(y^2 - 2 x^2 y + 6 x^3 - 3*x*y + 2 y - 6)
Boole[y >= 2*x^2 - 2 && y <= 3*x],
{x, -1/2, 2}, {y, -2, 6}]


True

Alternatively, you can integrate over the exact region without using Boole:

int1 == Integrate[
y^2 - 2 x^2 y + 6 x^3 - 3*x*y + 2 y - 6 , {x, -1/2, 2}, {y, 2*x^2 - 2, 3 x}]
`

True

-