This question builds on the great answers I got on an earlier question:
Can one extend the functionality of PDF, CDF, FindDistributionParameters etc in Mathematica?<
I'm not sure I really understand your question... The expected value or the mean, is the first moment of the distribution and can be calculated as
expectation := Integrate[x #, {x,-Infinity,Infinity}]&;
and use it as expectation[f[x]]
, where f[x]
is your pdf.
Your last code snippet doesn't work for me. I don't know if it is v8 code or if it is custom defined or if you're trying to say that is what you'd like your function to be like...
You can also try looking into Mathematica's ExpectedValue
function.
ExpectedValue[x, NormalDistribution[m, s], x]
Out[1] = m