I have a Beta distribution, and am interested in calculating expectations and conditional expectations. The domain on the distribution is $z \in [0,1]$ Ignoring constants of proportionality, the expectation of an exponential function is:
$Assumptions = z >= 0 && z <= 1 && a > 0 && b > 0 && c > 0 && d > 0 && d < 1;
Print["*******Different parameters, {a,b}"];
Integrate[Exp[c z] z^(a - 1) (1 - z)^(b - 1), {z, 0, 1}]
Print["********Symmetric parameter, a"];
Integrate[Exp[c z] z^(a - 1) (1 - z)^(b - 1) /. {b -> a}, {z, 0, 1}]
The output from this is:
Gamma[a] Gamma[b] Hypergeometric1F1Regularized[a, a + b, c]
(-c)^(1/2 - a) E^(c/2) Sqrt[\[Pi]] BesselI[-(1/2) + a, -(c/2)] Gamma[a]
These are solid. The problem I am having is when calculating conditional expectations, which is effectively integration over a subset of the domain. Again ignoring constants of proportionality,
Print["********Truncated Integral on [d, 1], symmetric for simplicity"];
Integrate[Exp[c z] z^(a - 1) (1 - z)^(b - 1) /. {b -> a}, {z, d, 1}]
This is unable to solve it. Any idea on this? Are there any tricks in mathematica, in math that I am missing?
{z, d, 1}
are you sure it is appropriate ? $\endgroup$R
to constant.It is from constant to constant or function to function. $\endgroup$Integrate[z, {z, d, 1}]
-->1/2 - d^2/2
$\endgroup$d
in assumption doesn't play any role and is considered a symbol if you place it in range part. $\endgroup$