3
$\begingroup$

I have a function that is real when u is real and positive.

And L[u,s,t] is an even function in s and t, and it is non-negative with above conditions.

L[u_, s_, t_] := 
Simplify[(1/(16*Pi^2*u^(1/2)*t^3))*(((
  4 t (I s + t^2) - (s - I (-2 + t) t) (s - 
      I t (2 + t)) (Log[-2 + (I s)/t + t] - 
      Log[2 + (I s)/t + t]))/(8 t^2)) + ((
  4 t (-I s + t^2) - (s + I (-2 + t) t) (s + 
      I t (2 + t)) (Log[-2 - (I s)/t + t] - 
      Log[2 - (I s)/t + t]))/(8 t^2))), 
Assumptions -> {u > 0, s \[Element] Reals, t \[Element] Reals}]

As one can check,

Plot3D does show up (means it is real valued) using u=1

u = 1
Plot3D[L[u, s, t], {s, -10^3 - 1, 10^3 - 1}, {t, 0, 10^3}]

However, this Integral

a[u_?NumericQ] := NIntegrate[
u^(5/2)/2*(Log[1 + L[u,s,t]] - L[u,s,t]/(1 + L[u,s,t])), {t, 0, 
10^3}, {s, -10^3, 10^3}, Exclusions -> {0, 0}] // Chop

And seems like this integral,returns me complex.

For instance,

a[1.]

gives

NIntegrate::eincr: The global error of the strategy GlobalAdaptive has 
increased more than 2000 times. The global error is expected to decrease 
monotonically after a number of integrand evaluations. Suspect one of the 
following: the working precision is insufficient for the specified precision 
goal; the integrand is highly oscillatory or it is not a (piecewise) smooth 
function; or the true value of the integral is 0. Increasing the value of 
the GlobalAdaptive option MaxErrorIncreases might lead to a convergent 
numerical integration. NIntegrate obtained 4.84092 +2.25059 I and 
1.8852748239554364` for the integral and error estimates.

With result of

4.84092 + 2.25059 I

where I is imaginary unit.

Why is this happening? Any help will be greatly thanked!

Thank you!

--------------------------ADDED-----------------------------------

What I really meant to do above was addition of complex conjugates

L[u_, s_, 
t_] := (1/(16*Pi^2*u^(1/2)*t^3))*(((
 4 t (I s + t^2) - (s - I (-2 + t) t) (s - 
     I t (2 + t)) (Log[-2 + (I s)/t + t] - 
     Log[2 + (I s)/t + t]))/(8 t^2)) + 
Conjugate[((
  4 t (I s + t^2) - (s - I (-2 + t) t) (s - 
      I t (2 + t)) (Log[-2 + (I s)/t + t] - 
      Log[2 + (I s)/t + t]))/(8 t^2))])

Maybe I took complex conjugate wrong before. This does give me real answers. (Maybe I missed something again?).

But the integral written above still provides me complex answer (with the error above)

Another issue I encountered was that if I perform Rationalize and FullSimplify on L[u,s,t], the plot actually looks different from the original version of the equation. But for now, I will use the original form and not worry about this.

$\endgroup$
  • $\begingroup$ L[1, 0, 1] is (4 - 3 I π + Log[27])/(64 π^2) $\endgroup$ – bbgodfrey Nov 26 '17 at 16:00
  • $\begingroup$ @bbgodfrey Thank you. I think when s=0, t cannot be less or equal to 2 because of log expression has $log(-2+t)$ in it. Now I want to exclude this $s=0, t\leq 2$ line from my integration (s=0 only). How should I modify the code? I tried to search exclusion option for it, but perhaps I am doing something wrong. $\endgroup$ – Duke Smith Nov 26 '17 at 16:12
  • $\begingroup$ You also could try a second definition for L for s == 0 && t < 2. $\endgroup$ – bbgodfrey Nov 26 '17 at 16:30
  • $\begingroup$ Please let me know how you resolve this matter. There is more than meets the eye, I believe. $\endgroup$ – bbgodfrey Nov 26 '17 at 17:46
  • $\begingroup$ @bbgodfrey I took your advice above and used Piecewise option. But I did notice that Maybe I had the equation wrong. Please take a look at my added part of my question above. $\endgroup$ – Duke Smith Nov 26 '17 at 18:19
2
$\begingroup$

I get (in V11.2.0):

a[1]

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 18 recursive bisections in s near {t,s} = {9.86073,465.576}. NIntegrate obtained 4.7853 +2.25347 I and 1.8445652241078074` for the integral and error estimates.

4.7853 + 2.25347 I

If I follow the advice and increase WorkingPrecision, I get an error-free result:

a[u_?NumericQ] := 
 NIntegrate[
  u^(5/2)/2*(Log[1 + L[u, s, t]] - L[u, s, t]/(1 + L[u, s, t])),
  {t, 0, 10^3}, {s, -10^3, 10^3}, Exclusions -> {0, 0}, 
  PrecisionGoal -> 8, WorkingPrecision -> 32]

a[1]
(*  0.0099144575004650534254476105632829  *)
$\endgroup$

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.