Suppose $X$ is a positive random variable with discrete distribution: $$ X = \begin{cases} x_0 & \text{with probability } p \\ x_1 & \text{with probability } 1-p \end{cases} $$ where $x_1 < x_0$.
I want to simplify $\mathbb{E}_X\left[ f (X) \right]$ where: \begin{equation} f\left(X\right)=-\alpha X -\gamma\max\left(0,Z-X\right) \end{equation} with $Z\geq 0$ and $\alpha,\gamma\in\mathbb{R}$.
$$\begin{align*}\mathbb{E}_X\left[ f (X) \right] & = p \cdot f(x_0) + (1-p) \cdot f(x_1) = \\ & = -\alpha x_0p - \gamma \max(0, Z - x_0)p-\alpha x_1(1-p) - \gamma \max(0, Z - x_1)(1-p) = \\ & = \begin{cases} -\alpha x_0p -\alpha x_1(1-p) & \text{if}~ Z < x_1 < x_0 \\ -\alpha x_0p -\alpha x_1(1-p)- \gamma (Z - x_1)(1-p) & \text{if}~ x_1 < Z < x_0 \\ -\alpha x_0p- \gamma (Z - x_0)p -\alpha x_1(1-p)- \gamma (Z - x_1)(1-p) & \text{if}~ x_1 < x_0 < Z\\ \end{cases} \end{align*}$$