欢迎光临散文网 会员登陆 & 注册

【Python 编程】1D 随机游走 1D Random Walk

2021-09-13 18:43 作者:AoiSTZ23  | 我要投稿

By: Tao Steven Zheng (郑涛)


A random walk is a stochastic process that describes a path that consists of a succession of random steps on some mathematical space such as the integers. The following Python code generates three 1-dimensional random walks and plots them. Each plot starts at 0 and at each step moves up (+1) or down (−1) with equal probability.

随机游动(random walk)是一种随机过程(stochastic process),它描述了在某些数学空间(如整数)上由一系列随机步骤组成的随机游动。以下的 Python 代码生成三个一维随机游动并绘制它们。每个绘图从 0 开始,每一步以同样的概率可以向上(+1)或向下 (−1)移动。

 Results

结果

Looks like the stock market!

看上去像股市!


【Python 编程】1D 随机游走 1D Random Walk的评论 (共 条)

分享到微博请遵守国家法律