# Problems with integrating over a region

Following the example of this answer:

Find the volume of the region defined by $|x|+|y|+|z|<4$

I tried to compute the following integral over a region by using ImplicitRegion. However, when I integrate a function which is non-negative over the region I am getting a negative answer. What is wrong with my code? Here is a simplified example of my problem:

Integrate[(y - 1/2) - (x + t),
Element[{x, y, t},
ImplicitRegion[{(y - 1/2) - (x + t) > 0,
x - y > 0}, {{x, -1, 1}, {t, -1, 1}, {y, -1, 1}}]]]


Inside the implicit region, $(y - 1/2) - (x + t)$ (the integrand) is positive, but mathematica outputs the answer is

-39/128.

You need to be consistent with the order of the variables defining the region:

region = ImplicitRegion[{(y - 1/2) - (x + t) > 0, x - y > 0},
{{x, -1, 1}, {t, -1, 1}, {y, -1, 1}}]

Integrate[(y - 1/2) - (x + t), Element[{x, t, y}, region]]
(* 5/128 *)


Check:

Integrate[1, Element[{x, t, y}, region]]
(* 11/48 *)

RegionMeasure[region]
(* 11/48 *)


For the cited problem:

Integrate[
If[Abs[x] + Abs[y] + Abs[z] < 4, 1, 0],
{x, -4, 4},
{y, -4, 4},
{z, -4, 4}]


(* 256/3 *)

RegionPlot3D[Abs[x] + Abs[y] + Abs[z] < 4,
{x, -4, 4},
{y, -4, 4},
{z, -4, 4},
PlotPoints -> 50]


For this problem:

Integrate[
If[(y - 1/2) - (x + t) > 0 && x - y > 0, (y - 1/2) - (x + t), 0],
{x, -1, 1},
{t, -1, 1},
{y, -1, 1}]


(* 5/128 *)

• Of course, Iverson brackets (Boole[]) are what usually stand in for the If[] statement these days. – J. M.'s ennui May 18 '16 at 0:03