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.
Answer
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.
The issue is resolved in V10.0.2.
Confirmed by WRI.
Comments
Post a Comment