Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer
Same with NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1}, Method -> "PrincipalValue", Exclusions -> {1/2}] – b.gatessucks Dec 13 '12 at 12:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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