# Problem with Numerical integration due to singularity

I am trying to solve an integral numerically in Mathematica. The integrand is

x^2/((1-x^4)Sqrt[xm^4(1-xm^4)-x^4(1-x^4)]),


with lower limits: x = xm, and upper limit x = Infinity. Where xm=((1+Sqrt[1-a^2])/2)^(1/4) and a is any constant lets say a=0.2.

Using NIntegrate in Mathematica I got an error

"Integrate failed to converge to prescribed accuracy after 50 \ recursive bisections in x near {x} = \ {1.0000000000000000010207139609231930075006998480154358397633601823358\ 2911765290712976879587123209719525842623480662534192183469748716277627\ 1045933514870560125091416879336103379976452739253556510672066452891154\ 3397372398189215735216474671862275042165790}."

Can anybody please explain to me what is the main problem here, and how to minimize the above error massage and find the correct answer.

Thanks.

• Could you please provide your Mathematica code? Thanks – Ulrich Neumann Jul 18 '18 at 10:14
• I am using this code: CV[a_?NumberQ] := NIntegrate[( a x^2)/([Pi] (1 - x^4) Sqrt[ 1/2 (1 + Sqrt[1 - a^2]) (1 + 1/2 (-1 - Sqrt[1 - a^2])) - x^4 (1 - x^4)]), {x, ((1 + Sqrt[1 - a^2])/2)^(1/( n - 1)), ((1 + Sqrt[1 - a^2])/2)^(1/(n - 1)), Infinity}, WorkingPrecision -> 200, MaxRecursion -> 50] – rickys Jul 18 '18 at 10:16
• Just edit your question, please. If you indent 4 characters one can "see" mathematica code for further use. – Ulrich Neumann Jul 18 '18 at 10:21
• The main problem seems to be a singularity of the integrand x->xm – Ulrich Neumann Jul 18 '18 at 10:23
• @UlrichNeumann, yes. – rickys Jul 18 '18 at 10:37

To long for a comment...

Using PrincipalValue proposed by user64494 directly

NIntegrate[x^2/((1 - x^4) Sqrt[xm^4 (1 - xm^4) - x^4 (1 - x^4)]), {x, xm,Infinity} , Method -> "PrincipalValue", Exclusions -> {1, xm}]
(*0.663908*)


gives the desired result for the integral!

• Thanks :). It works. – rickys Jul 18 '18 at 13:49

This is an imroper integral over an infinite ray and the integrand has singularities at x==1 and at x==xm. Moreover, there exists its principal value only because of the singularity at x==1. The following works.

a = 0.2;xm = ((1 + Sqrt[1 - a^2])/2)^(1/4)


0.997465B

We split the integral into two items:

NIntegrate[x^2/((1 - x^4) Sqrt[xm^4 (1 - xm^4) - x^4 (1 - x^4)]), {x,xm, 5},
WorkingPrecision -> 35, Method -> "PrincipalValue", Exclusions -> {1}]+
NIntegrate[x^2/((1-x^4) Sqrt[xm^4 (1 - xm^4) - x^4 (1 - x^4)]),{x,5,Infinity},
WorkingPrecision ->35, AccuracyGoal -> 5, Method -> "GlobalAdaptive"]


0.6639079212365501863627942458541675 - 2.863389453924790530558107241*10^-7 I

Addition. In response to the Ulrich Neumann's comment, let us consider

ClearAll["Global*"];
Series[x^2/((1 - x^4)*Sqrt[xm^4*(1 - xm^4) - x^4 (1 - x^4)]),{x, xm,1}, Assumptions->x > xm]


$$-\frac{\text{xm}^2}{2 \left(\left(\text{xm}^4-1\right) \sqrt{\text{xm}^3 \left(2 \text{xm}^4-1\right)}\right) \sqrt{x-\text{xm}}}+\frac{\left(30 \text{xm}^9-9 \text{xm}^5-5 \text{xm}\right) \sqrt{x-\text{xm}}}{8 \left(\text{xm}^4-1\right)^2 \left(2 \text{xm}^4-1\right) \sqrt{\text{xm}^3 \left(2 \text{xm}^4-1\right)}}+O\left((x-\text{xm})^{3/2}\right)$$

and

Series[x^2/((1 - x^4) Sqrt[xm^4 (1 - xm^4) - x^4 (1 - x^4)]), {x,Infinity, 2}]
`

$O\left(\left(\frac{1}{x}\right)^6\right)$

Therefore, the integral under consideration converges.

• No it doesn't converge. If you change WorkingPrecision you get other results. – Ulrich Neumann Jul 18 '18 at 10:36
• @Ulrich Neumann: Many thanks from me to you for your valuable comment. I based the convergence and corrected the value. – user64494 Jul 18 '18 at 11:08
• @user64494: The result highly fluctuates by changing the WorkingPrecision to a different value using your method. – rickys Jul 18 '18 at 11:34
• @rickys: Thank you. I noticed that the integral exists only as its principal value and modified my answer. – user64494 Jul 18 '18 at 11:47
• @rickys: Sorry, I obtain no communication in version 11.3. Can you support your claim by an nb file with the executed code (eg through Dropbox) as solid people use to do? – user64494 Jul 18 '18 at 14:35