# A simple plot returns empty, even though specific points values exist

I'm in a bit of a pickle:

I try to plot a graph of a simple function, and for some reason unknown to me, it is drawn blank even though evaluation of the function at specific points returns the required values. My code is as follows:

A = 0.1;
B = 0.11;
CParam[x_] :=  BesselK[2, A/x] BesselI[0, B/x] + BesselI[2, A/x] BesselK[0, B/x];
Plot[Log[Log[-CParam'[x]]], {x, 10^-8, 10^-5}]


However, typing {Log[Log[-CParam'[10^-5]]], Log[Log[-CParam'[10^-6]]], Log[Log[-CParam'[10^-7]]], Log[Log[-CParam'[10^-8]]]} returns {6.91618835667271168, 9.211416996515317434, 11.5130562034263446895, 13.81552593513862411174}.

Why doesn't Plot work properly?

Thanks

• try LogLinearPlot, and try manually specifying PlotRange Commented Oct 24, 2016 at 11:25
• you also may need to do Plot[Evaluate[expression],..] because of the derivative Commented Oct 24, 2016 at 11:30
• Nope. Neither work. Commented Oct 24, 2016 at 12:19
• Seems to be a bug. Try ListLinePlot@ Table[Log[Log[-CParam'[x]]], {x, Subdivide[10^-8, 10^-5, 100]}] (I'm on V11.0.0.) Commented Oct 24, 2016 at 12:31
• Works fine under "10.4.1 for Linux x86 (64-bit) (April 11, 2016)". Commented Oct 24, 2016 at 13:29

I think this is a bug in Plot[].

Aside from making a table and ListPlot-ing it, such as in my comment,

ListLinePlot@ Table[Log[Log[-CParam'[x]]], {x, Subdivide[10^-8, 10^-5, 100]}]


one could use NDSolve to get adaptive sampling:

ListLinePlot@
NDSolveValue[{y[x] == Log[Log[-CParam'[x]]], z'[x] == 1,
z[10^-8] == 0}, y, {x, 10^-8, 10^-5}, PrecisionGoal -> 3]


Adaptive sampling is not needed here, but in an oscillatory function, it could be helpful, should Plot[] fail as in this case.

Options[adaptiveListLinePlot] = Options[ListLinePlot];
adaptiveListLinePlot[f_, {x_, a_, b_}, opts : OptionsPattern[]] :=
Module[{y, z, a1, b1},
{a1, b1} =              (* open sampling *)
Rescale[{Sqrt@$MachineEpsilon, 1 - Sqrt@$MachineEpsilon}, {0, 1}, {a, b}];
ListLinePlot[
NDSolveValue[{y[x] == f, z'[x] == 1, z[a1] == 0}, y, {x, a1, b1}, PrecisionGoal -> 3],
opts]
];


I can verify the comment of @Michael E2 as I ran into the same problem with LogPlot on Version 11.0. The solution he suggested worked for me by extracting the calculation from inside Plot into Table. So for your problem it works like this:
A = 0.1;

Choose the value of stepIncrement to a value that fulfills your requirements regarding precision.