Integrand produced a NaN. Domain error using QuadGK

leopdsf
Fri, 30 Apr 2021 02:45:51 +0000
General Usage

Hello, everyone. I’m trying to solve numerically the following integral:

\int _{-\infty} ^{\infty} \exp(-z^2/2)\ln(2\cosh(z)) dz = 2.67636.

For that, I write the following

using QuadGK

f3(z) = exp(-z^2/2)*log(2*cosh(z))
V = quadgk(f3,-Inf,Inf)

but I receive the following error message

DomainError with -0.9375:
integrand produced NaN in the interval (-1.0, -0.875)

I’m not being able to understand why I receive this, since the integral converge. Can anyone help?

4 posts - 2 participants