1
$\begingroup$

I am currently trying to numerically evaluate an expression which is the following. The expression IntD0 is being plotted, but the next line is not. I thought it might be because of zeros in IntD0 but even after removing them it shows an empty plot. I am not sure why this is happening.

The expression formally is the following : \begin{equation} \begin{aligned} &D_0 = \int_{-\left({w}+{T}\right)}^{\left({w}+{T}\right)}d{\epsilon}\frac{1}{\pi{w}}\left[1-\frac{{\epsilon}^2}{{w}^2}\right]\frac{\exp{\left(\frac{{\epsilon}-{\mu}}{{T}}\right)}}{\left(\exp{\left(\frac{{\epsilon}-{\mu}}{{T}}\right)}+1\right)^2}\frac{1}{T} \\ &E = \sqrt{\lambda - \frac{1}{D_{0}}}, \end{aligned} \end{equation} where $\lambda$, $w$, $T$, $\mu$ are parameters, and I am plotting $E$ as a function of $T$.

g[\[Epsilon]_, w_] := 1/(\[Pi]  w) (1 - (\[Epsilon])^2/w^2)
f1[\[Epsilon]_, \[Mu]_, 
  T_] :=  E^((\[Epsilon] - \[Mu])/T)/((1 + E^((\[Epsilon] - \[Mu])/
    T))^2 T)

(* Integrate*)
IntD0[(w_)?NumericQ, (\[Mu]_)?NumericQ,  (T_)?NumericQ] := 
 NIntegrate[
  g[\[Epsilon], w] f1[\[Epsilon], \[Mu], T], {\[Epsilon], -w - T, 
   w + T}, MaxRecursion -> 100, AccuracyGoal -> Infinity, 
  Method -> "LocalAdaptive"]
Manipulate[
 ListLinePlot[Table[{b, IntD0[t, e, b]}, {b, 0.001, 1, 0.05}]], {e, 0,
   1}, {t, 0.001, 1}]

Manipulate[
 ListLinePlot[
  Table[{b, Sqrt[c - (1/IntD0[t, e, b]) ]}, {b, 0.1, 1}]], {e, 0.5, 1}, {t, 0.5, 1},{c, 0.5, 1}] (* empty plot*)

Edit: I had made an error in not specifying the increments for b. (thanks to @MarcoB for this)

$\endgroup$
7
  • 1
    $\begingroup$ What's the definition of the function g that appears in your NIntegrate? $\endgroup$
    – MarcoB
    Commented Jul 12, 2022 at 7:07
  • $\begingroup$ There is also a mismatch between your Mathematica code (1+E^((\[Epsilon]-\[Mu])/T))^2 and the denominator in the TeX-formula for $D_0$, the square is not in the same place. $\endgroup$
    – user293787
    Commented Jul 12, 2022 at 7:13
  • $\begingroup$ Indeed sorry for the mistake. @MarcoB sorry I forgot to add that $\endgroup$
    – Charlie
    Commented Jul 12, 2022 at 8:10
  • $\begingroup$ Table[{b, Sqrt[c - (1/IntD0[t, e, b]) ]}, {b, 0.1, 1}]] Evaluates to a {{0.1, 0. + 3.01091 I}}, A single point to plot, but a complex and ListLinePlotexpects real numbers, not complex. $\endgroup$
    – rhermans
    Commented Jul 12, 2022 at 8:43
  • $\begingroup$ the single point is strange and perhaps the problem. I did realize that I need to take the real part. Thanks for pointing that out. $\endgroup$
    – Charlie
    Commented Jul 12, 2022 at 13:01

1 Answer 1

5
$\begingroup$

I understand that integrating such complex expressions causes certain difficulties. However, I tried to solve the problem in a direct way.

We take the formula for integration by parts: enter image description here

u = (1 - \[Epsilon]^2/\[Omega]^2 );

v = Exp[(\[Epsilon] - \[Mu])/T ]/(Exp[(\[Epsilon] - \[Mu])/T ]^2 + 1 );

du = D[u, \[Epsilon]];

dv = D[v, \[Epsilon]];

We calculate the integral and obtain a relatively compact form:

integralbyparts = -(1/(Pi \[Omega] )) 1/
   T  (ReplaceAll[u, \[Epsilon] -> \[Omega] + T] ReplaceAll[
       v, \[Epsilon] -> \[Omega] + T] - 
     ReplaceAll[u, \[Epsilon] -> -(\[Omega] + T)] ReplaceAll[
       v, \[Epsilon] -> -(\[Omega] + T)] - 
     Integrate[du v, {\[Epsilon], -(\[Omega] + T), \[Omega] + T}]) // 
  Simplify

!!!IMPORTANT!!! Then we take the formula $E=\sqrt{\lambda-\frac{1}{D_0}}=\sqrt{\lambda-\frac{1}{integral by parts}}$ and substitute the integral by parts instead of $D_0$ by simply copying the result !

e[\[Lambda]_, \[Mu]_, T_, \[Omega]_] := 
 Sqrt[\[Lambda] - 
   1/(1/(\[Pi] \[Omega]^3) (-((
         E^((T + \[Mu] + \[Omega])/T) (T + 2 \[Omega]))/(
         1 + E^((2 (T + \[Mu] + \[Omega]))/T))) + (
        E^((T + \[Mu] + \[Omega])/T) (T + 2 \[Omega]))/(
        E^((2 \[Mu])/T) + E^(2 + (2 \[Omega])/T)) - 
        2 (T + \[Omega]) (ArcCot[E^((T + \[Mu] + \[Omega])/T)] + 
           ArcTan[E^((T - \[Mu] + \[Omega])/T)]) + 
        I T (PolyLog[2, -I E^((T - \[Mu] + \[Omega])/T)] - 
           PolyLog[2, I E^((T - \[Mu] + \[Omega])/T)] - 
           PolyLog[2, -I E^(-((T + \[Mu] + \[Omega])/T))] + 
           PolyLog[2, I E^(-((T + \[Mu] + \[Omega])/T))])))]

Then we build a graph and play with the parameters:

Manipulate[
 Plot[e[\[Lambda], \[Mu], T, \[Omega]], {T, 0.1, 5}, 
  PlotRange -> Full, AxesLabel -> Automatic], {\[Lambda], 1, 
  5}, {\[Omega], 0.1, 1}, {\[Mu], 1, 3}]

enter image description here

It would be nice if you could indicate the ranges of these parameters and their physical meaning. Because for some values, the function is not computable and I had to select these values manually.

$\endgroup$
1
  • $\begingroup$ Thanks for the answer, very nice approach. Unfortunately at this point this problem is still in its infancy and I am not too sure myself about the ranges of these parameters. However, I would be happy to add more details about the physical meanings of the parameters in edits. $\endgroup$
    – Charlie
    Commented Jul 12, 2022 at 13:02

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