MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: LogLogPlot evaluates argument outside given range

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103347] Re: LogLogPlot evaluates argument outside given range
  • From: pfalloon <pfalloon at gmail.com>
  • Date: Wed, 16 Sep 2009 05:48:33 -0400 (EDT)
  • References: <h8nj0d$cdp$1@smc.vnet.net>

On Sep 15, 6:24 pm, Szabolcs Horv=E1t <szhor... at gmail.com> wrote:
> 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.

This looks to me like some kind of bug in the "preprocessing" part of
the LogLogPlot function, since the offending value doesn't show up in
the EvaluationMonitor:

f[x_ /; 10 <= x <= 10^5] = Interpolation[Table[10^{i, i}, {i, 1, 5}]]
[x]

LogLogPlot[f[x], {x, 20, 100000}, EvaluationMonitor:>Print["x = ",
x]]

This suggests that somewhere before the main set of points is
evaluated there is a step which uses the incorrect value. It turns out
that the number in question (2.30277) is equal to Log[10], and playing
around with the lower limit of x we see this is always the case. So,
I'd guess there's some step at which it should be evaluating f[xmin],
but it's actually evaluating f[Log[xmin]].

I'd suggest contacting support at wolfram.com in case they're not aware
of this one..

In the meantime, one workaround is to define your function so that it
only evaluates with arguments in the desired range, e.g.:

f[x_ /; 10 <= x <= 10^5] = Interpolation[Table[10^{i, i}, {i, 1, 5}]]
[x]

LogLogPlot[f[x], {x, 20, 100000}, EvaluationMonitor:>Print["x = ", x]]

Cheers,
Peter.


  • Prev by Date: Re: Limit computed incorrectly
  • Next by Date: Speed up calculating the pair correlation function for 2D point data
  • Previous by thread: LogLogPlot evaluates argument outside given range
  • Next by thread: Re: LogLogPlot evaluates argument outside given range