MathGroup Archive 2002

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

Search the Archive

Re: Plot a sample path of a bornian motion


"Kees" <keesvanschaik at wanadoo.nl> wrote in message news:<aeencs$9nh$1 at smc.vnet.net>...
> Hi,
> 
> I'm relatively new to Mathematica and am wondering how it's possible to plot
> a sample path of a (one-dimensional) Brownian motion. Any ideas?
> 
> Thanks in advance!

A couple of Do loops and the random function work.

1-D motion

num = 1000; (*number of points to plot*)
data = {};
newvalue = 0; (*initial strting position*)
Do[
   oldvalue = newvalue + Random[Real, {-1, 1}];
   data = Append[data, oldvalue];
   newvalue = oldvalue
 , {num}]
ListPlot[data, PlotJoined -> True]

2-D Motion

num = 1000;
datax = {};
datay = {};
newxvalue = 0;
newyvalue = 0;
Do[
   oldxvalue = newxvalue + Random[Real, {-1, 1}];
   datax = Append[datax, oldxvalue];
   newxvalue = oldxvalue;
   oldyvalue = newyvalue + Random[Real, {-1, 1}];
   datay = Append[datay, oldyvalue];
   newyvalue = oldyvalue
  , {num}]

dataxy = Transpose[{datax, datay}];
ListPlot[dataxy, PlotJoined -> True]

--JDW


  • Prev by Date: Re: Problem with hypergeometric function
  • Next by Date: RE: Definitions of the functions
  • Previous by thread: Re: Plot a sample path of a bornian motion
  • Next by thread: Meijer G Function