# Compute Conditional Probabilities and Expectations

Compute the probabilities and expectations under prescribed conditions in arbitrary distributions.
 In[1]:= Xconditionalprobabilitiesandexpectations = {HoldForm[ Probability[x < 2 \[Conditioned] 1/2 < x^2 < 5, x \[Distributed] NormalDistribution[0, 1]]], HoldForm[ Probability[ x + y < 7/10 \[Conditioned] y > 1/3, {x, y} \[Distributed] DirichletDistribution[{1, 3, 4}]]], HoldForm[ NProbability[x^2 + 11 x > 32 Pi \[Conditioned] x > 3, x \[Distributed] PoissonDistribution[2]]], HoldForm[ Expectation[x + 2 \[Conditioned] 2 < x < 15, x \[Distributed] ExponentialDistribution[3]]], HoldForm[ Expectation[ x + y + 5 \[Conditioned] z > 2, {x, y, z} \[Distributed] MultinomialDistribution[5, {p, q, r}]]], HoldForm[ NExpectation[x^2 + 1 \[Conditioned] x > 1/3, x \[Distributed] LaplaceDistribution[0, 3]]]};
 In[2]:= XFormulaGallery[forms_List] := Module[{vals = ParallelMap[ReleaseHold, forms]}, TraditionalForm@ Grid[Table[{forms[[i]], vals[[i]]}, {i, Length[forms]}], Dividers -> All, Spacings -> {1, 2}, Alignment -> {Center, Center}, BaseStyle -> {FontFamily -> "Verdana"}, Background -> {None, {{Hue[.6, .15, .9], GrayLevel[.9]}}}, FrameStyle -> Directive[Thick, White]]]
 In[3]:= XPane[FormulaGallery[conditionalprobabilitiesandexpectations] , 550]
 Out[3]=