# Plotting with Logarithmic Scale

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

$$p(t)=e^{\left( -\frac{d}{1-c}\right)\left[ W_0\left[B(1+x/r)^{1/d}\right]-W_0[B] \right]}$$ where $W_k$ is the Lambert-W function for the $k=0$ branch and $$B=\frac{(1-c)r}{1-(1-c)r}e^{\frac{(1-c)r}{1-(1-c)r}}$$ 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)$?

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.

• Make p a function instead of a table maybe? – Marius Ladegård Meyer Jun 26 '16 at 15:11
• @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.. – Mitscaype Jun 26 '16 at 15:19
• @Mitscaype Where do those plots come from originally? – MarcoB Jun 26 '16 at 15:38
• @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. – Mitscaype Jun 26 '16 at 15:42

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}
]


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,
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}]]
}
]


• 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. – Mitscaype Jun 26 '16 at 15:40
• @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. – MarcoB Jun 26 '16 at 15:48
• 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? – Mitscaype Jun 26 '16 at 16:42
• @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. – MarcoB Jun 26 '16 at 22:18
• It works perfectly now! Once again many thanks! – Mitscaype Jun 26 '16 at 22:36