I'm using NIntegrate to perform numerous integrations with the value L. L is utilized in multiple functions, all of which are called by NIntegrate to run.

b = 100; 
diffusivity = 8.3*10^4;
a = 1;
L = 10000;
kbT = 1.38*10^(-23)*300; 
eps = 23.5;
sig = 1.3 (*nm *)

Ra[R_] := Sqrt[(R - a)^2 + a^2 - 2 a (R - a)]

greenGaussian[R_] := ((2*Pi*L*b^2)/3)^(-3/2)*Exp[-3 R^2/(2 L b^2)];

\[Beta]FBind[R_] := (-2*eps/kbT)/(1 + Exp[Ra[R]/sig])

\[Beta]FConf[R_] := -Log[R^2*greenGaussian[R]]

\[Beta]FTotal[R_] := \[Beta]FConf[R] + \[Beta]FBind[R]

The problem arises when I try and take the following numerical integral with NIntegrate:

QLooped = NIntegrate[Exp[-\[Beta]FTotal[R]], {R, 2, 150}]  

tauLooped = NIntegrate[
  Exp[-\[Beta]FTotal[R] + \[Beta]FTotal[R1] 
- \[Beta]FTotal[R2]],
  {R, 2, 150},
  {R1, R, 150},
  {R2, 2, 150}

Originally, I was getting NIntegrate to yield values for L=10000, and then it stopped working, giving me errors:

NIntegrate::inumri: The integrand (3 
R^2)/200000000) R^2)/(2000000000000 \ . 
[Pi]^(3/2)) has evaluated to Overflow, 
Indeterminate, or Infinity for all sampling 
points in the region with boundaries 

Another one was an error with Catch and Throw.

Another one was that the convergence was too slow.

I've searched the errors I've gotten, and have been unsuccessful with other people's attempts.

The weird part is that I'm getting convergence for the unlooped function, not the tauLooped function.

QUnlooped = NIntegrate[Exp[-\ 
[Beta]FTotal[R]], {R, 150, L}]  

tauUnlooped = (1/(diffusivity*QUnlooped)) 
   Exp[-\[Beta]FTotal[R] + \ 
   [Beta]FTotal[R1] - \[Beta]FTotal[R2]],
   {R, 150, L},
   {R1, 150, R},
   {R2, R1, L}

I've tried changing the bounds of integration for tauLooped (e.g. 50 to 150), but the results that I get are pure nonsense (massive orders of magnitude 10^(454337)

I'm unable to rationally diagnose this problem based on the ranging errors I'm getting.

I want to vary L from Table[x,{x,10000,100000,10000}] and then evaluate TLooped and TUnlooped.

  • $\begingroup$ Your \[Beta]FTotal[2] evaluates to -5.67633*10^21. When you Exp[- [Beta]FTotal[2]]`, you will get overflow every time. You might want to check your numbers. $\endgroup$ – Bill Watts Dec 8 '18 at 0:43
  • $\begingroup$ You have constants that differ by dozens of orders of magnitude. Numerical results will likely be very bad. Please, work in natural units, where all parameters are of order 1. $\endgroup$ – AccidentalFourierTransform Dec 8 '18 at 1:48

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.