9
$\begingroup$

Mathematica 9 says that $\int_0^1\int_0^1\int_0^1\frac{1.0}{xyz}\,dz\,dy\,dx=0$ and $\int_0^1\int_0^1\int_0^1\frac{1}{xyz}\,dz\,dy\,dx=0$.

Integrate[1.0/(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

I must be missing something obvious. What?

enter image description here

For what it’s worth, Wolfram Alpha gives the same incorrect answer if the numerator is $1.0$, but it correctly says the integral diverges when the numerator is $1$.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey May 20 '15 at 21:07
  • 1
    $\begingroup$ If you do: Integrate[1/(x y z), {x, a, 1}, {y, a, 1}, {z, a, 1}, Assumptions -> a \[Element] Reals] you get the following: ConditionalExpression[-Log[a]^3, 0 <= a < 1] Then take the limit as a->0 by doing: Limit[ConditionalExpression[-Log[a]^3, 0 <= a < 1], a -> 0] which gives infinity. Interesting that it gives zero, (Mathematica 10.1 does too) $\endgroup$ – Histograms May 20 '15 at 21:15
  • 1
    $\begingroup$ Mathematica is supposed to be able to handle improper integrals on its own, though. The documentation says “Integrate gives exact answers to many improper integrals,” though I guess that could leave open the possibility that it gives wrong answers to many improper integrals as well. $\endgroup$ – Steve Kass May 20 '15 at 21:17
  • 8
    $\begingroup$ It has to do with the default behavior of GenerateConditions in multivariate integrals. Setting it explicitly to True will help in this case. Some explanation may be found here or here. $\endgroup$ – Daniel Lichtblau May 20 '15 at 21:26
  • 2
    $\begingroup$ By the way, comments will go automatically only to original posters and whoever gave the particular response under which the comment appears. I only saw the answer request by accident. To reach anyone else e.g. another commenter, be sure to use the "at" sign to get their attention (it's kind of like raising from the spirit world, I think). $\endgroup$ – Daniel Lichtblau May 21 '15 at 15:59
10
$\begingroup$

It has to do with the default behavior of GenerateConditions in multivariate integrals. Setting it explicitly to True will help in this case. Some explanation may be found here or here.

The gist is that, for multiple integration, automatically checking conditions and issuing provisos for all but the final integration is typically both too costly (in speed) and too likely to create impediments to finishing the integration (due to overly difficult provisos). Integrate is reasonably capable of finding path singularities and issuing provisos to avoid them, but working with such provisos in subsequent integrations is not so simple. Also this is touched upon in the article found here.

$\endgroup$
  • $\begingroup$ Thanks, Daniel. I would only elaborate to say that Mathematica is plainly giving a wrong answer and should be fixed so it gives the right answer (that the integral does not converge). Your “has to do with the default behavior or GenerateConditions” not only clarifies that Mathematica’s answer is wrong, it provides a workaround to assist Mathematica in finding the correct answer. Of course, Wolfram should not have used an invalid solution method by default and left it up to the user to specify an obscure option to get a right answer. This is one of my great frustrations with Mathematica! $\endgroup$ – Steve Kass May 21 '15 at 17:34
  • 1
    $\begingroup$ Were that default behavior in Mathematica to change, many multivariate integrals it currently handles would simply hang. $\endgroup$ – Daniel Lichtblau May 21 '15 at 19:36
  • $\begingroup$ I should add that my remarks do not mean I am happy with the present situation regarding multivariate definite integrals. Just that there is no quick resolution in terms of Integrate internals. $\endgroup$ – Daniel Lichtblau May 22 '15 at 19:43
5
$\begingroup$

This s not an answer but an extended comment about results with v10.1

$Version

"10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)"

Integrate[1/(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

0

Integrate[1./(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

0

However,NIntegrate gives the a large result in either case with convergence warnings

NIntegrate[1/(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

enter image description here

3.884415286001312*^12

NIntegrate[1./(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

enter image description here

3.884415286001312*^12

Integrating over a region,

rgn = ImplicitRegion[
   0 <= x <= 1 && 0 <= y <= 1 && 0 <= z <= 1,
   {x, y, z}];

Integrate[1/(x y z), Element[{x, y, z}, rgn]]

0

Integrate[1./(x y z), Element[{x, y, z}, rgn]]

3.884415286001312*^12

This is the same result as with NIntegrate; however, without the convergence warning.

Following the advice of @Daniel Lichtblau to use GenerateConditions->True gives mixed results

Integrate[1/(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
 GenerateConditions -> True] 

enter image description here

Integrate[1/(xyz), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, GenerateConditions -> True]

Integrate[1./(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
 GenerateConditions -> True]

enter image description here

1.Integrate[1/(xy*z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, GenerateConditions -> True]

Integrate[1/(x y z), Element[{x, y, z}, rgn], GenerateConditions -> True]

Infinity

Integrate[1./(x y z), Element[{x, y, z}, rgn], GenerateConditions -> True]

3.884415286001312*^12

$\endgroup$

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.