MathGroup Archive 2012

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

Search the Archive

Re: LogLogPlot encounters Infinite expression

  • To: mathgroup at
  • Subject: [mg126163] Re: LogLogPlot encounters Infinite expression
  • From: "djmpark" <djmpark at>
  • Date: Sun, 22 Apr 2012 06:06:00 -0400 (EDT)
  • Delivered-to:
  • References: <581857.12253.1334983314299.JavaMail.root@m06>

This looks like a bug in the internal initial processing for LogLogPlot,
possibly in trying to determine the y axis Range - although I don't know why
it would do that first.

If one does the following, the routine never samples outside of the
specified domain.

f[x_] := Piecewise[{{0.001, x < 10}}, Exp[x/20]] 
Reap[LogLogPlot[1/f[x], {x, 11, 20},
  EvaluationMonitor :> Sow[x]]] 

If we change back to zero, it bombs before sowing any x values.

The simplest solution is to modify the plot function for the purpose of this
particular plot.

LogLogPlot[1/Exp[x/20], {x, 11, 20}] 

With the Presentations Application you could specify the ticks and roll your
own LogLog curve with some extra work but without having to modify the f

<< Presentations` 

xticks = CustomTicks[Log, {1, 2, {12, 14, 16, 18, 20}/10, {}}];
yticks = CustomTicks[Log, {-1, 0, Range[3.5, 6, 0.5], {}}];
 {Draw[Log[1/f[E^logx]], {logx, Log[11], Log[20]}]},
 AspectRatio -> 0.6,
 Axes -> True,
 Ticks -> {xticks, yticks}]

David Park
djmpark at 

From: John_V [mailto:jvillar.john at] 

If I try this:

f[x_] = Piecewise[{{0, x < 10}}, Exp[x/20]] LogLogPlot[1/f[x], {x, 11, 20}]

the result is an error message (Infinite expression 1/0 encountered) and a
plot that has axes but no graph.

Notice that although 1/f is indeed 1/0 for x<10, the requested plot range
does not include x<10. The function is well-defined within the requested
plot range. Does anyone know what's going on with this?


  • Prev by Date: Re: evaluating functions and displaying results numerically
  • Next by Date: Re: Extract coefficients of a trig polynomial
  • Previous by thread: Re: LogLogPlot encounters Infinite expression
  • Next by thread: evaluating functions and displaying results numerically