3
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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 *)
$\endgroup$
0
$\begingroup$

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]

enter image description here

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 *)

$\endgroup$
  • $\begingroup$ Of course, Iverson brackets (Boole[]) are what usually stand in for the If[] statement these days. $\endgroup$ – J. M. will be back soon May 18 '16 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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