0
$\begingroup$

I am using NIntegrate and getting an error message

d = 25/100; U1 = 52/100; U2 = 30/100;
Ux[px_, py_, pz_] = 2 U1/3 (Cos[px] + Cos[py] + Cos[pz]);
Uy[px_, py_, pz_] = 2 U2/3 (Cos[px] + Cos[py] - Cos[pz]);
U0[px_, py_, pz_] = (Ux[px, py, pz] + Uy[px, py, pz])/2;
U3[px_, py_, pz_] = (Ux[px, py, pz] - Uy[px, py, pz])/2;
P0[T_, v_, x_, px_, py_, pz_] = 
  1 - 2 (U0[px, py, pz] (2 d^2 + x) - U3[px, py, pz] x)/Sqrt[
      d^2 + x]/(4 d^2 + 4 x + v^2) Tanh[Sqrt[d^2 + x]/T];
PdP0[T_, v_, x_, px_, py_, pz_] = 
  P0[T, v, x, px, py, pz] D[P0[T, v, x, px, py, pz], x];
P1[T_, v_, x_, px_, py_, 
   pz_] = -2 U3[px, py, 
    pz] v d/Sqrt[d^2 + x]/(4 d^2 + 4 x + v^2) Tanh[Sqrt[d^2 + x]/T];
PdP1[T_, v_, x_, px_, py_, pz_] = 
  P1[T, v, x, px, py, pz] D[P1[T, v, x, px, py, pz], x];
P2[T_, v_, x_, px_, py_, 
   pz_] = -2 U0[px, py, 
    pz] I v d/Sqrt[d^2 + x]/(4 d^2 + 4 x + v^2) Tanh[
    Sqrt[d^2 + x]/T];
PdP2[T_, v_, x_, px_, py_, pz_] = 
  P2[T, v, x, px, py, pz] D[P2[T, v, x, px, py, pz], x];
P3[T_, v_, x_, px_, py_, 
   pz_] = -2 (U3[px, py, pz] (2 d^2 + x) - U0[px, py, pz] x)/Sqrt[
     d^2 + x]/(4 d^2 + 4 x + v^2) Tanh[Sqrt[d^2 + x]/T];
PdP3[T_, v_, x_, px_, py_, pz_] = 
  P3[T, v, x, px, py, pz] D[P3[T, v, x, px, py, pz], x];
F[T_, v_, x_, px_, py_, 
   pz_] =
  (PdP0[T, v, x, px, py, pz] - PdP1[T, v, x, px, py, pz] - 
      PdP2[T, v, x, px, py, pz] - 
      PdP3[T, v, x, px, py, pz])/(P0[T, v, x, px, py, pz]^2 - 
      P1[T, v, x, px, py, pz]^2 - P2[T, v, x, px, py, pz]^2 - 
      P3[T, v, x, px, py, pz]^2);
F1[T_, v_, x_] := 
  8*NIntegrate[
    F[T, v, x, px, py, pz], {px, 0, \[Pi]}, {py, 0, \[Pi]}, {pz, 
     0, \[Pi]}];

enter image description here

The integrand has singularity if 2U1/3(cospx+cospy+cospz)=d coth(d/T) or 2U2/3(cospx+cospy-cospz)=d coth(d/T).

For the d U1 U2 that were used here, if T<1/4/ArcCoth[104/25], first singularity(yellow) exist. If T<1/4/ArcCoth[12/5], second singularity (blue) also exist. So I write the integral into five portions when T<1/4/ArcCoth[12/5] by the method provided by @Akku14 NIntegral takes long time, similar problem just changed the integrand a bit.

enter image description here

int1 projection of blue part, int2 right above blue but in yellow, int3 the rest part of yellow, int4 right above yellow, int5 rest part.

int1[T_?NumericQ] := 
  8*NIntegrate[
    NIntegrate[
     F[T, 0, 0, px, py, pz], {pz, 0, 
      ArcCos[75/104 Coth[1/4/T] - Cos[px] - Cos[py]], 
      ArcCos[Cos[px] + Cos[py] - 5/4 Coth[1/4/T]], Pi}, 
     Method -> "PrincipalValue"], {px, 0, 
     ArcCos[5/4 Coth[1/4/T] - 2]}, {py, 0, 
     ArcCos[5/4 Coth[1/4/T] - Cos[px] - 1]}];
int2[T_?NumericQ] := 
  8*NIntegrate[
    NIntegrate[
     F[T, 0, 0, px, py, pz], {pz, 0, 
      ArcCos[-Cos[px] - Cos[py] + 75/104 Coth[1/4/T]], Pi}, 
     Method -> "PrincipalValue"], {px, 0, 
     ArcCos[5/4 Coth[1/4/T] - 2]}, {py, 
     ArcCos[5/4 Coth[1/4/T] - Cos[px] - 1], 
     ArcCos[75/104 Coth[1/4/T] - 1 - Cos[px]]}];
int3[T_?NumericQ] := 
  8*NIntegrate[
    NIntegrate[
     F[T, 0, 0, px, py, pz], {pz, 0, 
      ArcCos[75/104 Coth[1/4/T] - Cos[px] - Cos[py]], Pi}, 
     Method -> "PrincipalValue"], {px, ArcCos[5/4 Coth[1/4/T] - 2], 
     ArcCos[75/104 Coth[1/4/T] - 2]}, {py, 0, 
     ArcCos[75/104 Coth[1/4/T] - 1 - Cos[px]]}];
int4[T_?NumericQ] := 
  8*NIntegrate[
    F[T, 0, 0, px, py, pz], {pz, 0, Pi}, {px, 0, 
     ArcCos[75/104 Coth[1/4/T] - 2]}, {py, 
     ArcCos[75/104 Coth[1/4/T] - 1 - Cos[px]], Pi}];
int5[T_?NumericQ] := 
 8*NIntegrate[
   F[T, 0, 0, px, py, pz], {pz, 0, Pi}, {px, 
    ArcCos[75 /104 Coth[1/4/T] - 2], Pi}, {py, 0, Pi}]; 
F0[T_] = int1[T] + int2[T] + int3[T] + int4[T] + int5[T];

When I am running F0[0.55], I get this error message "NIntegrate::inumri: The integrand has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries". It came from int2 and int3 only after evaluate them separately.

The error message does not appear for values like F0[0.5]

What does this message mean and why it appears?

$\endgroup$
  • 1
    $\begingroup$ You have a lot of code to wade through. Have you done some troubleshooting on your own? For instance, your F0 expression is simply a sum of five contributions. Have you at least run them separately with that problematic input to see which ones are responsible for the error? $\endgroup$ – MarcoB May 28 '18 at 20:09
  • $\begingroup$ There are several similar problems on this site. If you search for inumri you'll find the ones whose OPs were thoughtful enough to include the message name. $\endgroup$ – Michael E2 May 28 '18 at 23:24

Your Answer

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

Browse other questions tagged or ask your own question.