Re: 2-D Levy motion

*To*: mathgroup at smc.vnet.net*Subject*: [mg4738] Re: 2-D Levy motion*From*: gaylord at ux1.cso.uiuc.edu (richard j. gaylord)*Date*: Mon, 2 Sep 1996 01:51:28 -0400*Organization*: university of illinois*Sender*: owner-wri-mathgroup at wolfram.com

In article <508qjp$i02 at dragonfly.wolfram.com>, gaylord at ux1.cso.uiuc.edu (richard j. gaylord) wrote: > In article <508o0o$dp2 at dragonfly.wolfram.com>, deb at Alceon.com (David E. > Burmaster) wrote: > > > Dear MathGroup > > > > Does anyone have a program that simulates 2-D Levy motion, a type of random > > motion?? > > > hi dave: > > i do. > > -richard- i guess you want the program. i post this code with GREAT reluctance because it is VERY badly written [it uses Block because it was written in 1.x before Module was available and it uses Do (and also the AppendTo) because it was written before i had learned how to write a Mathematica program properly (ie., functionally)]. nonetheless, here it am for your use: note: the range of df is 1.0 -> 2.0 Clear[LevyDust] LevyDust[df_Real, steps_Integer] := Block[{points = {}, x = 0, y = 0, z, w}, Do[ z = (Random[])^(-1/df); w = (N[2 Pi] Random[]); x += (z Cos[w]); y += (z Sin[w]); AppendTo[points, {x, y}], {steps} ]; ListPlot[points, PlotJoined->True, AspectRatio->1] ]; LevyDust[1.0,100] LevyDust[1.5,100] LevyDust[2.0,100] -- "if you're not programming functionally, then you're programming dysfunctionally" ==== [MESSAGE SEPARATOR] ====