# Principal Value Integration with NIntegrate [closed]

While trying to integrate numerically a function involving singularity (triple pole) I encounter some strange behaviour of Mathematica (I'm using Method -> "PrincipalValue"). Maybe someone can explain me what is going on.

In the Help there is an example

NIntegrate[Sqrt[x]/(x - 2), {x, 0, 2, 5}, Method -> "PrincipalValue"]


This works all right. Mathematica can also integrate 3rd order pole

In[38]:= NIntegrate[1/(x - 2)^3, {x, 0, 2, 5},
Method -> "PrincipalValue", AccuracyGoal -> 10]

Out[38]= 0.0694444


But slightly more complicated integral

NIntegrate[Sqrt[x]/(x - 2)^3, {x, 0, 2, 5},
Method -> "PrincipalValue"]


already fails to converge. Another working example

In[118]:=  NIntegrate[1/((-2 + x)^3  (64 + 36 x^2 - 20 x^3 +
3 x^4)), {x, 1, 2, 2.2}, Method -> "PrincipalValue",
AccuracyGoal -> 20]

Out[118]= -0.127563


but if I change it slightly

In[119]:=  NIntegrate[1/((-2 + x)^3  (64 + 36 x^2 - 20 x^3)), {x, 1,
2, 2.2}, Method -> "PrincipalValue", AccuracyGoal -> 20]


it fails again. I just don't understand what leads to this behaviour.

I tried many other examples. It seems that Method -> "PrincipalValue" doesn't always work for singularities other than logarithmic or simple poles. Why? Am I missing something important here or it's really Mathematica's fault?

Thanks!

-
"More complicated integral fails to converge" - try Integrate[Sqrt[x]/(x - 2)^3, {x, 0, 4}, PrincipalValue -> True] first, and report back. –  Ｊ. Ｍ. Mar 23 at 17:52
Integrate[Sqrt[x]/(x - 2)^3, {x, 0, 4}, PrincipalValue -> True] doesn't work, but it is true, that sometimes Mathematica can do integral analytically, while having problem with numerics (at least in my experience) –  Yegor Mar 23 at 18:09
Well, that's what NIntegrate[]'s options are for. You will often have to tweak options for integrals, since a method that works for integral so-and-so might fail spectacularly for a slight modification of said integral... –  Ｊ. Ｍ. Mar 23 at 18:11
Your "slightly more complicated interval" has a Cauchy principal value of $\infty$, so it's no surprise it fails to converge! Similarly, in the last example the "slight" change leads to an infinite principal value. The difference is fundamental, as you can see by plotting the polynomials 64 + 36 x^2 - 20 x^3 and 64 + 36 x^2 - 20 x^3 + 3 x^4 near $x=2$. I think you're just misunderstanding what a principal value is. –  whuber Mar 24 at 3:10
@whuber: Thank you for your comment! Now I see that for integrands involving the 3rd order pole like $\frac{f(x)}{(x-a)^3}$ it's really important what is the value of f'(a)! I was missing this point before! It seems that there is the whole field of hypersingular integrals dealing with such things... Today I've learned something. Thank you very much! –  Yegor Mar 24 at 14:08