# ito_formula function

Itô's lemma: the differential of an expression of states that follow an Itô process.

## How to write it

### ito_formula(f, states, drift, diffusion, time)

Gives the rule ito_differential(f) -> {dt: ..., dw: \[...\]}; a note says when it holds.

**f**

The expression of the states and time that is differentiated. Takes an expression.

**states**

The state variables, in brackets. Takes a list of variables, or a variable.

**drift**

The drift of each state, in brackets. Takes a list.

**diffusion**

The noise: one row for each state, one column for each driver. Takes a matrix, written as a list of rows.

**time**

The time, a variable. Takes a variable, or a list of variables.

### ito_formula(f, states, drift, diffusion, time)

For one state and one driver, the call without lists; the answer is the same.

**f**

The expression of the state and time that is differentiated. Takes an expression.

**states**

The one state variable, without a list. Takes a variable, or a list of variables.

**drift**

The drift of the state. Takes an expression.

**diffusion**

The noise of the state, for one driver. Takes an expression.

**time**

The time, a variable. Takes a variable, or a list of variables.

## Examples

- $\displaystyle \operatorname{ito\_formula}\left(x^{2}, \left[ x \right], \left[ \mu x \right], \begin{pmatrix} \sigma x \end{pmatrix}, t\right) = \operatorname{ito\_differential}(x^{2}) \to \left[ \text{dt} \to \sigma^{2} x^{2}+2 \mu x^{2}, \text{dw} \to \left[ 2 \sigma x^{2} \right] \right]$

  `ito_formula(x^2, [x], [mu*x], [[sigma*x]], t)`

  In the solver, `ito_formula(x^2, [x], [mu*x], [[sigma*x]], t)` gives `ito_differential(x^2) -> {dt: sigma^2*x^2 + 2mu*x^2, dw: [2sigma*x^2]}`.

  [Open in the solver](https://hilberon.com/?q=ito_formula%28x%5E2%2C%20%5Bx%5D%2C%20%5Bmu*x%5D%2C%20%5B%5Bsigma*x%5D%5D%2C%20t%29)
- $\displaystyle \operatorname{ito\_formula}\left(x y, \left[ x, y \right], \left[ 0, 0 \right], \begin{pmatrix} s_{1} \\ s_{2} \end{pmatrix}, t\right) = \operatorname{ito\_differential}(x y) \to \left[ \text{dt} \to s_{1} s_{2}, \text{dw} \to \left[ s_{2} x+s_{1} y \right] \right]$

  `ito_formula(x*y, [x, y], [0, 0], [[s1], [s2]], t)`

  In the solver, `ito_formula(x*y, [x, y], [0, 0], [[s1], [s2]], t)` gives `ito_differential(x*y) -> {dt: s1*s2, dw: [s2*x + s1*y]}`.

  [Open in the solver](https://hilberon.com/?q=ito_formula%28x*y%2C%20%5Bx%2C%20y%5D%2C%20%5B0%2C%200%5D%2C%20%5B%5Bs1%5D%2C%20%5Bs2%5D%5D%2C%20t%29)
- $\displaystyle \mathrm{d}(X_{t}^{2}) \text{ where } \mathrm{d}X_{t} = \mu X_{t}\,\mathrm{d}t+\sigma X_{t}\,\mathrm{d}W_{t} \Rightarrow \mathrm{d}(X_{t}^{2}) = (\sigma^{2} X_{t}^{2}+2 \mu X_{t}^{2})\,\mathrm{d}t+2 \sigma X_{t}^{2}\,\mathrm{d}W_{t}$

  `ito_formula(x^2, x, mu*x, sigma*x, t)`

  In the solver, `ito_formula(x^2, x, mu*x, sigma*x, t)` gives `ito_differential(x^2) -> {dt: sigma^2*x^2 + 2mu*x^2, dw: [2sigma*x^2]}`.

  [Open in the solver](https://hilberon.com/?q=ito_formula%28x%5E2%2C%20x%2C%20mu*x%2C%20sigma*x%2C%20t%29)
- $\displaystyle \mathrm{d}(\ln(X_{t})) \text{ where } \mathrm{d}X_{t} = \mu X_{t}\,\mathrm{d}t+\sigma X_{t}\,\mathrm{d}W_{t} \Rightarrow \mathrm{d}(\ln(X_{t})) = \left(\mu-\frac{\sigma^{2}}{2}\right)\,\mathrm{d}t+\sigma\,\mathrm{d}W_{t}$

  `ito_formula(ln(x), x, mu*x, sigma*x, t)`

  In the solver, `ito_formula(ln(x), x, mu*x, sigma*x, t)` gives `ito_differential(ln(x)) -> {dt: mu - sigma^2/2, dw: [sigma]}`.

  [Open in the solver](https://hilberon.com/?q=ito_formula%28ln%28x%29%2C%20x%2C%20mu*x%2C%20sigma*x%2C%20t%29)

## Related functions

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

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

  The Itô integral of an expression of the Wiener value w and the time s, from 0 to t.
- [ito_process](https://hilberon.com/library/ito_process)

  A process given by its drift and diffusion: dX = drift dt + diffusion dW.
- [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.
- [geometric_brownian_motion_process](https://hilberon.com/library/geometric_brownian_motion_process)

  A process that grows at rate mu with relative noise sigma, started at x0.
- [fit](https://hilberon.com/library/fit)

  The least-squares fit of a combination of functions through points.

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