Re: LogLogPlot evaluates argument outside given range
- To: mathgroup at smc.vnet.net
- Subject: [mg103350] Re: [mg103318] LogLogPlot evaluates argument outside given range
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 16 Sep 2009 05:49:07 -0400 (EDT)
- References: <20357537.1253003699077.JavaMail.root@n11>
Most of the Plot type statements use adaptive sampling that can go outside the designated variable domain. If there aren't other problems you could just use Quiet. LogLogPlot[ Interpolation[Table[10^{i, i}, {i, 1, 5}]][x] // Evaluate, {x, 10, 100000}] // Quiet But if you really really don't want to sample outside the specified domain you could use a ParametricPlot. ParametricPlots appear to always hit the endpoints and to stay within the domain. In the following I use Presentations to convert a basic ParametricPlot to a LogLog plot. This is more work because now we have to specify the ticks and grids (but on the other hand we get more control of them.) Also, in the ParametricDraw I use a log10 variable for the domain because we want even sampling over the log scale not the linear scale. Needs["Presentations`Master`"] f[x_] = Interpolation[Table[10^{i, i}, {i, 1, 5}]][x] basicgraphics = ParametricDraw[{logx, f[10^logx]}, {logx, 1, 5}]; xlogticks = CustomTicks[Log10, {1, 5, {1} // N, {2, 3, 4, 5, 6, 7, 8, 9}}]; xloggrids = CustomGridLines[Log10, {1, 5, Range[9]}, {GrayLevel[.85]}]; ylogticks = CustomTicks[Log10, {1, 5, {1} // N, {2, 3, 4, 5, 6, 7, 8, 9}}]; yloggrids = CustomGridLines[Log10, {1, 5, Range[9]}, {GrayLevel[.85]}]; Draw2D[ {basicgraphics /. DrawingTransform[#1 &, Log10@#2 &]}, AspectRatio -> 1, Frame -> True, FrameTicks -> {{ylogticks, ylogticks // NoTickLabels}, {xlogticks, xlogticks // NoTickLabels}}, GridLines -> {xloggrids, yloggrids}, ImageSize -> 350] The basicgraphics look like: {{{}, {}, {Line[{{1., 10.}, {1.00123, 10.0283}, {1.00245, 10.0567}, {1.00491, 10.1136}, {1.00981, 10.2286}, {1.01963, 10.4623}, {1.03926, 10.946}, {1.07851, 11.9816}, ...., {4.99176, 98121.2}, {4.99451, 98743.5}, {4.99588, 99056.1}, {4.99725, 99369.8}, {4.99863, 99684.4}, {5., 100000.}}]}}} David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Szabolcs Horv=E1t [mailto:szhorvat at gmail.com] Why does LogLogPlot evaluate its argument outside the given range? Example: LogLogPlot[ Interpolation[Table[10^{i, i}, {i, 1, 5}]][x] // Evaluate, {x, 10, 100000}] InterpolatingFunction::dmval: Input value {2.30277} lies outside the range of data in the interpolating function. Extrapolation will be used. This is bad, even if intentional, because the function passed to plot might be written with the assumption that it will never receive arguments outside certain bounds.