# 辛普森法则

**辛普森法则**（Simpson's rule）是一种牛顿-科茨公式，它通过在被积函数的三个等距采样点上拟合一个二次多项式（抛物线弧），再对该多项式进行精确积分，来近似计算定积分。该法则以英国数学家托马斯·辛普森（Thomas Simpson）命名。<sup>[1](https://mathworld.wolfram.com/SimpsonsRule.html)</sup><sup> • </sup><sup>[2](https://www.youtube.com/watch?v=doAqxrpm6m0)</sup> 其基本形式通常称为辛普森 1/3 法则，即

\[ \int_a^b f(x)\,dx \approx \frac{b-a}{6}\left[f(a)+4f\left(\frac{a+b}{2}\right)+f(b)\right]. \]

| 关键事实 | 详情 |
|---|---|
| 基本公式 | \( \frac{b-a}{6}[f(a)+4f(\frac{a+b}{2})+f(b)] \)，在三个等距点上权重为 1、4、1<sup>[3](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)</sup> |
| 构造方式 | 通过三点 \( (x_{i-1},f(x_{i-1})) \)、\( (x_i,f(x_i)) \)、\( (x_{i+1},f(x_{i+1})) \) 拟合二次多项式，并在两个子区间上精确积分<sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup> |
| 多项式精确性 | 对次数不超过 3 的多项式精确成立，比构造所用的二次多项式高一次<sup>[3](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)</sup><sup> • </sup><sup>[5](https://mathbooks.unl.edu/Calculus/sec-5-9-num-int.html)</sup> |
| 复合误差 | 对某个 \( \xi \in (a,b) \)，\( E = -\frac{(b-a)h^4}{180}f^{(4)}(\xi) \)，因此误差为 \( O(h^4) \)<sup>[6](https://mathworld.wolfram.com/CompositeSimpsonsRule.html)</sup> |
| 误差界 | 对 \( n \) 个子区间，为 \( \frac{(b-a)^5}{180\,n^4}\cdot\max|f^{(4)}(x)| \)<sup>[7](https://clearcalculus.okstate.edu/student-resources/calculus-2-labs/9-calculus-2-labs/80-lab-3-integral-approximations-part-2)</sup> |
| 采样要求 | 复合法则需要偶数个子区间，因此需要奇数个网格点<sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup> |
| 软件 | 以 `scipy.integrate.simpson` 的形式提供，适用于采样数据，包括不等距采样<sup>[8](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html)</sup> |

## 由二次插值推导

该法则使用三个等距点 \( x_0=a \)、\( x_1=a+h \) 和 \( x_2=a+2h=b \)，其中 \( h=\frac{b-a}{2} \)。通过三个值 \( f(x_0) \)、\( f(x_1) \) 和 \( f(x_2) \) 拟合一个二次多项式，然后对这条抛物线在 \( [a,b] \) 上精确积分。<sup>[3](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)</sup><sup> • </sup><sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup> 对插值多项式进行积分，得到 \( \frac{h}{3} \) 形式

\[ \int_{x_{i-1}}^{x_{i+1}} P_i(x)\,dx = \frac{h}{3}\left(f(x_{i-1})+4f(x_i)+f(x_{i+1})\right), \]

由于 \( b-a=2h \)，这与上面的 \( \frac{b-a}{6} \) 形式相同。<sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup>

中间点获得权重 4，因为抛物线的曲率主要由中点承载，而两个端点各获得权重 1。<sup>[3](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)</sup> 一种等价的视角是混合更简单的法则：两份中点法则加上一份梯形法则，可以精确重现被积函数的二次项，使主导误差保持在间距的四阶。<sup>[9](https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter25/section02.html)</sup>

## 为什么二次法则对三次多项式精确

尽管该法则设计用于精确积分二次多项式，但无论使用多少个面板，它也能对每一个三次多项式精确积分。<sup>[5](https://mathbooks.unl.edu/Calculus/sec-5-9-num-int.html)</sup> 泰勒级数分析说明了原因：当加权平均 \( \frac{f(x_{i-1})+4f(x_i)+f(x_{i+1})}{6} \) 在 \( x_i \) 附近展开时，奇数阶项相互抵消，积分与法则的 \( h^3 \) 误差项精确抵消，因此每个面板的误差为 \( O(h^5) \)，整个区间的误差为 \( O(h^4) \)。<sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup> 一个算例证实了这一点：将辛普森法则应用于 \( [1,2] \) 上的 \( f(x)=x^3 \)，得到 3.75，即该积分的精确值。<sup>[10](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/13Integration/newtoncotes/complete.html)</sup>

## 复合法则

为了在更长的区间上积分，辛普森法则被应用于连续的等长子区间对。设 \( n \) 个子区间（n 为偶数），\( h=\frac{b-a}{n} \)，\( x_j=a+jh \)，则复合法则为

\[ \int_a^b f(x)\,dx \approx \frac{h}{3}\left[f(x_0)+4\sum_{j=1}^{n/2}f(x_{2j-1})+2\sum_{j=1}^{n/2-1}f(x_{2j})+f(x_n)\right]. \]

奇数位置的内点获得权重 4，偶数位置的内点获得权重 2，形成熟悉的模式 1、4、2、4、…、2、4、1。<sup>[3](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)</sup><sup> • </sup><sup>[6](https://mathworld.wolfram.com/CompositeSimpsonsRule.html)</sup><sup> • </sup><sup>[11](https://math.okstate.edu/people/xzhang/F20Math4513/Notes/NA-Ch4-Student.pdf)</sup> 需要偶数个子区间，因为每个面板跨越两个子区间。<sup>[4](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)</sup>

若 \( f \) 在 \( [a,b] \) 上具有连续的四阶导数，则复合误差为

\[ E(f) = -\frac{(b-a)h^4}{180}f^{(4)}(\mu) \]

其中 \( \mu \) 为 \( (a,b) \) 内的某个点。<sup>[6](https://mathworld.wolfram.com/CompositeSimpsonsRule.html)</sup><sup> • </sup><sup>[11](https://math.okstate.edu/people/xzhang/F20Math4513/Notes/NA-Ch4-Student.pdf)</sup> 就子区间数目而言，误差的上界为 \( \frac{(b-a)^5}{180\,n^4}\cdot\max|f^{(4)}(x)| \)，因此 \( n \) 每翻倍一次，最坏情况误差界就缩小为原来的 1/16。<sup>[7](https://clearcalculus.okstate.edu/student-resources/calculus-2-labs/9-calculus-2-labs/80-lab-3-integral-approximations-part-2)</sup> NIST 数学函数数字图书馆给出了等价的单面板形式 \( \int_a^b f(x)\,dx=\frac{1}{3}h(f(a)+4f(\frac{1}{2}(a+b))+f(b))-\frac{1}{90}h^5 f^{(4)}(\xi) \)，其中 \( h=\frac{1}{2}(b-a) \)。<sup>[12](https://dlmf.nist.gov/3.5)</sup>

## 辛普森 3/8 法则

一个相关的牛顿-科茨公式使用四个等距点而非三个。设间距为 \( h \) 的表格值为 \( f_1, f_2, f_3, f_4 \)，辛普森 3/8 法则为

\[ \int_{x_1}^{x_4} f(x)\,dx = \frac{3}{8}h\left(f_1+3f_2+3f_3+f_4\right)-\frac{3}{80}h^5 f^{(4)}(\xi). \]

在 \( [0,6] \) 上对 \( f(x)=\cos(x)+xe^{-x} \) 的一次比较中，其精确积分为 0.7032332366，使用区间宽度为 2 的辛普森 1/3 法则三次，得到 0.6876458772；而使用宽度为 3 的 3/8 法则两次，得到 0.6723034556，因此在该情形下 1/3 法则更精确。<sup>[10](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/13Integration/newtoncotes/complete.html)</sup>

## 用于采样数据

辛普森法则是积分表格数据而非已知函数的标准方法。SciPy 提供了 `scipy.integrate.simpson` 用于对采样值执行复合法则，可选支持不等距采样位置，并提供 `cumulative_simpson` 用于使用 1/3 法则的累积积分。<sup>[8](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html)</sup> 精确性取决于采样：对于奇数个等距采样，结果对 3 阶或更低阶的多项式精确；但如果采样不等距，则仅对 2 阶或更低阶的多项式精确。<sup>[8](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html)</sup> 当数据按顺序到达且无法重新采样时，对每个三点组应用该法则是一种实用的方法；在一次对在整数点采样的阻尼振子的测试中，辛普森法则的误差约为同一数据上的辛普森 3/8 法则误差的 1/2.39。<sup>[10](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/13Integration/newtoncotes/complete.html)</sup>

## 在求积法则中的地位

辛普森法则是三点闭牛顿-科茨公式，介于两点梯形法则和更高点的法则（如布尔法则）之间。<sup>[1](https://mathworld.wolfram.com/SimpsonsRule.html)</sup><sup> • </sup><sup>[13](https://mathworld.wolfram.com/Simpsons38Rule.html)</sup> 其四阶误差使它在光滑函数上比二阶梯形法则精确得多；对于经典形式不适用的情况，例如被积函数在区间上不是四次可微的，也存在改进方法。<sup>[14](https://arxiv.org/abs/2011.13559)</sup> 对于自适应或高精度工作，软件库通常会在辛普森法则之外提供[高斯求积](https://www.edgepedia.org/zh/gaussian-quadrature)和自适应程序；例如，SciPy 同时提供用于采样数据的 `simpson` 和用于自适应求积的 `quad`。<sup>[8](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html)</sup>

## References

1. [Simpson's Rule, Wolfram MathWorld](https://mathworld.wolfram.com/SimpsonsRule.html)
2. [NUMERICAL INTEGRATION: SIMPSON'S 3/8 RULE (video description naming Thomas Simpson)](https://www.youtube.com/watch?v=doAqxrpm6m0)
3. [Newton-Cotes Quadrature: The Trapezoidal and Simpson's Rules, A-Warded Numerical Analysis](https://a-warded.org/open-book/university-numerical-analysis/lesson-21)
4. [Simpson's Rule, Python Numerical Methods (Berkeley)](https://pythonnumericalmethods.studentorg.berkeley.edu/notebooks/chapter21.04-Simpsons-Rule.html)
5. [Numerical Integration, University of Nebraska-Lincoln Calculus](https://mathbooks.unl.edu/Calculus/sec-5-9-num-int.html)
6. [Composite Simpson's Rule, Wolfram MathWorld](https://mathworld.wolfram.com/CompositeSimpsonsRule.html)
7. [Lab 3: Integral approximations, part 2, Oklahoma State University](https://clearcalculus.okstate.edu/student-resources/calculus-2-labs/9-calculus-2-labs/80-lab-3-integral-approximations-part-2)
8. [scipy.integrate.simpson, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html)
9. [25.2 Simpson's Rule, MIT OpenCourseWare 18.013A](https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter25/section02.html)
10. [Topic 13.4: Newton-Cotes Rules, University of Waterloo](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/13Integration/newtoncotes/complete.html)
11. [MATH 4513 Numerical Analysis, Chapter 4 notes, Oklahoma State University](https://math.okstate.edu/people/xzhang/F20Math4513/Notes/NA-Ch4-Student.pdf)
12. [DLMF §3.5(ii) Simpson's Rule, NIST](https://dlmf.nist.gov/3.5)
13. [Simpson's 3/8 Rule, Wolfram MathWorld](https://mathworld.wolfram.com/Simpsons38Rule.html)
14. [Simpson's Rule Revisited, arXiv:2011.13559](https://arxiv.org/abs/2011.13559)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Numerical, string, and geometric algorithms › Numerical methods and approximation

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/simpsons-rule

English original: https://www.edgepedia.org/simpsons-rule
