How to define an expectation operator
Is there a way to define as a new operator the mathematical expectation.
Say we call it $\mathrm{M}$ as in the old Mir (russian books).
We should have
$\mathrm{M}(kX) = k\mathrm{M}(X)$
$\mathrm{M}(X \pm Y) = \mathrm{M}(X)\pm \mathrm{M}(Y)$
and as a résult
$\mathrm{M}(X -\mathrm{M}X)^2 =\mathrm{M}(X^2)- \mathrm{M}(X)^2$
and other result for variances and covariances
What do you intend $X$ to be ? A function ?, A distribution ? A random variable ? In the lattercase, Sage defines what you want for discrete random variables (and the doc explains why it does not do it for continuous random variables...).
If you want real random variables and the Lebesgue measure, integration should do what you want...
RTFM (again)...