Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

brownian.motion

Demonstration of Brownian motion on the 2D plane


Description

Brownian motion, or random walk, can be regarded as the trace of some cumulative normal random numbers.

Usage

brownian.motion(n = 10, xlim = c(-20, 20), ylim = c(-20, 20), ...)

Arguments

n

Number of points in the scatterplot

xlim, ylim

Arguments passed to plot.default to control the apperance of the scatterplot (title, points, etc), see points for details.

...

other arguments passed to plot.default

Details

The location of the next step is “current location + random Gaussian numbers”, i.e.,

x[k + 1] = x[k] + rnorm(1)

y[k + 1] = y[k] + rnorm(1)

where (x, y) stands for the location of a point.

Value

None (invisible NULL).

Note

The maximum number of steps in the motion is specified in ani.options('nmax').

Author(s)

Yihui Xie

References

See Also


animation

A Gallery of Animations in Statistics and Utilities to Create Animations

v2.6
GPL
Authors
Yihui Xie [aut, cre], Christian Mueller [ctb], Lijia Yu [ctb], Weicheng Zhu [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.