MathGroup Archive 2001

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

Search the Archive

Re: Behaviour of Plot/ListPlot & Export

  • To: mathgroup at
  • Subject: [mg31771] Re: [mg31722] Behaviour of Plot/ListPlot & Export
  • From: BobHanlon at
  • Date: Sat, 1 Dec 2001 02:45:48 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 2001/11/29 3:07:25 AM, steve at writes:

>Mathematica on Linux
>If I try
>Plot[Sqrt[Prime[n]/Prime[n + 1]], {n, 1, 100}]
>I get:
>Prime::"intpp": "Positive integer argument expected in \
>Prime::"intpp": "Positive integer argument expected in \
>Prime::"intpp": "Positive integer argument expected in \
>And a bunch more errors, however if I try
>ListPlot[Table[Sqrt[Prime[n]/Prime[n + 1]], {n, 1, 100}]]
>Then it works fine. Presumably Table[x,{x,1,100}] steps through integers
>while Plot does not. This is surprising, I expected the same behaviour
>of them. Is this a bug? Is this documented (I did look around)?

Prime requires its argument to be a positive integer.  The PlotPoints used by 
Plot are generally not integers, for example look at

Plot[n,{n,1,100}, DisplayFunction->Identity][[1,1,1,1]]

You can restrict the arguments to Prime (1) as you did using ListPlot and a 
Table, or (2) Round or truncate n.

p1 = Plot[Sqrt[Prime[Floor[n]]/Prime[Floor[n+1]]],{n,1,100}];

While the default setting for PlotPoints is 25, the PlotPoints adjust 
automatically to try and capture detail.  The abrupt changes in this plot
resulted in many more PlotPoints



Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: Symbolize
  • Next by Date: Re: Very difficult axes inversion?? How to???
  • Previous by thread: Re: Symbolize
  • Next by thread: Re: Behaviour of Plot/ListPlot & Export