I have the function below and I'm trying to calculate the expectancy of X. The answer is E(X) = $\frac{59}{40}$ but I don't know what I'm doing wrong because I cannot achieve it.
F(x) = \begin{cases} 0, & \text{if $x$ < 0} \\ \frac{1}{4}, & \text{if 0 $\le$ $x$ < 1} \\ \frac{2}{5}, & \text{if 1 $\le$ $x$ < 2} \\ \frac{2x-3}{2}, & \text{if 2 $\le$ $x$ < 2.5} \\ 1, & \text{if $x$ $\ge$ 2.5} \\ \end{cases}
I did like that
$$E(X) = \frac{1}{4}*1 + \frac{2}{5}*1 + \int_2^{2.5} \frac{2x-3}{2} dx$$
which gave me thw wrong answer. I'm sure if the problem is in the computation of the integral (I'm a little bit rusty in calculus) or of the problem is the concept of my calculations as a whole
Its the Cumulative distribution function you have there not the probability density function. You have to convert the CDF first if you want to calculate the expected value of $X$. Or use
$$E(X) = \int_0^\infty (1-F_X (x)) \, dx = \frac{3}{4} + \frac{3}{5} + \frac{1}{8} = \frac{59}{40}$$