1
$\begingroup$

I have a function K3T[2][2 r0 l, g2, z, c, T, p] that is acting weird when evaluated for different p:

Plot[With[{r0 = 0.02, l = 0.5, g2 = 0, z = 1, c = 1, d = 3, N = 2, 
   T = 1/100}, {Re@K3T[2][2 r0 l, g2, z, c, T, p], 
   Im@K3T[2][2 r0 l, g2, z, c, T, p]}], {p, 0, 10}, Evaluated -> True,
  PlotPoints -> 1000, AxesLabel -> {p, K3T}]

The plot shows an unexpected peak in the real part that becomes visible only when significantly increasing the number of sample points. Secondly, the graphs of both real and imaginary part suddenly stop around $p = 7$. Can someone explain what is going on?

enter image description here

Definition

K3T[2][2 r0 l, g2, z, c, T, p] is defined as follows:

DK3T[m2_, g2_, z_, c_, T_, p_, 
   k_, L_] = 
  T ( Sum[w[[j]] Log[Exp[1/T Sqrt[p^2 + m[[j]]]] - 1], {j, 10}]);
K3T[0][m2_, g2_, z_, c_, T_, p_] = 
  k D[DK3T[m2, g2, z, c, T, p, 
      k, L], k] /. k -> 1;
K3T[j_Integer?Positive][m2_, g2_, z_, c_, T_, 
   p_] := Module[{msqr}, (-1)^j/
     j! D[K3T[0][msqr, g2, z, c, T, p], {msqr, 
       j}] /. msqr -> m2];

where

w = {1, 1, 1, 1, -2, -1, -1, -1, -1, 2};
m = {a[1, 1][m2/k^2, g2/k^2, z, c] k^2, 
   a[1, 2][m2/k^2, g2/k^2, z, c] k^2, 
   a[2, 1][m2/k^2, g2/k^2, z, c] k^2, 
   a[2, 2][m2/k^2, g2/k^2, z, c] k^2, 1/c k^2, 
   a[1, 1][m2/L^2, g2/L^2, z, c] L^2, 
   a[1, 2][m2/L^2, g2/L^2, z, c] L^2, 
   a[2, 1][m2/L^2, g2/L^2, z, c] L^2, 
   a[2, 2][m2/L^2, g2/L^2, z, c] L^2, 1/c L^2};

Auxiliary functions

Custom square root with branch cut on negative real axis

sqrt[x_?NumericQ, y_?NumericQ] := 
 Piecewise[{{I Sqrt[-x], Re[x] < 0 && Chop@N[y] >= 0}, {-I Sqrt[-x], 
    Re[x] < 0 && Chop@N[y] < 0}}, Sqrt[x]]

Derivative[1, 0][sqrt][x_, y_] = 1/(2 sqrt[x, y]);
Derivative[0, 1][sqrt][x_, y_] = 0;

Coefficients from partial fraction decomposition

a[1, 1][m2_, g2_, z_, c_] := 
  1/2 (1/c + m2/z - I g2/z) + 
   I sqrt[1/(c z) - 1/4 (1/c - m2/z + I g2/z)^2, -(1/c - m2/z)];
a[1, 2][m2_, g2_, z_, c_] := 
  1/2 (1/c + m2/z + I g2/z) - 
   I sqrt[1/(c z) - 1/4 (1/c - m2/z - I g2/z)^2, (1/c - m2/z)];
a[2, 1][m2_, g2_, z_, c_] := 
  1/2 (1/c + m2/z - I g2/z) - 
   I sqrt[1/(c z) - 1/4 (1/c - m2/z + I g2/z)^2, -(1/c - m2/z)];
a[2, 2][m2_, g2_, z_, c_] := 
  1/2 (1/c + m2/z + I g2/z) + 
   I sqrt[1/(c z) - 1/4 (1/c - m2/z - I g2/z)^2, (1/c - m2/z)];
$\endgroup$
1
  • 1
    $\begingroup$ suggest generating tables and using listplot. That way you can see exactly what p values are giving anomolous results (guessing a precision issue) $\endgroup$
    – george2079
    Commented Jun 16, 2017 at 11:52

1 Answer 1

3
$\begingroup$

Try using PlotRange->All. This is what I get (MMA10.4, MMA11.1 Linux)

Plot[With[{r0 = 0.02, l = 0.5, g2 = 0, z = 1, c = 1, d = 3, N = 2, T = 1/100}, 
     {Re@K3T[2][2 r0 l, g2, z, c, T, p], Im@K3T[2][2 r0 l, g2, z, c, T, p]}], {p, 0, 10},
       Evaluated -> True, PlotPoints -> 1000, AxesLabel -> {p, K3T}, PlotRange -> All]

enter image description here

$\endgroup$
8
  • $\begingroup$ I did try PlotRange->All before posting, still the graph stops around 7. Could you repeat the plot with PlotPoints -> 10000 or 100000 and see if the unexpected peak shows up for you then? $\endgroup$
    – Janosh
    Commented Jun 19, 2017 at 7:20
  • $\begingroup$ I am getting the same thing. Could you check the values with Table within {p, 0, 4, 0.1}? Then we can know if it is a plotting problem or evaluation. Also, try to create a list and see how ListLinePlot looks like. $\endgroup$
    – Sumit
    Commented Jun 19, 2017 at 8:22
  • $\begingroup$ Evaluating With[{\[Rho]0 = 0.02, \[Lambda] = 0.5, \[Gamma]2 = 0, z = 1, c = 1, d = 3, N = 2, T = 0.01}, Chop@Table[{Re@\[ScriptCapitalK]3T[2][2 \[Rho]0 \[Lambda], \[Gamma]2, z, c, T, p], Im@\[ScriptCapitalK]3T[2][2 \[Rho]0 \[Lambda], \[Gamma]2, z, c, T, p]} , {p, 0, 4, 0.1}]] I get {{0.957036, 0}, {0.947885, 0}, {0.919065, 0}, {0.867531, 0}, {0.791339, 0}, {0.692762, 0}, {0.579627, 0}, {0.463479, 0}, {0.355618, 0}, {0.263672, 0}, {0.190519, 0}, {0.13529, 0}, {0.0951246, 0}, .... All looks regular here. ListLinePlot too. But how does that help? $\endgroup$
    – Janosh
    Commented Jun 19, 2017 at 10:00
  • $\begingroup$ Interesting. Even with {p, 0, 4, 0.0001} the peak doesn't show up in ListLinePlot. $\endgroup$
    – Janosh
    Commented Jun 19, 2017 at 10:12
  • $\begingroup$ I think it is a graphics problem then (or maybe a bug !). BTW, which OS and MMA version you are using? If possible can you try this with a different installation? $\endgroup$
    – Sumit
    Commented Jun 19, 2017 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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