MathGroup Archive 2001

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

Search the Archive

Re: Behaviour of Plot/ListPlot & Export

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

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

>Mathematica 4.1.1.0 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[1.000004125`]\)."
>Prime::"intpp": "Positive integer argument expected in \
>\!\(Prime[1.000004125`]\)."
>Prime::"intpp": "Positive integer argument expected in \
>Prime[2.0000041250000002`]."
>
>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

Length[p1[[1,1,1,1]]]

664


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