Suppose that $X$ follows a beta distribution with parameters $\alpha > 0$, $\beta > 0$. I want to calculate $$\frac{\int_c^1 x f(x) dx}{P(X \geq c)} - \frac{\int_0^c x f(x) dx}{P(X \leq c)}$$
for some constant $c \in (0, 1)$.
I have tried the following code. While it works in the $\alpha = \beta = 1$ case, it seems won't run (at least in a reasonable amount of time) in other cases. What am I doing wrong? The code is below:
less[c_, \[Alpha]_, \[Beta]_] :=
Integrate[x PDF[BetaDistribution[\[Alpha], \[Beta]], x], {x, 0, c}]/
CDF[BetaDistribution[\[Alpha], \[Beta]], c]
more[c_, \[Alpha]_, \[Beta]_] :=
Integrate[
x PDF[BetaDistribution[\[Alpha], \[Beta]], x], {x, c, 1}]/(1 -
CDF[BetaDistribution[\[Alpha], \[Beta]], c])
diff[c_, \[Alpha]_, \[Beta]_] :=
more[c, \[Alpha], \[Beta]] - less[c, \[Alpha], \[Beta]]
Plot[diff[c, 0.5, 0.5], {c, 0, 1}]