Probability Computations

In general, we can compute the probability that the random variable of interest lies within any specific interval using either the probability density function or the cumulative distribution function.  In either case, we should get the same answer, as we are simply applying the Fundamental Theorem of Calculus.

Use the PDF to compute probability,whereaandbare the lower and upper bounds of the interval of interest.

In[63]:=

a = 1 ;

b = 10 ;

PDFProb = ∫_a^b f[x] x ;

Print["P(", a, " ≤ X ≤ ", b, ") = ", N[PDFProb]]

P(1 ≤ X ≤ 10) = 0.559335

Use the CDF to compute the same probability.

In[67]:=

Off[General :: spell1]

CDFProb = F[b] - F[a] ;

On[General :: spell1]

Print["P(", a, " ≤ X ≤ ", b, ") = ", N[CDFProb]]

P(1 ≤ X ≤ 10) = 0.559335

NOTE: The Mathematica commands Off[General::spell1] and the corresponding On suppress the warning message that would otherwise be generated because the symbols PDFProb and CDFProb are so similar.


Created by Mathematica  (July 20, 2006) Valid XHTML 1.1!