Let x be real valued random variable taking values on $a_1,\ldots, a_n$. Let $\Pr(x=a_i)=p_i$. Let $f$ be real valued function defined on $a_1, \ldots, a_n$
It is known that $ E(f(x))=\sum_{i=1}^nf(a_i)p_i. $
Would be the same formula true for $E(|f(x)|)$, i. e. $ E(|f(x)|)=\sum_{i=1}^n|f(a_i)|p_i? $
Thank you.