MathGroup Archive 2002

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

Search the Archive

Re: Plot Random Walk!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34404] Re: [mg34388] Plot Random Walk!
  • From: Hugh Walker <hwalker at gvtc.com>
  • Date: Sat, 18 May 2002 03:51:11 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Friday, May 17, 2002, at 05:31 AM, Andrea wrote:

> With this procedure i plot a randomwalk
>
> RandomWalk[n_]:=NetList[#+(-1)^Random[Integer ])&,0,n]
>
> ListPlot [RandomWalk[200],PlotJoined-->True]
>
>
>
> How can i plot for example 100 random walk on the same plot??
>
> Thankyou
>

I am not sure I understand your question, but the following code should 
produce 20 200-step random walks on one plot.  If you want 100 random 
walks just change 20 in the last step to 100.

randomWalkPic[n_,opts___]:=Module[ { },NestList[(#+(-1)^Random[Integer 
])&,0,n]; ListPlot [RandomWalk[200],PlotJoined->True,opts]]

pictures[reps_]:=Table[randomWalkPic[200, DisplayFunction -> 
Identity],{reps}];

Show[pictures[20], DisplayFunction -> $DisplayFunction]
============
   Hugh Walker
    Gnarly Oaks



  • Prev by Date: Subscripts
  • Next by Date: Re: cannot solve *trivial* equation
  • Previous by thread: RE: Plot Random Walk!
  • Next by thread: Re: Plot Random Walk!