Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

expectation function

The expected value of an expression of a variable with a distribution or a process.

How to write it

expectation(f, distribution)

The expected value of the expression.

f
The expression of the variable. Takes an expression.
distribution
The variable and its law, written distributed(x, d). Takes an expression.

Examples

  • E[x2], x∼N(0,1)=1\displaystyle E[x^{2}],\ x \sim \mathcal{N}(0, 1) = 1
    expectation(x^2, distributed(x, normal_distribution(0, 1)))

    In the solver, expectation(x^2, distributed(x, normal_distribution(0, 1))) gives 1.

    Open in the solver
  • E[etx], x∼N(μ,σ)=eσ2t22+μt\displaystyle E[e^{t x}],\ x \sim \mathcal{N}(\mu, \sigma) = e^{\frac{\sigma^{2} t^{2}}{2}+\mu t}
    expectation(exp(t x), distributed(x, normal_distribution(mu, sigma)))

    In the solver, expectation(exp(t x), distributed(x, normal_distribution(mu, sigma))) gives e^(sigma^2*t^2/2 + mu*t).

    Open in the solver

Functions its examples use

  • distributed

    A variable and the distribution it follows, as probability and expectation read it.

  • normal_distribution

    The normal distribution with mean mu and standard deviation sigma.

  • exp

    Exponential function; exp(x) is the power e^x.

  • exponential_distribution

    The waiting time for events that come at rate lambda.

  • fit

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

  • cvar

    The conditional value at risk of a loss: its expected value over the worst share 1 - level.

  • geometric_brownian_motion_process

    A process that grows at rate mu with relative noise sigma, started at x0.

  • covariance

    The sample covariance of two lists of the same length.

  • 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.