I just learned about the Inverse Symbolic Calculator and it seems like a very useful tool. For example, to find an analytic solution to

$$ \int_0^{\infty } \frac{1-e^{-x} (x+1)}{\left(e^x-1\right) \left(e^{-x}+e^x\right) x} \, dx, $$

one can solve it numerically to obtain


and submit this to the Calculator to obtain the analytic expression

$$ -\frac{\gamma }{2}+\frac{\pi }{8}-\frac{1}{4} 3 \log (2)+\frac{\log (\pi )}{2}. $$


However, I'm having trouble reproducing this result, i.e., using NIntegrate with the right settings for WorkingPrecision, AccuracyGoal, and PrecisionGoal to obtain the numerical result above.

I eventually found that

NIntegrate[(1 - Exp[-x] (1 + x))/(x (Exp[x] - 1) (Exp[x] + Exp[-x])), 
    {x, 0, Infinity}, WorkingPrecision -> 40, AccuracyGoal -> 25]



which the Calculator can't find an analytic form for, but if I chop off the last several digits and submit instead


then the Calculator finds the correct analytic expression.

This took a lot of guess-and-check, and I would like to know if there is a more sure-fire way to get a bunch of digits out of NIntegrate to look up analytic expressions like this.

(I've read the docs on PrecisionGoal and AccuracyGoal as well as this MSE link.)

  • $\begingroup$ As it turns out, your result is accurate to 34 or so digits when compared to -EulerGamma/2 + π/8 - 3 Log[2]/4 + Log[π]/2. Anyway: Method -> "DoubleExponential" gives good results for integrals like this. A rule of thumb you can use is that you can set AccuracyGoal up to ten less than the WorkingPrecision setting. Thus, you could try SetPrecision[ NIntegrate[(1 - Exp[-x] (1 + x))/(2 x (Exp[x] - 1) Cosh[x]), {x, 0, ∞}, AccuracyGoal -> 35, Method -> "DoubleExponential", WorkingPrecision -> 45], 35]. $\endgroup$ – J. M.'s torpor Jun 14 '16 at 0:20
  • $\begingroup$ Thank you very much for your thorough comment! I'd be happy to consider this an answer if you feel like submitting it as one. $\endgroup$ – ConvexMartian Jun 14 '16 at 19:03

Your Answer

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

Browse other questions tagged or ask your own question.