# LogLogPlot plugs in zero

Bug introduced in 10.0 and fixed in 10.0.2

In testing the answers to Plot result of non analytical-integral in V10.0.1, I came across this behavior of LogLogPlot. All three version give the correct plot, but the first two give error messages.

ClearAll[f1, f2, f3, x];
k = 1/x;
kfn[x_?NumericQ] := 1/x;
f1[x_?NumericQ] := NIntegrate[k*y, {y, 0, 1}];       (* kludgy *)
f2[x_?NumericQ] := NIntegrate[kfn[x]*y, {y, 0, 1}];  (* correct way, but gives errors *)
f3[x_?Positive] := NIntegrate[k*y, {y, 0, 1}];       (* also correct and no errors *)

LogLogPlot[f1[x], {x, 1, 10}]
LogLogPlot[f2[x], {x, 1, 10}]
LogLogPlot[f3[x], {x, 1, 10}]


The first two give the message (twice):

NIntegrate::inumr: The integrand y/x has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}. >>

The second gives an additional message (twice):

Power::infy: Infinite expression 1/0 encountered. >>

Why does this happen? Is this a bug?

Notes: (1) It does not happen on V9. I seem to recall this coming up before (years ago). If folks have earlier versions, please test the code above. (2) Reported to WRI. (3) WRI confirmed it in 10.0.1 and stated it was resolved in 10.0.2.

• Hints: The title. Try out f[x_?NumericQ] := (Print[x]; NIntegrate[kfn[x]*y, {y, 0, 1}]). (I dislike posting such questions, when I know the answer. But as it relates to a question on the site, I also thought I ought to. Feel free to answer first.) Jan 6, 2015 at 14:45
• I ran the code and got error messages from f1 and f3 but not f2. I restarted the kernel and ran it again and got no messages at all. Additional restarts also produced no messages. Since I now cannot seem to reproduce the problem I'm not sure what to make of it. Jan 6, 2015 at 15:17
• @Mr.Wizard Which version(s) of Mma? I can reproduce it on a completely new session. (My system is a Mac, in case that makes a difference.) Jan 6, 2015 at 15:50
• With Mathematica 10.0.2 on a MacBook Pro running OS X Yosemite 10.10.1, I get identical results (Equal and SameQ) for all three plots and no error messages. Jan 6, 2015 at 16:35
• No errors Mathematica 10.0.2 Windows 7 Enterprise. Jan 6, 2015 at 18:25

The issue in V10.0.1 is that LogLogPlot uses x = 0 as a test point, instead of a value inside the specified plot domain.