# How to make a plot of function over 24 orders of magnitude?

Assume these parameter definitions first:

P0 = 325000000000000000000000000000000/1289899878039;
th = 22 10^-7;
alpha = 15*^6;
p0value = 0.0000697013247924021100000;
Lh = 5 10^-9;
d = 80 10^-9;
A = -2.849063973629485054748698050793731069568803743569047140.25650391588118*^\
14;
B = 1.176012075224158330564340492708598098040460163118820726837.\
974790074939705*^26;


Define two functions

tmp[x_] := A E^(x/Lh) + B E^(-x/Lh) + p0value ;
tmp2[x_] := -(alpha P0 th)/(1 - alpha^2 Lh^2) E^(-alpha x);


Subtracting them at x=d yields the small number p0value

tmp[d] - tmp2[d]


0.000069701324792402

I want the plot of tmp[x] - tmp2[x] to have a value of p0value (0.0000697013247924021100000) at x = d and not to stop at $10^{20}$.

LogPlot[{tmp[x] - tmp2[x]}, {x, 0, d}, PlotRange -> {{0, d}, {10^-5, 10^25}}]


I tried MeshFunctions but without success. Can anyone give me a hint?

-

ListLogPlot[{#, tmp[#] - tmp2[#]} & /@
Table[Exp[x], {x, Log[d] - 2, Log[d], 1/128}] ,
PlotRange -> {{0, d}, {10^-5, 10^25}}, Joined -> True]


-
Thanks Sjoerd! I just changed the list to exact range (0,d) in order to have all points close to 0 as well : Table[x, {x, 0, d, d/128}]. – Cendo Feb 26 '13 at 10:25

May I suggest a plot of $\log(x)$ vs $\log\left(\text{tmp}(d-x)-\text{tmp2}(d-x)\right)$ if it's the "tail" part what you concern:

plotdata = Table[{10^k, tmp[d - 10^k] - tmp2[d - 10^k]}, {k, -40, Log[10, d], 1/10}];
ListLogLogPlot[plotdata, Joined -> True, PlotRange -> {All, {10^-5, 10^25}}]


-

Does this do what you need?

LogPlot[{tmp[x] - tmp2[x]}, {x, 0, d}, PlotRange -> Automatic]


Simply removing the argument to PlotRange (or in this case explicitly setting it to Automatic might solve the problem?

-
As far as I can tell, the asker wants the point $(d, 0.0000697)$ to be visible on the plot, so this does not answer the question. – Rahul Feb 24 '13 at 23:21
Exactly, I want the point (d,0.0000697) to be on the plot. – Cendo Feb 25 '13 at 6:59