I'm trying to use Mathematica to solve a problem involving any continuous probability distribution $F(t)$ such that:

$$\begin{align*} F(t)&=0, \; t\leq0\\ F(t)&=1, \; t\geq1 \end{align*}$$

For example, I'd like to evaluate the following expression:

$$\mathbb E[(A - F(t))\mathbf I_{F(t)<A}]$$

where $\mathbb E$ is the expectation operator, $A$ is a constant, and $\mathbf I$ is the indicator function.

My question is: how do I evaluate the expression above without assuming a particular probability distribution? I've searched here and elsewhere but wasn't able to find anything that I could use. (Although Expectation of a family of random variables seems related.)

  • 1
    $\begingroup$ Welcome to Mma.SE! Your question needs more from your side. Here its considered helpful and polite to show your own efforts and share your code attempts in a well formatted form, so we can quickly see the problem you are facing. Please help us to help you and edit your question accordingly. Also, please take the tour, it will help you understand the site. If you write an excellent question it will inspire great answers. $\endgroup$
    – rhermans
    Aug 23, 2017 at 9:07
  • $\begingroup$ Thank you, @rhermans for the comment, and J. M. for markdown help. I'll come back soon to update my question. $\endgroup$ Aug 24, 2017 at 18:49

1 Answer 1


This might be considered an answer in that there doesn't appear to be a general solution that results in a function that just depends on $A$ (assuming that's what you mean by not having to specify any particular distribution other than meeting the given constraints).

For the two specific distributions I've tried (beta and logit-normal), the answer for $A>1$ is $A-\frac{1}{2}$. So that might possibly be a general solution. (I don't know how to prove that one way or the other.)

But for $0<A<1$, the results don't immediately look generalizable:

Beta distribution

a =.
α =.;
β =.;
Integrate[(a - CDF[BetaDistribution[α, β], t]) PDF[BetaDistribution[α, β], t], {t, 0, a},
  Assumptions -> {α > 0, β > 0, 0 < a < 1}]

$\frac{2 a \Gamma (\alpha )^2 \Gamma (\beta )^2 B_a(\alpha ,\beta )-\Gamma (\alpha +\beta )^2 B(\alpha ,\beta ) B_a(\alpha ,\beta ){}^2}{2 \Gamma (\alpha )^2 \Gamma (\beta )^2 B(\alpha ,\beta )}$

Logit-normal distribution

a =.
μ =.;
σ =.;
f[t_, μ_, σ_] := Exp[-(Log[t/(1 - t)] - μ)^2/(2 σ^2)]/(σ t (1 - t) (2 π)^(1/2))
F[t_, μ_, σ_] := (1 + Erf[(Log[t/(1 - t)] - μ)/(σ 2^(1/2))])/2
Integrate[(a - F[t, μ, σ]) f[t, μ, σ], {t, 0, a}, 
  Assumptions -> {0 < a < 1, σ > 0, μ ∈ Reals}]

$\frac{1}{8} \left(\text{erf}\left(\frac{\log \left(\frac{1}{a}-1\right)+\mu }{\sqrt{2} \sigma }\right)+4 a-1\right) \text{erfc}\left(\frac{\log \left(\frac{1}{a}-1\right)+\mu }{\sqrt{2} \sigma }\right)$

If those results are evaluated at the same value of $A$ but different values of the parameters, one does not (always) obtain the same result:

Beta distribution

g[a_, α_, β_] := (2 a Beta[a, α, β] Gamma[α]^2 Gamma[β]^2 - Beta[α, β] Beta[
    a, α, β]^2 Gamma[α + β]^2)/
(2 Beta[α, β] Gamma[α]^2 Gamma[β]^2)
g[1/2, 1, 1]
(* 1/8 *)
g[1/2, 3, 4]
(* 231/2048 *)

Logit-normal distribution

g[a_, μ_, σ_] := 1/8 (-1 + 4 a + Erf[(μ + Log[-1 + 1/a])/(Sqrt[2] σ)])
  Erfc[(μ + Log[-1 + 1/a])/(Sqrt[2] σ)]
g[1/2, 0, 1]
(* 1/8 *)
g[1/2, 1, 2]
(* 1/8 (1+Erf[1/(2 Sqrt[2])]) Erfc[1/(2 Sqrt[2])] *)

In short, I think you'll need to specify the distribution (but potentially get a symbolic result in terms of the distributions parameters).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.