Question: How to compute te expectation of an abstract random variable?

Let E be a random variable of expectation mu and A an algebraic expression containing no random variable.
If E has any known Maple distribution, then  Mean(A+E) = A+mu.

But if E is an "abstract" random variable, Mean doesn't seem capable to compute the expectation of A+E.
Notional example:

E := RandomVariable(Normal(mu, sigma)):
                           f(x) + mu
E := RandomVariable(Distribution(PDF = (z -> f(z)), Mean=mu)):
     int((f(x) + _t) f(_t), _t = -infinity .. infinity)

        f(x) (int(f(_t), _t = -infinity .. infinity)) + (int(f(_t) _t, _t = -infinity .. infinity))


  • Why does Mean not behave as expected for an abstract random variable?
  • Is there a simple way to obtain the expected result (Mean (A+E) = A+mu) (maybe by completing the definition of the distribution of E, or by any other means)?


PS: I know that I can replace Mean(A+E)  by A+Mean(E)  to obtain the desired result: this is not the type of answer I look for.

PS: I know (since Carl Love showed me how long ago) that I can define a "random variable" plus an operator Expectation such that Expectation(A+E)  by A+Expectation(E) ... but it's not a way I would call simple

Expectation := proc(e::algebraic)
     local a,b;
     if not hastype(e, RV) then e
     elif e::RV then 'procname'(e)
     elif e::`+` then map(thisproc, e)
     elif e::`*` then
          (a,b):= selectremove(hastype, e, RV);
     else 'procname'(e)
     end if
end proc:


     '`*`'({RandomVariable, 'RandomVariable^posint'})
eval(Expectation(f(x)+E), Expectation=Mean)
                           f(x) + mu


Please Wait...