Free lesson · Integral calculus
Improper integrals, densities and continuous expectations
Open interactive lessonPractice calculationsExplore labs
Start with the idea
- A density assigns probability per unit of the outcome variable.
- Integrating it over a region gives probability; weighting it by an outcome before integrating gives an expectation.
- This is the continuous version of a probability-weighted sum.
Symbols, units & horizon
- X: nonnegative continuous random variable
- x: a possible value of X
- p(x): density in inverse x-units
- λ: positive rate in inverse x-units
- E[X]: mean in x-units
- ∞: infinite upper bound interpreted as a limit
- b: finite temporary upper bound
- e: exponential base
- P(X>b): probability of exceeding b
When and why to use this
Use density integrals to compute continuous probabilities and expected quantities. Check support, normalisation and moment existence before applying a mean-based model.
- A continuous density is nonnegative and integrates to one.
- Its height is not itself a probability and may exceed one when its units permit it.
- A single point has probability zero under a continuous density, but an interval can have positive probability.
- An improper integral has an infinite bound or a singularity and is defined by a limit.
- Convergence must be checked.
- A normalised density can still have an infinite mean or variance, so valid probabilities do not guarantee finite moments.
Improper integrals, densities and continuous expectations
- Integrate to a finite bound first: . For , this tends to 1 as .
- For the first moment choose , . Then and .
- Integration by parts gives . Both exponential boundary terms vanish in the limit, leaving .
- The tail is the complementary probability: . At per minute and minute, the mean is 0.5 minute and the tail is approximately 0.135335.
If λ=2 per minute, mean waiting time is .5 minute. The probability of waiting longer than 1 minute is exp(−2)≈.135335. This is a distributional assumption, not a universal waiting-time law.
An analogy to remember
Density is like the thickness of material along a strip. Height at one location is not total mass; area under the thickness curve over an interval is.
How this becomes a building block
Expectations, tail losses and risk-neutral payoff prices are weighted integrals. A waiting-time model can be a component of a toy arrival or execution model. The Poisson/exponential assumptions would need empirical checking before describing actual orders.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
from math import exp, expm1
def exponential_model(rate,threshold):
if rate<=0 or threshold<0: raise ValueError("Positive rate, nonnegative threshold required")
return {"density":rate*exp(-rate*threshold),
"cdf":-expm1(-rate*threshold),"tail":exp(-rate*threshold),"mean":1/rate}
print(exponential_model(2,1))Continue learning
Integral Calculus: Accumulation & Area — all lessons- Start with rectangles: rate × time = amount
- Definite integrals: adding many small contributions
- Core integral rules: undo a derivative, then check
- Antiderivatives and the fundamental theorem
- Integration techniques: substitution and integration by parts
- Improper integrals, densities and continuous expectations
- Numerical integration and a continuous cash-flow building block
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations