MathGroup Archive 2003

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

Search the Archive

RE: Variable number of intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40451] RE: [mg40437] Variable number of intervals
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 6 Apr 2003 04:34:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Vadim,

Would this simpler definition work for you?

Needs["Graphics`Colors`"]

f[x_, n_] := Ceiling[n x]/n

Plot[{f[x, 3], f[x, 7], f[x, 12]}, {x, 0, 1}, 
    PlotStyle -> {Black, Red, Peacock}];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


From: Vadim Nagornyi [mailto:vnagornyi at netscape.net]
To: mathgroup at smc.vnet.net

Hello,
here is the function that grows on unit interval in 12 steps:

n=12;
Map[(g[x_]:=#/n/;(#-1)/n<=x<=#/n)&,Range[n]];
Plot[g[x], {x,0,1}]

Now, changing n in the first line we can get different number of
steps.
Instead, I would like to make n the function parameter: g[x_,n_] and
define it when plotting, like

Plot[{g[x,3],g[x,7],g[x,12]}, {x,0,1}]

How to to this?
Thanks.
Vadim.



  • Prev by Date: RE: anyone good in stereographic projections?
  • Next by Date: Re: Variable number of intervals
  • Previous by thread: Re: Variable number of intervals
  • Next by thread: Re: Variable number of intervals