Possible Duplicate:
Given a random variable with probability density function f(x), how to compute the expected value of this random variable in R?
Given a random variable with probability density function f(x), how to compute the expected value of this random variable in R?