Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

NExpectation

NExpectation[expr,xdist]
gives the numerical expectation of expr under the assumption that x follows the probability distribution dist.

NExpectation[expr,{x1,x2,}dist]
gives the numerical expectation of expr under the assumption that {x1,x2,} follows the multivariate distribution dist.

NExpectation[expr,{x1dist1,x2dist2,}]
gives the numerical expectation of expr under the assumption that x1, x2, are independent and follow the distributions dist1, dist2, .

NExpectation[exprpred,]
gives the numerical conditional expectation of expr given pred.

Details and OptionsDetails and Options

• xdist can be entered as x EscdistEsc dist or x[Distributed]dist.
• exprpred can be entered as expr EsccondEsc pred or expr[Conditioned]pred.
• NExpectation works like Expectation, except numerical summation and integration methods are used.
• For a continuous distribution dist, the expectation of expr is given by where is the probability density function of dist and the integral is taken over the domain of dist.
• For a discrete distribution dist, the probability of expr is given by where is the probability density function of dist and the summation is taken over the domain of dist.
• NExpectation[expr,{x1dist1,x2dist2}] corresponds to NExpectation[NExpectation[expr,x2dist2],x1dist1] so that the last variable is summed or integrated first.
• N[Expectation[]] calls NExpectation for expectations that cannot be done symbolically.
• The following options can be given:
•  AccuracyGoal ∞ digits of absolute accuracy sought PrecisionGoal Automatic digits of precision sought WorkingPrecision MachinePrecision the precision used in internal computations Method Automatic what method to use TargetUnits Automatic units to display in the output

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Compute the expectation of a polynomial expression:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

Compute the expectation of an arbitrary expression:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=

Compute a conditional expectation:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=