2
$\begingroup$

Perhaps this is trivial but I would like to plot the following function:

\begin{equation} p(t)=e^{\left( -\frac{d}{1-c}\right)\left[ W_0\left[B(1+x/r)^{1/d}\right]-W_0[B] \right]} \end{equation} where $W_k$ is the Lambert-W function for the $k=0$ branch and \begin{equation} B=\frac{(1-c)r}{1-(1-c)r}e^{\frac{(1-c)r}{1-(1-c)r}} \end{equation} by the same way they are done in the attached picture below. I am not really sure how to make a $(\log p(x),x)$ plot, but I guess that if I could do one, the $(-\log p(x),x)$ plot would be by ploting $p^{-1}(x)$? Plots of $p(x)

My (poor) attempt so far is the following:

c = 0.99999
r = 0.0001
  B = ((1 - c) r)/(1 - (1 - c) r) Exp[((1 - c) r)/(1 - (1 - c) r)]
   p = Table[ Exp[(-1/(1 - c)) (ProductLog[0, B*(1 + x/r)^(1/1)] - 
   ProductLog[0, B])], {d, 0.5, 2, 0.1}];
   LogPlot[Evaluate[p^-1, {x, 0, 10}], PlotRange -> {10^-1, 10^2}]

But even for the first one I am not able to get them correct.

I would really appreciate your help. Thank you.

$\endgroup$
  • $\begingroup$ Make p a function instead of a table maybe? $\endgroup$ – Marius Ladegård Meyer Jun 26 '16 at 15:11
  • $\begingroup$ @MariusLadegårdMeyer Thank you for your answer. Please bear with me, I am still a newbie to Mathematica, therefore could you explain what should I try in a more detailed way? Again, I know that it may be trivial for many people in this forum but I am kind of struggling with it.. $\endgroup$ – Mitscaype Jun 26 '16 at 15:19
  • $\begingroup$ @Mitscaype Where do those plots come from originally? $\endgroup$ – MarcoB Jun 26 '16 at 15:38
  • $\begingroup$ @MarcoB It is a paper I am studying, from Stephan Thurner and Rudolf Hanel: "What do generalized entropies look like? An axiomatic approach for complex, non-ergodic systems". But I am finding some different definition as far as their $p(x)$ is concerned when I try to derive it on my own. $\endgroup$ – Mitscaype Jun 26 '16 at 15:42
4
$\begingroup$

Try something like this to define p as a function:

Clear[p]
p[x_, c_, d_, r_] := Module[{B},
  B = ((1 - c) r)/(1 - (1 - c) r) Exp[(1 - c) r/(1 - (1 - c) r)];
  Exp[-d/(1 - c) (ProductLog[0, B*(1 + x/r)^(1/d)] - ProductLog[0, B])]
]

Then something like this to plot multiple instances as a function of different parameter choices:

LogLogPlot[
  {
    p[x, 0.2, 0.025, 0.9/(1 - 0.2)],
    p[x, 0.6, 0.025, 0.9/(1 - 0.6)],
    p[x, 0.8, 0.025, 0.9/(1 - 0.8)]
  },
  {x, 10^-5, 10^9}, PlotRange -> All,
  PlotStyle -> {Blue, Red, Green}
]

Mathematica graphics

Note, however, that I am not sure that your function definition correctly reproduces the values I can infer from the plots you showed. I am also worried about possible issues with numerical precision in your calculations involving very large / very small numbers.


Here is a similar idea for the first plot:

LogLogPlot[
  {
    -Log[p[x, 0.99999, 0.5, 1*^-4]],
    -Log[p[x, 0.99999, 1, 1*^-4]],
    -Log[p[x, 0.99999, 2, 1*^-4]]
  },
  {x, 10^-5, 10^9}, PlotRange -> {5*^-6, 1*^4},
  PlotStyle -> {Blue, Red, Green},
  Frame -> True, Axes -> False,
  PlotRangePadding -> {None, {Scaled[0.05], Scaled[0.15]}},
  Epilog -> {
    Inset[
      Style["c=0.99999\nr=0.0001", Black],
      ImageScaled[{0.18, 0.8}], Alignment -> Left
    ],
    Inset[Style["d=0.5", Black], ImageScaled[{0.43, 0.9}]],
    Inset[Style["d=1.0", Black], ImageScaled[{0.66, 0.9}]],
    Inset[Style["d=2.0", Black], ImageScaled[{0.93, 0.8}]]
  }
]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you for your help! I have two questions: As I see that you were able to reproduce the second plot, and I can see that you used a LogLog plot, how would you do it on the first plot that one of the axes is $-logp(x)$? Moreover, concerning your last statement, are the results of this $p(x)$ I defined not compatible with the plot values which are shown on my question? Again, thank you. $\endgroup$ – Mitscaype Jun 26 '16 at 15:40
  • 1
    $\begingroup$ @Mitscaype As I understand it, the -Log[p] should be a straightforward extension of the first method, i.e. you use LogLogPlot to plot the value of $-\log{p(x)}$ on a logarithmic scale. $\endgroup$ – MarcoB Jun 26 '16 at 15:48
  • $\begingroup$ Thank you again for your help! It is very important for me, since I can maybe do the math but I can't manage it so well when it comes to plotting. One last question, how can one put the labels of $c,d$ and $r$ on the plot? $\endgroup$ – Mitscaype Jun 26 '16 at 16:42
  • 1
    $\begingroup$ @Mitscaype Labels can be added using e.g. Epilog and Inset. Take a look at the last plot, which now includes labels; you should be able to modify the corresponding code to adjust to your liking. $\endgroup$ – MarcoB Jun 26 '16 at 22:18
  • $\begingroup$ It works perfectly now! Once again many thanks! $\endgroup$ – Mitscaype Jun 26 '16 at 22:36

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.