given some random variable $X$, and function $g(x)$.
Exists some formula so that I will can calculate $E(g(X))$ quickly and easily?
I ask about some random variable $X$ (without any limitation).
I will be happy to learn new things :)
given some random variable $X$, and function $g(x)$.
Exists some formula so that I will can calculate $E(g(X))$ quickly and easily?
I ask about some random variable $X$ (without any limitation).
I will be happy to learn new things :)
On
You should state the measure relative to your expectation.
If $X$ follows the Dirac measure at $0$, then yes, $\, E\left(g\left(X\right)\right) = g\left(0\right) \,$.
If $X$ follows a law based on the classic Lebesgue measure $dx$ then no, there is no general way to compute an integral ; in fact we are not able to give an exact value for most functions. As an example, there is no exact value of the integral $\, \int_0^1 e^{-x^2} dx$, which can be interpreted as either the expectation of $\, g\left(X\right) \,$ when $X$ follows the uniform law over $[0;1]$ and $\, g\!\left(x\right) = e^{-x^2} \,$, or the expectation of $\, g\left(X\right) \,$ when $X$ follows the normal law (ie Gaussian of mean $0$ and variance $1$) and $\, g(x) = \sqrt{\pi} 1_{x\in[0;\sqrt{2}]} \,$.
So, in general, if you want a precise value of an integral you often have to rely on a computer (and an algorithm) to get a more or less good approximation value of the integral.
There are countless methods to try and find the exact value of an integral though ; some of the first ideas you will come upon is integration by parts, change of coordinates, then, later, the residue theorem and the Lebesgue theorem. They will enlarge the set of functions you will be able to integrate exactly, but, as I said, most integrals will not have an exact value.
If you want to know more, or have an idea of the span and complexity of the subject, look for "Integration theory" or "Measure theory".
I hope I did understand your question, and, in any case, I wish you well.
If $X$ is a random variable with value in $S$, and $g:S\to \mathbb{R}$ a real function, then you can use the formula $$ E[g(X)]=\sum_{x\in S}g(x)p_X(x) \ \ \ \ \ \ \ \ \ \ \text{for $X$ discrete random variable} $$ and $$ E[g(x)]= \int_{-\infty}^{+\infty}g(x)f_X(x)\ \ \ \ \ \ \ \ \ \ \text{for $X$ continuous random variable} $$