← 返回资讯屏轩教育 · 行业资讯

General Source Distribution and the Inverse Transform | 一般源分布与逆变换法

2026-08-03 02:50 · 本文部分内容由AI辅助创作

📚 General Source Distribution and the Inverse Transform | 一般源分布与逆变换法

In probabilistic modelling and statistical simulation, we often need to generate random numbers that follow a specified distribution, such as exponential waiting times, Poisson arrivals, or user-defined probability density functions. Most computational systems provide a reliable uniform random number generator, but how do we convert these uniform draws into samples from an arbitrary distribution? The answer lies in the inverse transform method, which treats the uniform distribution as a general source distribution and exploits the properties of the cumulative distribution function. This article explores the theory, proof, practical implementation, and limitations of the inverse transform technique within the context of IB Mathematics, providing clear examples for both continuous and discrete cases.

在概率建模与统计模拟中,我们经常需要生成服从特定分布的随机数,例如指数等待时间、泊松到达或自定义概率密度函数。大多数计算系统都提供可靠的均匀随机数生成器,但我们如何将这些均匀抽样转化为来自任意分布的样本?答案就在于逆变换法,它将均匀分布视为一般源分布,并利用累积分布函数的性质。本文在IB数学的背景下,探讨逆变换技术的理论、证明、实际实现及其局限性,为连续和离散情况提供清晰的示例。


1. Simulation and Source Distributions | 模拟与源分布

Modern simulation techniques rely on a source of randomness that is easy to generate and statistically well understood. The uniform distribution on the interval [0,1] is the most common choice. Once we have a sequence of independent U(0,1) random variables, we can transform them to mimic a vast range of other distributions. This central role of the uniform makes it a 'general source' for stochastic modelling.

现代模拟技术依赖于容易生成且统计性质良好的随机性来源。区间 [0,1] 上的均匀分布是最常见的选择。一旦我们拥有独立的 U(0,1) 随机变量序列,我们就可以将它们变换为各种其他分布。均匀分布的这种核心作用使其成为随机建模的“一般源”。


2. Uniform Distribution as the Universal Source | 均匀分布作为通用源分布

]. Because any cumulative distribution function maps its domain onto the interval [0,1], the uniform distribution acts as a natural bridge between different random phenomena. In the inverse transform method, we start with a single uniform sample and feed it into the inverse of the target CDF to obtain a sample from the desired distribution.

一个 U(0,1) 随机变量的特征是其概率密度函数在 0 ≤ u ≤ 1 时恒为 f(u)=1,其余为零。其累积分布函数在 [0,1] 上为 F(u)=u。由于任何累积分布函数都将其定义域映射到区间 [0,1],均匀分布自然成为连接不同随机现象的桥梁。在逆变换法中,我们从一个均匀样本出发,将其输入目标CDF的逆函数,从而获得所需分布的样本。


3. The Cumulative Distribution Function (CDF) | 累积分布函数(CDF)

sity function f(x), the cumulative distribution function is defined as F(x) = P(X ≤ x) = ∫-∞x f(t) dt. The CDF is non‑decreasing, right‑continuous, and satisfies 0 ≤ F(x) ≤ 1 with limits limx→-∞ F(x) = 0 and limx→∞ e that the CDF is invertible on the range where it is strictly increasing, acting as a one‑to‑one mapping between the sample space and [0,1].

对于任意具有概率密度函数 f(x) 的连续型随机变量 X,累积分布函数定义为 F(x) = P(X ≤ x) = ∫-∞x f(t) dt。CDF 非降、右连续,并满足 0 ≤ F(x) ≤ 1,且极限 limx→-∞ F(x)=0,limx→∞ F(x)=1。这些性质保证了 CDF 在其严格递增的区间上可逆,成为样本空间与 [0,1] 之间的一一映射。


4. Core Principle of the Inverse Transform | 逆变换法的核心原理

Let X be a random variable with CDF FX. Define U = FX(X). Because FX on of a random variable, U is itself a random variable. For any u in [0,1], P(U ≤ u) = P(FX(X) ≤ u) = P(X ≤ FX-1(u)) = FX(FX-1(u)) = u. Thus U ∼ nerate a uniform random variable U and apply the inverse CDF, the resulting variable X = FX-1(U) has distribution function FX. This bijection is the heart of the method.

设 X 是 CDF 为 FX 的随机变量。定义 U = FX(X)。由于 FX 是随机变量的函数,U 本身也是随机变量。对任意 u∈[0,1],有 P(U ≤ u) = P(FX(X) ≤ u) = P(X ≤ FX-1(u)) = FX(FX-1(u)) = u。故 U ∼ U(0,1)。反之,若我们生成均匀随机变量 U 并应用逆 CDF,所得变量 X = FX-1(U) 的分布函数就是 FX。这一双向对应是本方法的核心。


5. Algorithmic Steps of the Method | 方法的算法步骤

requires only two steps. First, obtain a sample u from Uniform(0,1). Second, compute x = F-1(u), where F-1 is the inverse of the target CDF. If an analytical expression for F-1 e functions may be unbounded; in practice, slightly truncating u, e.g. to [10⁻¹², 1−10⁻¹²], avoids numerical issues.

实现逆变换仅需两步。第一步,从 Uniform(0,1) 中获取样本 u。第二步,计算 x = F-1(u),其中 F-1 是目标 CDF 的逆函数。如果能得到 F-1 的解析表达式,计算会非常直接。为生成一系列独立的随机变量,只需重复该过程即可。关键要处理端点:当 u = 0 或 u = 1 时,某些逆函数可能无界;实际操作中,将 u 微调至例如 [10⁻¹², 1−10⁻¹²] 可以避免数值问题。


广告 / Sponsored

6. Example: Generating an Exponential Distribution | 示例:生成指数分布

The exponential distribution with rate λ > 0 has PDF f(x) = λ e-λx for x ≥ 0, and CDF F(x) = 1 − e-λx. To find the inverse, set u = 1 − e-λx, solve for x: e-λx ampling quickly builds an exponential distribution useful for modelling service times or radioactive decay.

参数为 λ>0 的指数分布,其 PDF 为 f(x)=λ e-λx (x≥0),CDF 为 F(x)=1−e-λx。为求逆,令 u=1−e-λx,解出 x:e-λx=1−u,故 −λx = ln(1−u),得 x=−(1/λ) ln(1−u)。由于 1−U 也服从 U(0,1),许多实现直接使用 x=−(1/λ) ln(u)。一个均匀样本 u=0.3、λ=2 将得到 x=−(1/2) ln(0.7)≈0.178。重复抽样可以迅速构建指数分布,用于模拟服务时间或放射性衰变。


7. Example: Triangular Distribution via Inverse CDF | 示例:通过逆CDF生成三角分布

DF is F(x) = x²/10 for 0 ≤ x ≤ 2 and F(x) = 1 − (5−x)²/15 for 2 ≤ x ≤ 5. To invert, draw u ∼ U(0,1). If u < 0.4, solve u = x²/10 ⇒ x = √10u. If u ≥ 0.4, solve u = 1 − (5−x)²/15 ⇒ (5−x)² = 15(1−u) ⇒ s, demonstrating how discontinuous derivatives still allow straightforward implementation.

考虑一个下限为 a、上限为 b、众数为 c 的三角分布,其 CDF 为分段二次函数。例如 a=0, c=2, b=5,则 CDF 为 F(x)=x²/10 (0≤x≤2) 及 F(x)=1−(5−x)²/15 (2≤x≤5)。进行逆变换时,抽取 u∼U(0,1)。若 u<0.4,解 u=x²/10 ⇒ x=√10u;若 u≥0.4,解 u=1−(5−x)²/15 ⇒ (5−x)²=15(1−u) ⇒ x=5−√(15(1−u))。分段逆函数必须与 CDF 区间一致,这表明即使导数不连续依然可以直接实现。


8. Inverse Transform for Discrete Distributions | 离散分布的逆变换

nd identify which subinterval contains u. For example, a biased coin with P(Head)=0.7: if u ≤ 0.7 output Head, else Tail. This generalised lookup method works for any finite or countably infinite discrete distribution.

对于取值为 x₁, x₂, ... 且累积概率为 p₁, p₂, ... 的离散随机变量,逆变换法使用均匀随机数 u,选出满足 F(xₖ) ≥ u 的最小 xₖ。等效于将单位区间划分为宽度等于各自概率的子区间,并判断 u 落入哪个子区间。例如一枚概率 P(正面)=0.7 的偏置硬币:若 u≤0.7 输出正面,否则反面。这种广义查表法适用于任何有限或可列无限的离散分布。


9. Mathematical Proof of Correctness | 方法的数学证明

Assume X = F-1(U) where U ∼ U(0,1) and F is a CDF with inverse defined as F-1(u) = inf{x : F(x) ≥ u}. Then for any real y, P(X ≤ y) = P(F-1(U) ≤ y) = P(U ≤ F(y)) because F-1 stribution F. This elegantly uses the fact that the uniform transformation preserves probability, and it holds even when F has jumps or flat parts, provided the generalised inverse is used.

假设 X = F-1(U),其中 U∼U(0,1),F 是 CDF,其逆定义为 F-1(u)=inf{x: F(x)≥u}。那么对任意实数 y,有 P(X ≤ y) = P(F-1(U) ≤ y) = P(U ≤ F(y)),因为 F-1 是单调的。由于 U 为均匀分布,P(U ≤ F(y)) = F(y),从而确证 X 的分布为 F。此证明巧妙地利用了均匀变换保持概率的性质,且只要采用广义逆函数,即使 F 有跳跃或平坦部分也同样成立。


10. When the Inverse Is Not Available | 当逆函数不可得时

Not all CDFs possess an analytic inverse; the normal distribution is a classic example. In such cases, numerical approximations (e.g. Moro's algorithm for the normal) or alternative methods like the Box–Muller transform may be employed. The acceptance‑rejection method is another versatile approach that does not demand an inverse, relying instead on an envelope function. Understanding the limitations of the inverse transform helps students choose the right simulation tool for a given problem.

并非所有 CDF 都有解析逆函数,正态分布就是一个经典例子。此时可采用数值近似(如正态分布的 Moro 算法)或其他方法,如 Box–Muller 变换。接受‑拒绝法也是一种不依赖逆函数的通用方法,它借助外包络函数实现。理解逆变换法的局限性有助于学生针对特定问题选择合适的模拟工具。


11. Applications in IB Mathematics and Beyond | 在IB数学及更广领域的应用

In the IB Mathematics: Applications and Interpretation course, the inverse transform appears when students explore random sampling techniques, Monte Carlo simulations, and the generation of synthetic data for modelling. It also underpins queueing theory models and financial simulations (e.g. stock price paths using the log‑normal distribution). Beyond the curriculum, the inverse transform is a building block in machine learning for generating samples from latent distributions, in reinforcement learning for exploration strategies, and in any field where stochastic simulation is essential.

在IB数学“应用与解释”课程中,当学生探究随机抽样技术、蒙特卡洛模拟以及为建模生成合成数据时,就会接触到逆变换。它也是排队论模型和金融模拟(如使用对数正态分布的股票价格路径)的基础。在课堂之外,逆变换法是机器学习中从潜在分布生成样本的基本模块,是强化学习中探索策略的基石,也是任何需要随机模拟的领域不可或缺的构件。


12. Key Takeaways and Common Pitfalls | 关键要点与常见误区

The inverse transform method transforms a uniform general source into any target distribution via the inverse CDF. Always verify that the inverse is defined on the whole (0,1) interval and watch out for endpoint singularities. For discrete distributions, ensure the lookup is based on cumulative sums. A frequent mistake is using the PDF instead of the CDF in the inversion; remember that F-1(u) operates on cumulative probabilities, not densities. With practice, the inverse transform offers a robust and intuitive gateway to stochastic simulation.

逆变换法通过逆 CDF 将均匀通用源转换为任意目标分布。务必验证逆函数在整个 (0,1) 区间上有定义,并注意端点奇异性。对于离散分布,要确保基于累积和进行查表。一个常见错误是在逆变换中使用 PDF 而非 CDF;请记住 F-1(u) 是对累积概率进行运算,而非密度。通过练习,逆变换法将成为通往随机模拟的一条稳健而直观的途径。


Published by TutorHao | IB Mathematics Revision Series | aleveler.com

广告 / Sponsored
现货 Cambridge Biology for the IB Diploma coursebook 剑桥国际文凭 I…
生物 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥546.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao