0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Could you please provide your Mathematica code? Thanks $\endgroup$ – Ulrich Neumann Jul 18 '18 at 10:14
  • $\begingroup$ 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] $\endgroup$ – rickys Jul 18 '18 at 10:16
  • $\begingroup$ Just edit your question, please. If you indent 4 characters one can "see" mathematica code for further use. $\endgroup$ – Ulrich Neumann Jul 18 '18 at 10:21
  • $\begingroup$ The main problem seems to be a singularity of the integrand x->xm $\endgroup$ – Ulrich Neumann Jul 18 '18 at 10:23
  • $\begingroup$ @UlrichNeumann, yes. $\endgroup$ – rickys Jul 18 '18 at 10:37
2
$\begingroup$

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!

$\endgroup$
  • $\begingroup$ Thanks :). It works. $\endgroup$ – rickys Jul 18 '18 at 13:49
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ No it doesn't converge. If you change WorkingPrecision you get other results. $\endgroup$ – Ulrich Neumann Jul 18 '18 at 10:36
  • $\begingroup$ @Ulrich Neumann: Many thanks from me to you for your valuable comment. I based the convergence and corrected the value. $\endgroup$ – user64494 Jul 18 '18 at 11:08
  • $\begingroup$ @user64494: The result highly fluctuates by changing the WorkingPrecision to a different value using your method. $\endgroup$ – rickys Jul 18 '18 at 11:34
  • $\begingroup$ @rickys: Thank you. I noticed that the integral exists only as its principal value and modified my answer. $\endgroup$ – user64494 Jul 18 '18 at 11:47
  • 1
    $\begingroup$ @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? $\endgroup$ – user64494 Jul 18 '18 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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