Re: Weiner process
- To: mathgroup at smc.vnet.net
- Subject: [mg63909] Re: Weiner process
- From: "Valeri Astanoff" <astanoff at yahoo.fr>
- Date: Sat, 21 Jan 2006 04:58:47 -0500 (EST)
- References: <dqqc98$m0j$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Don wrote:
> For a Monte Carlo simulation I need samples of the Brownian motion
> (Wiener)process X(t), 0<t<1. Does anyone know of a data base where I can
> find them, or of a program to generate them?
This function, copied from the book
"Modelling financial derivatives with Mathematica"
by William T.Shaw, may be useful :
In[1]:= norm = Compile[{mu,sigma},
Module[{va=1.,vb,rad=2.0,den=1.},
While[rad >= 1.0,
(va = 2.*Random[]-1.0;
vb = 2.*Random[]-1.0;
rad = va*va+vb*vb)];
den = Sqrt[-2.0*Log[rad]/rad];
mu+sigma*va*den]];
Example :
In[2]:=
NestList[#+norm[0,1]&,0,10]
Out[2]=
{0,-0.564281,-0.35982,-0.962551,-1.04808,-1.40842,
-3.04235,-1.51069,-0.787503,-2.0541,-2.54072}
hth
v.a.