[Numpy-discussion] Valid algorithm for generating a 3D Wiener Process?

Neal Becker ndbecker2 at gmail.com
Wed Sep 25 09:36:50 EDT 2013


David Goldsmith wrote:

> Is this a valid algorithm for generating a 3D Wiener process?  (When I
> graph the results, they certainly look like potential Brownian motion
> tracks.)
> 
> def Wiener3D(incr, N):
>     r = incr*(R.randint(3, size=(N,))-1)
>     r[0] = 0
>     r = r.cumsum()
>     t = 2*np.pi*incr*(R.randint(3, size=(N,))-1)
>     t[0] = 0
>     t = t.cumsum()
>     p = np.pi*incr*(R.randint(3, size=(N,))-1)
>     p[0] = 0
>     p = p.cumsum()
>     x = r*np.cos(t)*np.sin(p)
>     y = r*np.sin(t)*np.sin(p)
>     z = r*np.cos(p)
>     return np.array((x,y,z)).T
> 
> Thanks!
> 
> DG

Not the kind of Wiener process I learned of.  This would be the integral of 
white noise.  Here you have used:

1. discrete increments
2. spherical coordinates




More information about the NumPy-Discussion mailing list