We deliver solutions for the AI eraâcombining symbolic computation, data-driven insights and deep technology expertise.
Expectation[expr,xdist]
gives the expectation of expr under the assumption that x follows the probability distribution dist.
Expectation[expr,xdata]
gives the expectation of expr under the assumption that x follows the probability distribution given by data.
Expectation[expr,{x1,x2,…}dist]
gives the expectation of expr under the assumption that {x1,x2,…} follows the multivariate distribution dist.
Expectation[expr,{x1dist1,x2dist2,…}]
gives the expectation of expr under the assumption that x1, x2, … are independent and follow the distributions dist1, dist2, ….
Expectation[exprpred,…]
gives the conditional expectation of expr given pred.
Details and OptionsCompute the expectation of a polynomial expression:
Compute the expectation of an arbitrary expression:
Compute a conditional expectation:
Scope (31) Basic Uses (9)Compute the expectation for an expression in a continuous univariate distribution:
Discrete univariate distribution:
Continuous multivariate distribution:
Discrete multivariate distribution:
Find the expectation of an expression in a distribution specified by a list:
Compute the expectation using independently distributed random variables:
Find the conditional expectation with general nonzero probability conditioning:
Discrete univariate distribution:
Multivariate continuous distribution:
Multivariate discrete distribution:
Compute the conditional expectation with a zero-probability conditioning event:
Apply N[Expectation[…]] to invoke NExpectation if symbolic evaluation fails:
With no Assumptions, conditions are generated:
With Assumptions, a result valid under the given assumptions is returned:
Find the expectation of a rational function:
Compute an expectation for a time slice of a Poisson process:
Quantity Uses (5)Find expectations of quantity expressions:
Find expectations specified using QuantityDistribution:
Find conditional expectations:
Calculate expectation with QuantityMagnitude:
Calculate expectation with distribution given by Quantity data:
Distribution given by QuantityArray:
Parametric Distributions (4)Compute expectations for univariate continuous distributions:
Compute expectations for univariate discrete distributions:
Expectations for multivariate continuous distributions:
Expectations for multivariate discrete distributions:
Nonparametric Distributions (4) Derived Distributions (9)Compute the expectation using a TransformedDistribution:
An equivalent way of formulating the same expectation:
Find the expectation using a ProductDistribution:
An equivalent formulation for the same expectation:
Using a component mixture of normal distributions:
Parameter mixture of exponential distributions:
Truncated Dirichlet distribution:
Censored triangular distribution:
An equivalent way of formulating the same expectation:
Generalizations & Extensions (2)Use a pure function to compute an expectation for a list of values:
Compute an expectation for a mixture of continuous and discrete distributions:
Options (6) Assumptions (1)With no Assumptions, conditions are generated:
With Assumptions, a result valid under the given assumptions is returned:
Method (4)Compute the expectation of a polynomial function:
Obtain the same result using the moments of the distribution:
The evaluation is slower using the definition of Expectation as an integral:
Compute the expectation of a transcendental function:
Here, the method based on moments fails because the expression is nonpolynomial:
The result can be obtained using the definition of Expectation as a symbolic sum:
Find the expectation of a function in a TukeyLambdaDistribution:
The PDF of this distribution is not available in closed form:
Hence a direct application of the definition fails:
The expectation can be computed using Quantile:
Calculate the expectation of an expression:
This example uses Integrate:
Use Activate to evaluate the result:
TargetUnits (1)Create a distribution object with quantity:
Expectation uses the quantity provided in the distribution as default:
Specify the target unit to "Hours":
Applications (20) Distribution Properties (5)Obtain the raw moments of a continuous distribution:
Obtain the mean of a discrete distribution:
Obtain the variance of a truncated distribution:
Construct a mixture density, here a Poisson‐inverse Gaussian mixture:
Obtain the same result directly using ParameterMixtureDistribution:
Verify Jensen inequality for a concave function and a lognormal distribution:
Finance (2)Compute the expected time value of a death benefit of $1 paid at time , where is drawn from a Gompertz–Makeham distribution:
Find the annual premium, which is usually paid at the beginning of a policy year, that is necessary to make the expected time value of that payment stream for periods (where is drawn from a Gompertz–Makeham distribution) equal to the net single premium:
The resulting net annual premium:
The fractional change of stock price at time (in years) is assumed lognormally distributed with parameters and :
Compute expected stock price at epoch :
Assuming an investor can invest money in a stock with dividend yield for a year at a continuously compounded yearly rate risk-free, the risk-neutral pricing condition requires:
Consider a call option to buy this stock a year from now, at a fixed price . The value of such an option is:
Similarly, consider a put option to sell this stock a year from now, at a fixed price . The value of such an option is:
The risk-neutral price of the call and put options are determined as the present value of their expected option values:
You can now establish the celebrated Put-Call Parity relationship that :
Assuming rate of 5%, dividend yield of 2%, volatility parameter of 0.087, an initial price of $200 per share of stock, and a strike price of $190 per share, the Black–Scholes call and put option prices are:
The above results can be compared favorably with FinancialDerivative:
Risk and Reliability (2)Study the tail value at risk (TVaR) for the exponential distribution:
Find the mean time to failure (MTTF) for an exponential life distribution:
Random Experiments (2)A random sample of size 10 from a continuous distribution is sorted in ascending order. A new random variate is generated. Find the probability that the 11 sample falls between the fourth and fifth smallest values in the sorted list:
The probability equals and is independent of :
It is also independent of the distribution:
Four six-sided dice are rolled. Find the expectation of the minimum value:
Find the expectation of the maximum value:
Find the expectation of the sum of the three largest values. Using the identity and linearity of Expectation, you get:
Other Applications (4)A player bets amount in a casino with no betting limit in a game with a chance of winning . If he loses he doubles the bet, and if he wins he quits, hence the number of games played follows a geometric distribution, with expected number of games played represented as follows:
The cash reserve needed to win the game:
The player always leaves the casino collecting the amount of the initial bet:
The cash reserve needed to execute the above strategy is finite only for strictly favorable games, where :
A drug has proven to be effective in 40% of cases. Find the expected number of successes when applied to 700 cases:
A baseball player is a 0.300 hitter. Find the expected number of hits if the player comes to bat 3 times:
Find the mean if the signal-to-noise ratio has a Weibull distribution:
Properties & Relations (10)The expectation of an expression in a continuous distribution is defined by an integral:
The expectation of an expression in a discrete distribution is defined by a sum:
A conditional expectation is defined by a ratio of expectation and probability:
Use NExpectation to find the numerical value of an expectation:
Compute the probability of an event:
Obtain the same result using Expectation:
N[Expectation[…]] is equivalent to NExpectation if symbolic evaluation fails:
Use AsymptoticExpectation to find an asymptotic approximation of an expectation:
Obtain the same result using Asymptotic[Expectation[…]]:
Mean, Moment, Variance, and other properties are defined as expectations:
Generating functions including MomentGeneratingFunction are defined by an expectation:
For a distribution specified by a list, Expectation is equivalent to using Mean:
Wolfram Research (2010), Expectation, Wolfram Language function, https://reference.wolfram.com/language/ref/Expectation.html (updated 2016). TextWolfram Research (2010), Expectation, Wolfram Language function, https://reference.wolfram.com/language/ref/Expectation.html (updated 2016).
CMSWolfram Language. 2010. "Expectation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/Expectation.html.
APAWolfram Language. (2010). Expectation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Expectation.html
BibTeX@misc{reference.wolfram_2025_expectation, author="Wolfram Research", title="{Expectation}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/Expectation.html}", note=[Accessed: 11-July-2025 ]}
BibLaTeX@online{reference.wolfram_2025_expectation, organization={Wolfram Research}, title={Expectation}, year={2016}, url={https://reference.wolfram.com/language/ref/Expectation.html}, note=[Accessed: 11-July-2025 ]}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4