7
$\begingroup$

I was doing a calculation that involved integrating rational functions over a triangular region, and eventually noticed some of my results didn't make any sense. After some investigating, I was able to track it down to

Integrate[1/x, {x, y} \[Element] Triangle[{{0, 0}, {1, 0}, {0, 1}}]]

> -1

which is a strange answer. It emits no warnings about nonconvergence, either. Is there some way to work around this issue and help Mathematica alert me when I'm asking to Integrate[] over a region, but the integral doesn't converge?

$\endgroup$
10
  • $\begingroup$ Mathematica v12.2 evaluates \[Infinity] $\endgroup$ Commented Mar 7 at 16:51
  • $\begingroup$ Please don't use the bugs tag: The tag wiki says: "This tag is reserved for questions where the problem has been vetted by this community and the observed behavior is confirmed to be a bug. Please do not use this tag for new questions." That said, if this really does spit out -1, then that is likely a bug. $\endgroup$
    – march
    Commented Mar 7 at 17:39
  • 2
    $\begingroup$ intg = With[{ϵ = t}, Integrate[ 1/x, {x, y} ∈ Triangle[{{ϵ, ϵ}, {ϵ, 1}, {1, ϵ}}]] ]; intg = FullSimplify[intg, t >= 0] Then you can do Limit[intg, t -> 0]. Your code outputs -1 on MMA 14.0 on windows, so looks like a bug. $\endgroup$
    – flinty
    Commented Mar 7 at 17:41
  • 3
    $\begingroup$ I reported this as a bug. $\endgroup$ Commented Mar 7 at 19:08
  • 1
    $\begingroup$ f[ϵ_] := Integrate[ 1/x, {x, y} ∈ Polygon[{{ϵ, 0}, {1, 0}, {ϵ, 1}}], Assumptions -> ϵ > 0]; Limit[f[ϵ], ϵ -> 0] (* ∞ *) I think maybe Mathematica use Legesgue Integral instead of Riemannian Integral $\endgroup$
    – cvgmt
    Commented Mar 7 at 23:43

1 Answer 1

0
$\begingroup$

The answer $-1$ is strange indeed. I would expect Mathematica to blindly apply consecutive integration to get '' $$ \int_0^1 \int_0^x \frac 1x dy \,dx = \int_0^1[y/x]_{y=0}^{y=x}dx = \int_0^1 1 dx = 1 $$ '' which is still a wrong result... In fact, the existence of the iterated integrals does not guarantee the existence of the double integral. The other order of integration gives you ''$$ \int_0^1\int_0^y \frac 1x dx\,dy=\int_0^1[\log x]_{x=0}^{x=y} \,dy $$''

Depending on your application, a possible remedy could be to use NIntegrate[] instead of Integrate[]. It still gives a bogus final result, but alerts you for possible non-convergence.

$\endgroup$
2
  • 2
    $\begingroup$ Although probably a correct assessment, this does not appear to answer the question. $\endgroup$
    – bbgodfrey
    Commented Mar 8 at 15:59
  • $\begingroup$ @bbgodfrey It does give a partial answer... Using NIntegrate[] instead of Integrate[] produces a warning regarding convergence problems. If this is a viable fix or not is up to the OP, as he did not disclose the exact appication. $\endgroup$ Commented Mar 8 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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