MathGroup Archive 2007

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

Search the Archive

Re: How to draw a discontinuous function (set of points)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79373] Re: [mg79302] How to draw a discontinuous function (set of points)
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 25 Jul 2007 02:22:18 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200707241001.GAA25284@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

First form the table of {x,y} points to be plotted, then use ListPlot 
for it.  In Mathematica 6:

  ListPlot[Table[Mod[x^2, 1000], {x, 0, 999}],
  PlotStyle -> {Hue[.6], PointSize[0.01]},
  AxesLabel -> {n, Mod[x^2, 1000]},
  BaseStyle -> {FontSize -> 14}]

(* the option FontFamily->"Times" is unnecessary, as that is now the 
default in graphics labeling *)

In Mathematica 5.2:

  ListPlot[Table[Mod[x^2, 1000], {x, 0, 999}],
  PlotStyle -> {Hue[.6], PointSize[0.01]},
  AxesLabel -> {n, Mod[x^2, 1000]},
  TextStyle -> {FontFamily -> "Times", FontSize -> 14}]

Domnul Mihnea wrote:
> Hello!
> 
> I would like to draw the graph of the following function in Mathematica 6, f : Zn -> Zn, f(x) = x^2 (mod n), n given. I wanted to use the plot function (n being 1000) as in:
> 
> Plot[Mod[x^2,1000], {x, 0, 999}, PlotStyle -> {Hue[.6], PointSize[0.01]}, AxesLabel -> {n, Mod[x^2,1000]}, TextStyle -> {FontFamily -> "Times", FontSize -> 14}]
> 
> The problem is that Plot draws the graph for ALL the real points x between 0 and 999 (the interval [0,999]), when I would require the function to be applied just to the set natural numbers from 0 to 999 (the graph should be just a set of points).
> 
> Thanks for reading my post! Any help would be more than welcome!
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: a challenging definite integral!
  • Next by Date: Re: Please help in creating/installing my package
  • Previous by thread: How to draw a discontinuous function (set of points)
  • Next by thread: Re: How to draw a discontinuous function (set of points)