I want to analyse the convergence of some complicated 1d integrals that may have divergences at $x=0$, similarly to the harmonic integral $\int_0^a 1/x \ \mathbb{d} x$, which I know is divergent. When I try


Mathematica neither solves the integral, nor tell it is divergent. If I try

Integrate[1/x, x]

It gives the correct answer, $log(x)$, however when I try to numerically calculate the integral with

NIntegrate[1/x, {x, 0, 10}]

It gives no error or warning message, rather a finite result! I tried to play with PrecisionGoal but I still couldn't get any error. Is there a way for Mathematica to spot more accurately non convergent integrals? The integrals I want to analyse might suffer from the same issues and have no analytical solution, so I am afraid I might not spot the divergences.

  • 1
    $\begingroup$ On MMA 13.0: Integrate[1/x, {x, 0, 10}] give me: "Integral of 1/x does not converge on {0,10}". This message is generated when the indicated definite integral does not converge. $\endgroup$ May 13, 2022 at 12:08
  • $\begingroup$ I have mathematica 12, maybe that's what happening? $\endgroup$
    – user404720
    May 13, 2022 at 12:12
  • 1
    $\begingroup$ Also in 13: NIntegrate[1/x, {x, 0, 10}] says "NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections.... " Limit[Integrate[1/x, {x, ep, 10}], ep -> 0] returns "Indeterminate". $\endgroup$
    – bill s
    May 13, 2022 at 14:18
  • $\begingroup$ Thanks! I updated to Mathematica 13 and now I do get these messages, so I definitely think it was an issue of Mathematica 12 $\endgroup$
    – user404720
    May 13, 2022 at 15:17


Your Answer

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