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

Warren Weckesser warren.weckesser at gmail.com
Wed Sep 25 14:02:27 EDT 2013

```On Wed, Sep 25, 2013 at 1:41 PM, David Goldsmith <d.l.goldsmith at gmail.com>wrote:

> Thanks, guys.  Yeah, I realized the problem w/ the
> uniform-increment-variable-direction approach this morning: physically, it
> ignores the fact that the particles hitting the particle being tracked are
> going to have a distribution of momentum, not all the same, just varying in
> direction.  But I don't quite understand Warren's observation: "the
> 'angles' that describe the position undergo a random walk [actually, it
> would seem that they don't, since they too fail the varying-as-white-noise
> test], so the particle tends to move in the same direction over short
> intervals"--is this just another way of saying that, since I was varying
> the angles by -1, 0, or 1 unit each time, the simulation is susceptible to
> "unnaturally" long strings of -1, 0, or 1 increments?  Thanks again,
>

Note: I was interpreting your code as the discretization of a stochastic
process, and I was experimenting with values of `incr` that were small,
e.g. `incr = 0.01`.

This code

t = 2*np.pi*incr*(R.randint(3, size=(N,))-1)
t[0] = 0
t = t.cumsum()

makes `t` a (discrete) random walk.  At each time step, t either remains
the same, or changes by +/- 2*np.pi*incr.  If `incr` is small, then `t[1]`
is a small step from `t[0]`.  Similarly, `p[1]` will be close to `p[0]`.
So the particle "remembers" its direction.  A particle undergoing Brownian
motion does not have this memory.

Warren

> DG
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130925/1ac2ff97/attachment.html>
```