# 误差函数

误差函数，记作 erf z，是由积分

\[ \mathrm{erf}\,z = \frac{2}{\sqrt{\pi}} \int_0^z \mathrm{e}^{-t^2}\,dt, \]

定义的特殊函数，其中 z 可以是实数或复数<sup>[1](https://dlmf.nist.gov/7.2)</sup>。因子 2/√π 对函数作归一化，使得当 z 沿实轴增大时 erf z 趋于 1。与之相伴的余误差函数 erfc z = 1 − erf z，则是从 z 到无穷远的同一积分<sup>[1](https://dlmf.nist.gov/7.2)</sup>。两个函数都是整函数，即在整个复平面上解析、没有奇点<sup>[1](https://dlmf.nist.gov/7.2)</sup>。

| 关键事实 | 细节 |
|---|---|
| 定义 | \( \mathrm{erf}\,z = \frac{2}{\sqrt{\pi}} \int_0^z \mathrm{e}^{-t^2}\,dt \); erfc z = 1 − erf z<sup>[1](https://dlmf.nist.gov/7.2)</sup> |
| 无穷远处的极限 | 在扇形区域 \( |\mathrm{ph}\,z| \le \tfrac{1}{4}\pi - \delta \) 内，当 z → ∞ 时 erf z → 1；在 \( |\mathrm{ph}\,z| \le \tfrac{3}{4}\pi - \delta \) 内，erfc z → 0<sup>[1](https://dlmf.nist.gov/7.2)</sup> |
| 对称性 | erf 是奇函数：erf(−z) = −erf(z)；erfc(−z) = 2 − erfc(z)<sup>[2](https://dlmf.nist.gov/7.4)</sup> |
| 与统计学的联系 | 标准正态累积分布函数 \( \Phi(z) = \tfrac{1}{2}\left[1 + \mathrm{erf}(z/\sqrt{2})\right] \)<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.erf.html)</sup> |
| 命名 | 詹姆斯·惠特布雷德·李·格莱舍（James Whitbread Lee Glaisher）于 1871 年创造了“erf”和“erfc”的记号<sup>[4](https://cpoli.github.io/mathematicskit/history/special_functions_breakthroughs.html)</sup> |
| 标准化 | erf 和 erfc 在 C99 库的 <math.h> 中规定，包含 float、double 和 long double 三种变体<sup>[5](https://open-std.org/jtc1/sc22/wg14/www/docs/n843.htm)</sup> |
| 热方程 | 阶跃初始温度演化为 \( u(x,t) = \tfrac{1}{2}\left[1 + \mathrm{erf}\left(x/\sqrt{4t}\right)\right] \)<sup>[6](https://math.mit.edu/classes/18.086/2006/am54.pdf)</sup> |

## 为什么这个积分需要一个名字

被积函数 e^{−t²} 没有初等原函数。正如麻省理工学院数学教授吉尔伯特·斯特朗（Gilbert Strang）在其微分方程讲义中所说，没有任何初等函数的导数是 e^{−x²}，然而统计学家经常需要这类曲线下的面积，于是这些积分被归一化为误差函数，并以高精度制表<sup>[6](https://math.mit.edu/classes/18.086/2006/am54.pdf)</sup>。选择归一化因子 2/√π 是为了使整个实轴上的积分等于 1，从而 erf(∞) = 1<sup>[6](https://math.mit.edu/classes/18.086/2006/am54.pdf)</sup>。

## 与正态分布的关系

误差函数与标准正态分布的累积分布函数在相差一个缩放和平移的意义下是同一个对象：\( \Phi(z) = \tfrac{1}{2}\left[1 + \mathrm{erf}(z/\sqrt{2})\right] \)<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.erf.html)</sup>。在数理统计中，缩放形式 P(z) = Φ(z) = ½ erfc(−z/√2) 和 Q(z) = ½ erfc(z/√2) 被称为正态概率函数或高斯概率函数<sup>[7](https://dlmf.nist.gov/7.1)</sup>。“误差函数”这一名称本身来自观测误差理论，其中高斯分布描述测量误差，而该积分给出误差落在某一界限内的概率<sup>[8](https://www.statgarden.com/maths/error-function.html)</sup>。

## 基本性质

**对称性。** 误差函数是奇函数，erf(−z) = −erf(z)，余误差函数满足 erfc(−z) = 2 − erfc(z)<sup>[2](https://dlmf.nist.gov/7.4)</sup>。这些反射公式也是实际计算的第一步，将每个自变量化为正值<sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/sf_erf/error_function.html)</sup>。

**导数。** 逐次求导会引入埃尔米特多项式：对 n = 0, 1, 2, …，

\[ \frac{d^{n+1}\,\mathrm{erf}\,z}{dz^{n+1}} = (-1)^n \frac{2}{\sqrt{\pi}}\, H_n(z)\,\mathrm{e}^{-z^2}, \]

因此一阶导数为 \( (2/\sqrt{\pi})\,\mathrm{e}^{-z^2} \)<sup>[10](https://dlmf.nist.gov/7.10)</sup>。

**级数。** 幂级数

\[ \mathrm{erf}\,z = \frac{2}{\sqrt{\pi}} \sum_{n=0}^{\infty} \frac{(-1)^n z^{2n+1}}{n!\,(2n+1)} \]

对所有复数 z 收敛，是小自变量下的自然计算形式<sup>[11](https://dlmf.nist.gov/7.6)</sup>。

**渐近性质。** 对于大 |z|，余误差函数具有庞加莱展开

\[ \mathrm{erfc}\,z \sim \frac{\mathrm{e}^{-z^2}}{\sqrt{\pi}} \sum_{m=0}^{\infty} (-1)^m \frac{\left(\tfrac{1}{2}\right)_m}{z^{2m+1}}, \]

在扇形区域 \( |\mathrm{ph}\,z| \le \tfrac{3}{4}\pi - \delta \) 内有效，其中 \( (a)_m \) 是波赫哈默符号<sup>[12](https://dlmf.nist.gov/7.12)</sup>。该展开描述了高斯尾部的快速衰减，是大自变量下计算 erfc 的标准工具<sup>[12](https://dlmf.nist.gov/7.12)</sup>。

**反函数与重复积分。** 反函数 erf⁻¹ 和 erfc⁻¹ 有实际需要，例如从均匀分布随机变量生成正态分布随机变量；它们在二十世纪下半叶被系统研究，尤其是 J. R. 菲利普（J. R. Philip，1960）和 A. J. 斯特雷科克（A. J. Strecok，1968）<sup>[13](https://functions.wolfram.com/GammaBetaErf/Erf/introductions/ProbabilityIntegrals/ShowAll.html)</sup>。重复积分 iⁿerfc(z) 满足一个可用于计算的递推关系，并出现在热传导问题中<sup>[14](https://dlmf.nist.gov/7.18)</sup>。

## 历史

erf 背后的积分有着悠久的历史。亚伯拉罕·德·莫伊弗（Abraham de Moivre）1718 至 1733 年的工作以及皮埃尔-西蒙·拉普拉斯（Pierre-Simon Laplace）1774 年的论文将其表述为积分；1799 年，克里斯蒂安·克拉姆普（Christian Kramp）在大气折射的背景下用这个积分定义了如今所谓的余误差函数；拉普拉斯于 1812 年导出了误差函数的渐近展开<sup>[13](https://functions.wolfram.com/GammaBetaErf/Erf/introductions/ProbabilityIntegrals/ShowAll.html)</sup>。名称和记号出现得更晚：1871 年，剑桥数学家詹姆斯·惠特布雷德·李·格莱舍创造了记号“erf”表示“误差函数”，“erfc”表示余误差函数<sup>[4](https://cpoli.github.io/mathematicskit/history/special_functions_breakthroughs.html)</sup>。格莱舍主张，这个无法用初等函数求出的积分因其与误差理论的联系，理应升格为一个有名字的函数<sup>[15](https://huntsvilleengineers.com/math/error-function)</sup>。

## 计算

由于 erf 和 erfc 无法写成封闭形式，数值库通过有理逼近来计算它们。数值分析学家威廉·J. 科迪（William J. Cody）当时在《计算数学》上发表的一项里程碑式研究，于 1969 年给出了 erf(x) 和 erfc(x) 的近乎最佳有理切比雪夫逼近，最大相对误差低至 \( 6 \times 10^{-19} \) 到 \( 3 \times 10^{-20} \) 之间<sup>[16](https://portal.mardi4nfdi.de/wiki/Rational_Chebyshev_Approximations_for_the_Error_Function)</sup>。现代实现遵循同样的分工：对小自变量，直接对 erf 本身作有理逼近；对较大自变量，则对缩放乘积 erfc(z)·e^{z²}·z 作逼近，该乘积接近常数，可避免灾难性抵消<sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/sf_erf/error_function.html)</sup>。

**为什么 erfc 是一个独立的函数。** 当 erf 接近 1 时，用 1 − erf 计算 erfc 会丢失大部分有效数字。在 x = 3 处，erf 为 0.999978，而 erfc 为 0.00002211；从 1 中减去前者会破坏后者的精度<sup>[8](https://www.statgarden.com/maths/error-function.html)</sup>。Python 文档给出了提供 math.erfc 的同样理由：它用于大 x 的情形，此时从 1 中相减会造成有效数字的损失<sup>[17](https://docs.python.org/3/library/math.html?highlight=dist)</sup>。出于同一类原因，还提供了缩放余误差函数 erfcx(z)，用于在不发生下溢或上溢的情况下计算 \( \mathrm{e}^{z^2}\,\mathrm{erfc}(z) \) 形式的表达式<sup>[18](https://support.nag.com/doc/techrep/pdf/tr4_16.pdf)</sup>。

**软件可用性。** erf 和 erfc 随 C99 进入 C 标准库<sup>[5](https://open-std.org/jtc1/sc22/wg14/www/docs/n843.htm)</sup>，并自 3.2 版起在 Python 的 math 模块中提供<sup>[17](https://docs.python.org/3/library/math.html?highlight=dist)</sup>。SciPy 的 scipy.special 提供 erf、erfc、erfcx、虚误差函数 erfi、反函数 erfinv 和 erfcinv，以及法捷耶娃函数 wofz，并且 erf 通过数组 API 标准支持 CuPy 和 PyTorch 等 GPU 后端<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.erf.html)</sup>。

## 应用

**扩散与热传导。** 求解具有阶跃函数初始温度的一维热方程，得到的解可直接用 erf 表示：\( u(x,t) = \tfrac{1}{2}\left[1 + \mathrm{erf}\left(x/\sqrt{4t}\right)\right] \)<sup>[6](https://math.mit.edu/classes/18.086/2006/am54.pdf)</sup>。更一般地，任何解涉及扩散高斯剖面的问题，包括扩散，最终都用 erf 表示；而当所关心的量是尾部而非中部时，erfc 就会出现<sup>[8](https://www.statgarden.com/maths/error-function.html)</sup>。

**复自变量与法捷耶娃函数。** 法捷耶娃函数 \( w(z) = \mathrm{e}^{-z^2}\,\mathrm{erfc}(-\mathrm{i}z) \) 将复自变量下的误差函数打包在一起，在热等离子体线性波理论中被称为等离子体色散函数<sup>[1](https://dlmf.nist.gov/7.2)</sup><sup> • </sup><sup>[19](https://dlmf.nist.gov/7.21)</sup>。由 w(z) 可直接得到其他复值误差类函数，包括 erf 和 erfc<sup>[20](https://arxiv.org/abs/2511.20661)</sup>。

**光谱学。** 福伊格特函数（Voigt functions）将谱线形状描述为高斯展宽与洛伦兹展宽的卷积，可通过复自变量的 erfc 表示：\( \mathsf{U}(x,t) + \mathrm{i}\,\mathsf{V}(x,t) = \sqrt{\pi/(4t)}\,\mathrm{e}^{z^2}\,\mathrm{erfc}\,z \)，其中 \( z = (1 - \mathrm{i}x)/(2\sqrt{t}) \)<sup>[21](https://dlmf.nist.gov/7.19)</sup>。这些函数出现在天体物理学、等离子体诊断、激光光谱学和中子衍射中<sup>[19](https://dlmf.nist.gov/7.21)</sup>。

## References

1. [DLMF §7.2 Definitions, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/7.2)
2. [DLMF §7.4 Symmetry](https://dlmf.nist.gov/7.4)
3. [scipy.special.erf, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.erf.html)
4. [Breakthroughs in Special Functions and Transforms, mathematicskit documentation](https://cpoli.github.io/mathematicskit/history/special_functions_breakthroughs.html)
5. [ISO/IEC JTC1/SC22/WG14 N843, Committee Draft for C99](https://open-std.org/jtc1/sc22/wg14/www/docs/n843.htm)
6. [Gilbert Strang (2006). The Heat Equation and Convection-Diffusion, MIT 18.086 notes](https://math.mit.edu/classes/18.086/2006/am54.pdf)
7. [DLMF §7.1 Special Notation](https://dlmf.nist.gov/7.1)
8. [Error Function Calculator (erf and erfc), StatGarden](https://www.statgarden.com/maths/error-function.html)
9. [Error Function erf and complement erfc, Boost C++ Libraries documentation](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/sf_erf/error_function.html)
10. [DLMF §7.10 Derivatives](https://dlmf.nist.gov/7.10)
11. [DLMF §7.6 Series Expansions](https://dlmf.nist.gov/7.6)
12. [DLMF §7.12 Asymptotic Expansions](https://dlmf.nist.gov/7.12)
13. [Error function: Introduction to the probability integrals and inverses, Wolfram Functions](https://functions.wolfram.com/GammaBetaErf/Erf/introductions/ProbabilityIntegrals/ShowAll.html)
14. [DLMF §7.18 Repeated Integrals of the Complementary Error Function](https://dlmf.nist.gov/7.18)
15. [Error function reference page, HuntsvilleEngineers](https://huntsvilleengineers.com/math/error-function)
16. [William J. Cody (1969). Rational Chebyshev Approximations for the Error Function, Mathematics of Computation 23 (107), MaRDI portal record](https://portal.mardi4nfdi.de/wiki/Rational_Chebyshev_Approximations_for_the_Error_Function)
17. [math — Mathematical functions, Python 3 documentation](https://docs.python.org/3/library/math.html?highlight=dist)
18. [Scaled complement of the error function erfcx, NAG Technical Report](https://support.nag.com/doc/techrep/pdf/tr4_16.pdf)
19. [DLMF §7.21 Physical Applications](https://dlmf.nist.gov/7.21)
20. [Evaluation of complex-valued error-like functions by the exponentially-convergent trapezoidal rule, arXiv:2511.20661](https://arxiv.org/abs/2511.20661)
21. [DLMF §7.19 Voigt Functions](https://dlmf.nist.gov/7.19)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数学分析与数学模型 › Integrals and integration theory

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/error-function

English original: https://www.edgepedia.org/error-function
