How to define an expectation operator

asked 2024-01-25 20:06:33 +0200

Cyrille gravatar image

updated 2024-01-25 20:15:00 +0200

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

edit retag flag offensive close merge delete


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

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-01-25 21:44:35 +0200 )edit