MathGroup Archive 1996

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

Search the Archive

Re: 2-D Levy motion


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] ====


  • Prev by Date: Re: HELP:problems simplifying big matrices
  • Next by Date: Numerical integration
  • Previous by thread: Re: HELP:problems simplifying big matrices
  • Next by thread: Numerical integration