# ito_integral function

The Itô integral of an expression of the Wiener value w and the time s, from 0 to t.

## How to write it

### ito_integral(h, w, s, time)

Gives the law of the integral of a function of s, or its value by Itô's formula; mean and variance read it.

**h**

The integrand, an expression of w and s; ito_integral(w, w, s, t) is the integral of W dW. Takes an expression.

**w**

The Wiener process's value: W(s) in the integrand, W(t) in the answer. Takes a variable, or a list of variables.

**s**

The time in the integrand, the integration variable. Takes a variable, or a list of variables.

**time**

The upper limit t, a variable or a number: the integral runs from 0 to t. Takes a variable, or a list of variables.

## Examples

- $\displaystyle \int_{0}^{t} W_{s} \, dW_{s} = \frac{W_{t}^{2}}{2}-\frac{t}{2}$

  `ito_integral(w, w, s, t)`

  In the solver, `ito_integral(w, w, s, t)` gives `w^2/2 - t/2`.

  [Open in the solver](https://hilberon.com/?q=ito_integral%28w%2C%20w%2C%20s%2C%20t%29)
- $\displaystyle \int_{0}^{t} W_{s}^{2} \, dW_{s} = \frac{W_{t}^{3}}{3}-\int_{0}^{t} W_{s} \, ds$

  `ito_integral(w^2, w, s, t)`

  In the solver, `ito_integral(w^2, w, s, t)` gives `w^3/3 - brownian_time_integral(w(s), [s, 0, t], w)`.

  [Open in the solver](https://hilberon.com/?q=ito_integral%28w%5E2%2C%20w%2C%20s%2C%20t%29)
- $\displaystyle \int_{0}^{t} e^{s} \, dW_{s} \sim \mathcal{N}\left(0, \sqrt{\frac{e^{2 t}}{2}-\frac{1}{2}}\right)$

  `ito_integral(exp(s), w, s, t)`

  In the solver, `ito_integral(exp(s), w, s, t)` gives `normal_distribution(0, sqrt(e^(2t)/2 - 1/2))`.

  [Open in the solver](https://hilberon.com/?q=ito_integral%28exp%28s%29%2C%20w%2C%20s%2C%20t%29)
- $\displaystyle \operatorname{Var}\left(\int_{0}^{t} W_{s} \, dW_{s}\right) = \frac{t^{2}}{2}$

  `variance(ito_integral(w, w, s, t))`

  In the solver, `variance(ito_integral(w, w, s, t))` gives `t^2/2`.

  [Open in the solver](https://hilberon.com/?q=variance%28ito_integral%28w%2C%20w%2C%20s%2C%20t%29%29)
- $\displaystyle E\left[\int_{0}^{t} W_{s}^{2} \, dW_{s}\right] = 0$

  `mean(ito_integral(w^2, w, s, t))`

  In the solver, `mean(ito_integral(w^2, w, s, t))` gives `0`.

  [Open in the solver](https://hilberon.com/?q=mean%28ito_integral%28w%5E2%2C%20w%2C%20s%2C%20t%29%29)

## Functions its examples use

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

  Exponential function; exp(x) is the power e^x.
- [variance](https://hilberon.com/library/variance)

  The sample variance of a list of numbers, or the variance of a distribution.
- [mean](https://hilberon.com/library/mean)

  The average of a list of numbers, or the expected value of a distribution.

## Related functions

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

  A process given by its drift and diffusion: dX = drift dt + diffusion dW.
- [ito_formula_data](https://hilberon.com/library/ito_formula_data)

  The certified record behind ito_formula: its result, validity, certificate and theorem.
- [ito_formula](https://hilberon.com/library/ito_formula)

  Itô's lemma: the differential of an expression of states that follow an Itô process.
- [median](https://hilberon.com/library/median)

  The middle value of a list of numbers, or the mean of the two middle ones.
- [geometric_sde_path](https://hilberon.com/library/geometric_sde_path)

  The path of dX = mu X dt + sigma X dW, as a function of the Wiener process's value w at time t.
- [mode](https://hilberon.com/library/mode)

  The most frequent value of a list, or a list of them when several are equally frequent.

---
Source: https://hilberon.com/library/ito_integral
