# 样条（数学）

在数学中，样条是一种在定义域的各子区间上由多项式分段定义的函数，各段之间以特定方式连接，使得函数在断点处具有指定阶数的光滑性（即某些导数连续）。样条用于对数据和曲线进行插值或逼近，同时避免单个高次多项式可能产生的剧烈振荡；而每一条样条都可以写成B样条的加权和，B样条是由节点序列确定的一组基函数。<sup>[1](https://www.researchgate.net/publication/278640646_Spline_Basics)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 一种分段多项式函数，通常为低次，其各段在断点处以指定的光滑性衔接；考虑更多阶导数会提高光滑性<sup>[2](https://dlmf.nist.gov/3.11)</sup> |
| 术语起源 | 由I. J. Schoenberg于1946年引入；“spline”本是一种制图工具的名称，即用重物在若干点处固定的柔性细杆，可机械地解决插值问题<sup>[3](https://mathshistory.st-andrews.ac.uk/Extras/De_Boor_books/)</sup> |
| B样条基 | B样条最早出现在Schoenberg 1946年关于用解析函数逼近等距数据的论文中；样条是B样条的加权和<sup>[4](https://ftp.cs.wisc.edu/Approx/survey76.pdf)</sup><sup> • </sup><sup>[1](https://www.researchgate.net/publication/278640646_Spline_Basics)</sup> |
| 标准选择 | 三次样条插值：一种全局\( C^2 \)的分段三次多项式，既避免振荡又保持光滑<sup>[5](https://roesner.pages.ub.uni-bielefeld.de/lectures/computational-physics/semester/sose2026/lecture/02_interpolation/07_hermite_spline.html)</sup> |
| 为何不用单个多项式 | 对于龙格函数\( f(x)=1/(1+25x^2) \)在\([-1,1]\)上取等距节点，最大插值误差随次数增加而无界增长<sup>[6](https://tildesites.geneseo.edu/~aguilar/public/assets/courses/345/numerical-analysis.pdf)</sup> |
| 含噪数据平滑 | 平滑样条最小化数据保真度与粗糙度\( \int (S''(x))^2\,dx \)的加权组合；平滑参数由广义交叉验证选取<sup>[7](https://math.nist.gov/~BRust/pubs/CiSE08/ReprintCiSE-08.pdf)</sup> |
| 工程应用 | 非均匀有理B样条（NURBS）是CAD中的标准几何表示，也是等几何分析的基础<sup>[8](https://www.sciencedirect.com/science/article/pii/S0045782504005171)</sup> |

## 动机：单个多项式的失败

用单个\( n \)次多项式对\( n+1 \)个数据点进行插值，可以在节点处精确重现数据，但无法控制节点之间的行为。卡尔·龙格（Carl Runge）1901年的例子展示了这种危险：对于\( f(x)=1/(1+25x^2) \)在\([-1,1]\)上，在等距节点处插值会在端点附近产生振荡，且随着节点增多而加剧，最大误差\( \max_{x\in[-1,1]}|f(x)-P(x)| \)当\( n\to\infty \)时趋于无穷。<sup>[6](https://tildesites.geneseo.edu/~aguilar/public/assets/courses/345/numerical-analysis.pdf)</sup>这种现象被称为龙格现象。<sup>[5](https://roesner.pages.ub.uni-bielefeld.de/lectures/computational-physics/semester/sose2026/lecture/02_interpolation/07_hermite_spline.html)</sup>

有两种标准策略可以解决该问题。埃尔米特插值在节点处加入导数值作为额外条件，得到次数至多为\( 2n+1 \)的多项式，同时匹配\( f \)和\( f' \)。三次样条插值则使用全局\( C^2 \)的分段三次多项式，在保持光滑的同时避免振荡。<sup>[5](https://roesner.pages.ub.uni-bielefeld.de/lectures/computational-physics/semester/sose2026/lecture/02_interpolation/07_hermite_spline.html)</sup>在许多应用中，与涉及相当数量参数的拉格朗日插值多项式相比，样条是适应性更强的逼近工具。<sup>[2](https://dlmf.nist.gov/3.11)</sup>

## 构造与边界条件

给定\( n+1 \)个互异点\( a=x_0<x_1<\cdots<x_n=b \)，在每个子区间\([x_k,x_{k+1}]\)上定义一个低次多项式，其系数由节点处的函数值和导数等数据确定；这些分段的集合定义了\([a,b]\)上的样条。<sup>[2](https://dlmf.nist.gov/3.11)</sup>三次样条有\( n \)个三次分段，必须满足函数、一阶导数和二阶导数在内断点处的连续性；剩余的自由度由两个端点条件确定。

软件将这些端点条件显式暴露出来。在SciPy中，`CubicSpline`和`make_interp_spline`默认采用非扭结边界条件，即强制三阶导数在第二个和倒数第二个数据点处连续；`bc_type`还接受`"natural"`（两端二阶导数为零）、`"clamped"`（两端一阶导数为零）和`"periodic"`（两端导数相等，产生光滑的周期插值函数）。<sup>[9](https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html)</sup><sup> • </sup><sup>[10](https://scipy.github.io/devdocs/tutorial/interpolate/extrapolation_examples.html)</sup>超出范围求值则单独控制：默认情况下使用边界多项式分段求值，也可以禁用外推（返回NaN），或请求周期环绕。<sup>[9](https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html)</sup>

当数据不光滑时，普通三次样条可能产生过冲。保形替代方案如PCHIP（分段三次埃尔米特插值多项式）构造一个\( C^1 \)单调三次插值函数，保持数据的单调性且不发生过冲，代价是允许二阶导数在数据点处跳跃。<sup>[11](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html)</sup>

## B样条

现代理论将任意样条表示为B样条的线性组合，B样条是由节点序列确定的紧支撑分段多项式。威斯康星大学麦迪逊分校荣休教授、样条理论的核心人物卡尔·德布尔（Carl de Boor）列举了B样条基的实用性质：递推关系、局部支撑与正性、Marsden恒等式、单位分解、节点平均、局部线性无关性、对偶泛函、良好条件数、凸包性质以及简洁的微分公式。<sup>[1](https://www.researchgate.net/publication/278640646_Spline_Basics)</sup>局部支撑意味着每个基函数只在少数几个节点区间上非零，因此逼近中出现的线性系统的系数矩阵是带状矩阵，求解代价低。<sup>[3](https://mathshistory.st-andrews.ac.uk/Extras/De_Boor_books/)</sup>

该基在数值上也表现良好。1988年，德布尔证明了：在一个节点区间上非零的\( k \)阶B样条构成的多项式基，除尺度因素外，其条件数良好当且仅当与该区间长度相比，至多有一个节点（即至少有\( k-1 \)个节点）保持有限。<sup>[12](https://epubs.siam.org/doi/10.1137/0725011)</sup>

从历史上看，B样条最早出现在Schoenberg 1946年关于用解析函数逼近等距数据的论文中；他的同事H. B. Curry观察到，将其表述为\( k \)阶差分可推广为任意节点上的\( k \)阶均差，而Schoenberg本人则在20世纪60年代末至70年代初的七篇系列论文中发展了基数样条插值。<sup>[4](https://ftp.cs.wisc.edu/Approx/survey76.pdf)</sup>

## 平滑样条与回归样条

样条拟合最初是为插值而发展的，在每个数据点处设一个节点，并约束样条精确重现每个\( y_i \)。对于受随机测量误差污染的数据，出现了两种主要方法：平滑样条和回归（最小二乘）样条。<sup>[7](https://math.nist.gov/~BRust/pubs/CiSE08/ReprintCiSE-08.pdf)</sup>

平滑样条在每个\( x_i \)处设一个节点，但不穿过数据点。相反，它最小化数据保真度与粗糙度的凸组合，

\[ (1-q)\sum_{i=1}^{N}\left[\frac{y_i-S(x_i)}{\sigma_i}\right]^2 + q\int_{x_1}^{x_N} [S''(x)]^2\,dx, \]

其中\( \sigma_i^2 \)度量误差方差，\( 0<q<1 \)设定平滑量。在极限\( q=0 \)时解为插值样条；当\( q\to 1 \)时退化为直线拟合。<sup>[7](https://math.nist.gov/~BRust/pubs/CiSE08/ReprintCiSE-08.pdf)</sup>在Craven和Wahba的一般表述中，\( \frac{1}{n}\sum_j (f(t_j)-y_j)^2 + \lambda\int_0^1 [f^{(m)}(u)]^2\,du \)的最小化者是\( 2m-1 \)次多项式平滑样条，他们提出了广义交叉验证估计\( \hat\lambda \)，即\( V(\lambda)=\|(I-A(\lambda))y\|^2/[\operatorname{Tr}(I-A(\lambda))]^2 \)的最小化者，该估计不需要已知噪声方差。<sup>[13](https://sites.stat.washington.edu/courses/stat527/s14/readings/cravenwabha79.pdf)</sup>

回归样条走另一条路：减少节点数量，使每个节点区间内落入多个数据点，然后用最小二乘法拟合所得的样条。节点越少，样条越光滑，因此实际问题是用多少节点以及把它们放在哪里。<sup>[7](https://math.nist.gov/~BRust/pubs/CiSE08/ReprintCiSE-08.pdf)</sup>

## 几何与工程中的样条

在计算机图形学和几何设计中，一种特殊的样条形式产生贝塞尔曲线。三次贝塞尔曲线由四个点定义，即两个端点和两个控制点；曲线在每个端点处的切线与该端点至相邻控制点的连线重合，将若干贝塞尔曲线组合起来便得到完整的样条。这种构造用于数学排版和字体设计。<sup>[2](https://dlmf.nist.gov/3.11)</sup>

工业标准是NURBS，即非均匀有理B样条，它推广了多项式B样条，是CAD系统中的主流表示。<sup>[14](https://www.sciencedirect.com/science/article/pii/S0965997898001100)</sup>等几何分析由T. J. R. Hughes、J. A. Cottrell和Y. Bazilevs于2005年提出，它既使用NURBS基函数构建精确几何模型，又将其作为有限元计算的基，在不改变几何的情况下细化或升阶基函数；除引入\( h \)-细化和\( p \)-细化的类似方案外，还引入了高阶\( k \)-细化方案。<sup>[8](https://www.sciencedirect.com/science/article/pii/S0045782504005171)</sup>

## References

1. [Carl R. de Boor, "Spline Basics," in Handbook of Computer Aided Geometric Design (2002), pp. 141–163](https://www.researchgate.net/publication/278640646_Spline_Basics)
2. [DLMF §3.11(vi) Splines, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/3.11)
3. [De Boor books, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Extras/De_Boor_books/)
4. [Carl de Boor, "Splines as linear combinations of B-splines" (survey, emended 1986 version)](https://ftp.cs.wisc.edu/Approx/survey76.pdf)
5. [Hermite and Spline Interpolation, Computational Physics lecture notes, Universität Bielefeld](https://roesner.pages.ub.uni-bielefeld.de/lectures/computational-physics/semester/sose2026/lecture/02_interpolation/07_hermite_spline.html)
6. [Numerical Analysis I course notes, SUNY Geneseo (Runge's phenomenon)](https://tildesites.geneseo.edu/~aguilar/public/assets/courses/345/numerical-analysis.pdf)
7. [B. W. Rust et al., "Fitting Nature's Basic Functions," Computing in Science & Engineering (2008), Further Information section](https://math.nist.gov/~BRust/pubs/CiSE08/ReprintCiSE-08.pdf)
8. [T. J. R. Hughes, J. A. Cottrell, Y. Bazilevs, "Isogeometric analysis: CAD, finite elements, NURBS, exact geometry and mesh refinement," Comput. Methods Appl. Mech. Engrg. 194 (2005) 4135–4195](https://www.sciencedirect.com/science/article/pii/S0045782504005171)
9. [1-D interpolation, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html)
10. [Extrapolation tips and tricks, SciPy dev Manual](https://scipy.github.io/devdocs/tutorial/interpolate/extrapolation_examples.html)
11. [scipy.interpolate.PchipInterpolator, SciPy Reference Guide](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html)
12. [Carl de Boor, "The Condition of the B-Spline Basis for Polynomials," SIAM J. Numer. Anal. 25(1), 148–152 (1988)](https://epubs.siam.org/doi/10.1137/0725011)
13. [P. Craven, G. Wahba, "Smoothing noisy data with spline functions," Numerische Mathematik 31 (1979) 377–403](https://sites.stat.washington.edu/courses/stat527/s14/readings/cravenwabha79.pdf)
14. [sciencedirect.com page](https://www.sciencedirect.com/science/article/pii/S0965997898001100)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026; Oct 21, 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/spline-mathematics

English original: https://www.edgepedia.org/spline-mathematics
