Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: defining function on mathematica

  • To: mathgroup at
  • Subject: [mg22293] Re: defining function on mathematica
  • From: Brian Higgins <bghiggins at>
  • Date: Wed, 23 Feb 2000 01:01:25 -0500 (EST)
  • References: <88snik$>
  • Sender: owner-wri-mathgroup at

In article <88snik$ipe at>,
  Elisha Kobre <ekobre at> wrote:
> Hi,
> Could someone PLEASE help with the following mathematica progrmming
> problem:
> I have a family of functions indexed by w where w lies in the interval
> [0,1). The functions are f[x_]:= x+ w +1/1000 Sin[2 Pi x]. I want to
> define (AND PLOT) a function h[w] where for each value of w, h[w] is
> 1000th iterate of f (with the specific w inserted into f) on x=0
> ,divided by 1000 ---(this is supposed to approximate the so called
> rotation number). The graph of h[w] is called a devils staircase. How
> can we define h so it works and we get a good plot ?
> I have tried nest, fold etc.... but run into problems with all of
> I'll Be glad to provide more details.
> Thanks
> Elisha Kobre
The following code appears to produce the Devil's staircase from the
rotation map:
f[x_, w_] := x + w + (0.2) Sin[2 Pi x]
h[w_] := Nest[f[#, w] &, .1, 1000]
data = Table[{w, h[w]}, {w, 0, 1, .005}];
ListPlot[data, PlotJoined -> True, PlotRange -> All]

You can also use Plot but is not efficient (takes a long time to plot)

Plot[h[w], {w, 0, 1}, PlotPoints -> 30]

Note that if the factor in front of the Sin function is reduced to
1/1000 as you suggest, then the structure of the staircase is hardly


Sent via
Before you buy.

  • Prev by Date: Re: Weird Plot behavior...
  • Next by Date: Re: Weird Plot behavior...
  • Previous by thread: defining function on mathematica
  • Next by thread: Q: pattern and simplify