I need to calculate the following singular integral:

NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1}]

However, it is failing to converge. I have tried to specify MaxRecursion, PrecisionGoal, and Exclusions but neither helped. How does one calculate singular integrals in Mathematica?


1 Answer 1


As it stands the integral does not converge! To see that note that

Series[Log[1 + y^2]/Cos[Pi y], {y, 1/2, 0}]

returns $$-\frac{\log \left(\frac{5}{4}\right)}{\pi \left(y-\frac{1}{2}\right)}-\frac{4}{5 \pi }+O\left(y-\frac{1}{2}\right)$$

and a simple pole is not integrable.

What you maybe want to know is Cauchy's principal value of the integral (which is finite). For that, evaluate

NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1/2, 1}, Method -> "PrincipalValue"]

which returns -0.281589.

  • 2
    $\begingroup$ Same with NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1}, Method -> "PrincipalValue", Exclusions -> {1/2}] $\endgroup$ Dec 13, 2012 at 12:51

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.