# ornstein_uhlenbeck_process 函数

以速率 theta 被拉向 mu、噪声为 sigma、从 x0 开始的随机过程。

## 怎么写

### ornstein_uhlenbeck_process(mu, sigma, theta, x0)

表示它自身；mean、variance、pdf 和 stationary_distribution 会读取它。

**mu**

被拉向的水平：dX = theta (mu - X) dt + sigma dW。接受一个表达式。

**sigma**

噪声，大于 0。接受一个表达式。

**theta**

拉回的速率，大于 0。接受一个表达式。

**x0**

起始值。接受一个表达式。

### ornstein_uhlenbeck_process(mu, sigma, theta)

没有起始值时表示平稳过程，stationary_distribution 会读取它。

**mu**

被拉向的水平。接受一个表达式。

**sigma**

噪声，大于 0。接受一个表达式。

**theta**

拉回的速率，大于 0。接受一个表达式。

## 示例

- $\displaystyle E[X_{t}],\ X \sim \operatorname{OU}(\mu, \sigma, \theta, x_{0}) = \frac{x_{0}-\mu}{e^{t \theta}}+\mu$

  `mean(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)`

  在求解器中，`mean(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)` 的结果是 `e^(-t*theta)*(x0 - mu) + mu`。

  [在求解器中打开](https://zh.hilberon.com/?q=mean%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%2C%20x0%29%2C%20t%29)
- $\displaystyle \operatorname{Var}(X_{t}),\ X \sim \operatorname{OU}(\mu, \sigma, \theta, x_{0}) = \begin{cases} \frac{\sigma^{2} \left(1-\frac{1}{e^{2 t \theta}}\right)}{2 \theta} & \text{if } \theta \neq 0 \end{cases}$

  `variance(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)`

  在求解器中，`variance(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)` 的结果是 `(1/2)sigma^2*(1 - e^(-2t*theta))/theta if theta != 0`。

  [在求解器中打开](https://zh.hilberon.com/?q=variance%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%2C%20x0%29%2C%20t%29)
- $\displaystyle \operatorname{OU}(\mu, \sigma, \theta) \Rightarrow X_{\infty} \sim \mathcal{N}\left(\mu, \frac{\sqrt{2} \sigma}{2 \sqrt{\theta}}\right)$

  `stationary_distribution(ornstein_uhlenbeck_process(mu, sigma, theta))`

  在求解器中，`stationary_distribution(ornstein_uhlenbeck_process(mu, sigma, theta))` 的结果是 `normal_distribution(mu, (1/2)sqrt(2)*sigma/sqrt(theta))`。

  [在求解器中打开](https://zh.hilberon.com/?q=stationary_distribution%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%29%29)

## 示例中用到的函数

- [mean](https://zh.hilberon.com/library/mean)

  一组数的平均值，或分布的期望值。
- [variance](https://zh.hilberon.com/library/variance)

  一组数的样本方差，或一个分布的方差。
- [stationary_distribution](https://zh.hilberon.com/library/stationary_distribution)

  过程随时间趋于的分布，若存在的话。

## 相关函数

- [ito_process](https://zh.hilberon.com/library/ito_process)

  由漂移项和扩散项给出的过程：dX = drift dt + diffusion dW。
- [wiener_process](https://zh.hilberon.com/library/wiener_process)

  带漂移 mu 和噪声 sigma、从 0 开始的布朗运动。
- [geometric_brownian_motion_process](https://zh.hilberon.com/library/geometric_brownian_motion_process)

  以速率 mu 增长、相对噪声为 sigma、从 x0 出发的过程。
- [pdf](https://zh.hilberon.com/library/pdf)

  分布在某点处的密度，或离散分布取某值的概率。
- [normal_distribution](https://zh.hilberon.com/library/normal_distribution)

  均值为 mu、标准差为 sigma 的正态分布。
- [poisson_distribution](https://zh.hilberon.com/library/poisson_distribution)

  在一段时间内以平均速率 lambda 发生的事件的次数。

---
Source: https://zh.hilberon.com/library/ornstein_uhlenbeck_process
