# 霍纳法

**霍纳法**（亦称霍纳法则或霍纳方案）是一种多项式求值算法：将多项式改写为嵌套形式，由最内层括号向外逐层计算，从而在给定点处求出多项式的值。对于 n 次多项式，该算法只需 n 次乘法和 n 次加法；且计算过程中的中间量恰好给出多项式除以一个线性因子所得的商与余数，由此将该方法与综合除法及求根联系起来。<sup>[1](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)</sup><sup> • </sup><sup>[2](https://www.phy.olemiss.edu/~kbeach/courses/spring2026/phys540/sci-comp/polynomials.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 运算次数 | 求一个 n 次多项式的值只需 n 次乘法和 n 次加法；中学式的直接求值最佳也需 2n − 1 次乘法和 n 次加法<sup>[1](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)</sup> |
| 递推公式 | 令 b_n = a_n，并对 k = n−1, …, 0 令 b_k = α·b_{k+1} + a_k，则 f(α) 的值等于 b_0<sup>[3](https://dlmf.nist.gov/1.11)</sup> |
| 顺带求出导数 | 扩展方案：令 c_n = a_n，并对 k = n−1, …, 1 令 c_k = α·c_{k+1} + b_k，则 f′(α) = c_1<sup>[3](https://dlmf.nist.gov/1.11)</sup> |
| 原始文献 | 威廉·乔治·霍纳，《用连续逼近法求解各阶数值方程的新方法》，《Philosophical Transactions of the Royal Society of London》，第 109 卷（1819 年），第 308–335 页<sup>[4](https://course.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=horner-1819.pdf)</sup> |
| 更早的记载 | 沙拉夫·丁·图西（Sharaf al-Din al-Tusi）在 12 世纪初已描述此法，秦九韶于 1247 年亦有记载，保罗·鲁菲尼（Paolo Ruffini）于 1804 年发表，均早于霍纳<sup>[1](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)</sup><sup> • </sup><sup>[5](https://www.sciencedirect.com/science/article/pii/S0315086098922145)</sup> |
| 后向误差 | 计算所得的值，恰是某个多项式的精确值，该多项式的系数相对于原多项式系数的扰动不超过 γ_{2n}<sup>[6](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)</sup> |
| 并行替代方案 | 埃斯特林方法以额外运算换取并行性；在 2022 年的 M1 Pro 上，对于长度为 N 的双精度多项式，N 较大时埃斯特林方法耗时 0.28·N 纳秒，霍纳法为 1.24·N 纳秒，但前者精度较低<sup>[7](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/estrin.html)</sup> |

## 工作原理

对于通常形式书写的多项式

\[ f(z) = a_n z^n + a_{n-1} z^{n-1} + \cdots + a_1 z + a_0, \]

霍纳法将其改写为嵌套形式：

\[ f(x) = (\cdots((a_n x + a_{n-1})x + a_{n-2})x + \cdots + a_1)x + a_0. \]

从左到右依次计算，需 n 次乘法和 n 次加法。美国国家标准与技术研究院的数字数学函数库将同一计算表述为递推：令 b_n = a_n，对 k = n−1 递减至 0 计算 b_k = α·b_{k+1} + a_k；则 f(α) = b_0。<sup>[3](https://dlmf.nist.gov/1.11)</sup><sup> • </sup><sup>[1](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)</sup>

相比直接求值，节省的运算量随次数增长。对 n 次多项式按朴素顺序运算约需 n(n+1)/2 次运算，量级为 O(n²)；而嵌套形式只需 2n 次运算，量级为 O(n)。<sup>[2](https://www.phy.olemiss.edu/~kbeach/courses/spring2026/phys540/sci-comp/polynomials.html)</sup> 该方法在寄存器使用上也很高效，MATLAB 内置的 `polyval` 函数即采用霍纳法则。<sup>[8](https://www.cfm.brown.edu/people/dobrush/am33/Matlab/ch3/part3.html)</sup>

**导数。** 第二个并行的递推可在不增加渐近代价的情况下给出导数。令 c_n = a_n，对 k = n−1 递减至 1 计算 c_k = α·c_{k+1} + b_k，则 f′(α) 的值等于 c_1。这使得用于多项式求根的牛顿法只需一趟算法即可同时得到 P 和 P′。<sup>[3](https://dlmf.nist.gov/1.11)</sup><sup> • </sup><sup>[9](https://people.sc.fsu.edu/~jburkardt/classes/math2070_1999/lab_05.html)</sup>

## 综合除法与求根

求值过程中产生的中间值，恰是 f(x) 除以 (x − α) 所得商多项式的系数，而最终值即余数。因此，霍纳方案常与综合除法视为同一回事——综合除法就是课堂上教授的那种用纸笔表格除以线性因子的多项式除法。<sup>[2](https://www.phy.olemiss.edu/~kbeach/courses/spring2026/phys540/sci-comp/polynomials.html)</sup>

这一联系支撑了两种标准的数值做法。其一，一旦已知 p(x) 的一个根 r₁，霍纳法的一个变体便可给出降阶多项式 p₂(x) 的系数，满足 p(x) = p₂(x)·(x − r₁) + p(r₁)；重复这一称为降阶的过程，即可逐个求出其余的根。<sup>[9](https://people.sc.fsu.edu/~jburkardt/classes/math2070_1999/lab_05.html)</sup> 其二，由于同一趟计算同时给出函数值与导数，用于多项式的牛顿法（有时称为牛顿–霍纳法）可直接建立在该方案之上。<sup>[9](https://people.sc.fsu.edu/~jburkardt/classes/math2070_1999/lab_05.html)</sup>

该方法在其他数值计算中也常作为基本构件。DLMF 指出，正交多项式可由其显式多项式形式通过霍纳方案计算，不过就这一用途而言，差分方程与渐近展开通常更为高效，尤其是在次数较大时。<sup>[10](https://dlmf.nist.gov/18.40)</sup>

## 历史

该算法以威廉·乔治·霍纳（William George Horner）命名，其论文《用连续逼近法求解各阶数值方程的新方法》由戴维斯·吉尔伯特（Davies Gilbert）转呈，于 1819 年 7 月 1 日在皇家学会宣读，并发表于《Philosophical Transactions of the Royal Society of London》第 109 卷（1819 年），第 308–335 页。<sup>[4](https://course.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=horner-1819.pdf)</sup> 这个名字的由来纯属历史偶然。保罗·鲁菲尼早在 1804 年的一篇论文中即已发表该方法；1999 年《Historia Mathematica》上的一项研究表明，在英格兰，霍尔德雷德（Holdred）先于霍纳发表了该方法；该研究结论认为，该算法以“霍纳法”之名传播，主要归功于奥古斯都·德·摩根（Augustus De Morgan）。<sup>[5](https://www.sciencedirect.com/science/article/pii/S0315086098922145)</sup> 因此，该方案有时也被称为鲁菲尼–霍纳法。<sup>[11](https://www.treccani.it/enciclopedia/paolo-ruffini_(Il-Contributo-italiano-alla-storia-del-Pensiero:-Scienze)/)</sup>

其基本思想远比欧洲的出版物古老。波斯数学家沙拉夫·丁·图西在 12 世纪初即描述了该算法，中国数学家秦九韶在一个世纪后独立记载了它。<sup>[1](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)</sup> 秦九韶 1247 年的著作《数书九章》用该方法确定代数方程的根，亚历山大·怀利（Alexander Wylie）1852 年的综述使欧洲读者注意到这一成就早于其他地方的同类工作。<sup>[12](https://www.research.ed.ac.uk/en/publications/the-intertwining-of-mathematical-practice-and-knowledge-understan/)</sup> 中国古代数学家将算筹布列于案上而非纸上运用此法，逐位确定根，并在每一步对等式进行降阶。<sup>[13](https://donwagner.dk/horner/horner.html)</sup>

## 浮点运算中的精度

霍纳法的后向误差很小：计算所得的值，恰是某个多项式在 x 处的精确值，该多项式由对 p(x) 的系数施加相对扰动得到，扰动大小不超过 γ_{2n}，其中 γ_{2n} 表示与 2n 倍单位舍入误差成正比的界。<sup>[6](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)</sup> 这一性质并不保证对每个多项式都能得到准确答案。对一大类多项式，尤其是病态多项式，霍纳法可能非常不准确；存在一种替代算法，平均而言精确 100 至 1000 倍，代价是单次求值的浮点运算量翻倍。<sup>[14](https://arxiv.org/abs/0805.3194)</sup>

**补偿霍纳法。** 补偿霍纳算法利用无误差变换（可精确计算舍入误差）提高精度。补偿方案与以双倍工作精度执行的经典霍纳方案同样精确，运行时间开销合理，并附带计算值的动态误差界。<sup>[15](https://drops.dagstuhl.de/entities/document/10.4230/DagSemProc.05391.3)</sup> 已有文献给出了补偿算法返回忠实舍入结果（即精确求值的两个相邻浮点数之一）的充分条件。<sup>[16](https://arxiv.org/abs/cs/0610122)</sup>

## 性能与埃斯特林方法

霍纳法使算术运算次数最少，但其串行结构限制了在现代硬件上的速度：每一步都依赖前一步，因此关键路径很长。埃斯特林方法将多项式拆分为可同时求值的块，从而更好地利用现代 CPU 上的 SIMD 流水线和融合乘加指令。<sup>[7](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/estrin.html)</sup>

Boost.Math 文档给出了具体数字：在 2022 年的 M1 Pro 上，对于长度为 N 的双精度多项式，N 较大时使用埃斯特林方法并借助暂存空间耗时 0.28·N 纳秒，而霍纳法耗时 1.24·N 纳秒。当系数在编译期已知并存入 `std::array` 时，埃斯特林方法无条件更快；当系数在运行期计算时，只有 N 大致大于 90 时埃斯特林方法才更优。这些数字在很大程度上取决于编译器选项和体系结构，且埃斯特林方法的精度低于霍纳法。<sup>[7](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/estrin.html)</sup>

## References

1. [Polynomial evaluation, University of Waterloo, Department of Electrical and Computer Engineering](https://ece.uwaterloo.ca/~dwharder/Algorithmic_thinking/Polynomial_evaluation/)
2. [Polynomials, Scientific Computing documentation, University of Mississippi](https://www.phy.olemiss.edu/~kbeach/courses/spring2026/phys540/sci-comp/polynomials.html)
3. [DLMF: §1.11 Zeros of Polynomials, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/1.11)
4. [W. G. Horner (1819). A New Method of Solving Numerical Equations of All Orders, by Continuous Approximation. Philosophical Transactions of the Royal Society of London, Vol. 109, pp. 308–335.](https://course.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=horner-1819.pdf)
5. [A. Thomas Fuller (1999). Horner versus Holdred: An Episode in the History of Root Computation. Historia Mathematica 26(1), 29–51.](https://www.sciencedirect.com/science/article/pii/S0315086098922145)
6. [Polynomials lecture notes (backward error of Horner's method), University of Wisconsin–Madison](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)
7. [Estrin's method for polynomial evaluation, Boost.Math documentation](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/estrin.html)
8. [MATLAB tutorial for the First Course, Part III: Numerical Methods, Brown University](https://www.cfm.brown.edu/people/dobrush/am33/Matlab/ch3/part3.html)
9. [LAB #5: Polynomials and Newton's Method, Florida State University](https://people.sc.fsu.edu/~jburkardt/classes/math2070_1999/lab_05.html)
10. [DLMF: §18.40 Methods of Computation, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/18.40)
11. [Paolo Ruffini, Enciclopedia Treccani (Il Contributo italiano alla storia del Pensiero: Scienze)](https://www.treccani.it/enciclopedia/paolo-ruffini_(Il-Contributo-italiano-alla-storia-del-Pensiero:-Scienze)/)
12. [Karine Chemla (2025). The intertwining of mathematical practice and knowledge. Understanding Qin Jiushao's 1247 work in a cultural context. Centaurus 67(3).](https://www.research.ed.ac.uk/en/publications/the-intertwining-of-mathematical-practice-and-knowledge-understan/)
13. [Donald B. Wagner. The classical Chinese version of Horner's method](https://donwagner.dk/horner/horner.html)
14. [Accurate Evaluation of Polynomials, arXiv:0805.3194](https://arxiv.org/abs/0805.3194)
15. [Philippe Langlois, Stef Graillat, Nicolas Louvet (2006). Compensated Horner Scheme. Dagstuhl Seminar Proceedings 5391.](https://drops.dagstuhl.de/entities/document/10.4230/DagSemProc.05391.3)
16. [Faithful Polynomial Evaluation with Compensated Horner Algorithm, arXiv:cs/0610122](https://arxiv.org/abs/cs/0610122)

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

Topic: 物质世界与数学 › 数学与统计学 › 数学分析与数学模型 › Numerical analysis and computation

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/horners-method

English original: https://www.edgepedia.org/horners-method
