Re: defining function on mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg22293] Re: defining function on mathematica
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Wed, 23 Feb 2000 01:01:25 -0500 (EST)
- References: <88snik$ipe@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <88snik$ipe at smc.vnet.net>, Elisha Kobre <ekobre at erols.com> 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 the > 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 them. > > I'll Be glad to provide more details. > > Thanks > > Elisha Kobre > Elisha, 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 noticeable. Cheers, Br Sent via Deja.com http://www.deja.com/ Before you buy.