The mathematical expectation of a continuously distributed random variable X with probability density function f(x) is
The expectation is also known as the mean of X.
The expectation with respect to some function g(X) where X is distributed according to f(x) is
For a discretely distributed random variable X with probability mass function pk it is
E[X] = ∑ pkxk. k