YYnotesYYNotes

学习目标Learning Objectives - Note

#学习目标#关键概念#定义与公式#推导

第3周:Lagrange 与 Hermite 插值Week 3 - Lagrange and Hermite Interpolation

第3周将插值从“仅函数值约束”推进到“函数值+导数约束”。Bilingual notes on interpolation bases and derivative constraints.

第3周将插值从“仅函数值约束”推进到“函数值+导数约束”。

Week 3 develops interpolation from value-only constraints to value-plus-derivative constraints.

学习目标

Learning Objectives

  • Construct interpolation polynomials in Newton and Lagrange forms.

  • 分别用牛顿形式和 Lagrange 形式构造插值多项式。

  • Build and use Lagrange basis functions for linear and quadratic interpolation.

  • 构造并使用线性、二次插值的 Lagrange 基函数。

  • Formulate Hermite interpolation conditions with repeated nodes.

  • 用重节点思想建立 Hermite 插值条件。

  • 从混合约束 f(xi)f(x_i)f(xi)f'(x_i) 出发求解实际插值问题。

  • Solve practical interpolation problems from mixed constraints f(xi)f(x_i) and f(xi)f'(x_i).

关键概念

Key Concepts

  • Lagrange basis satisfies cardinal conditions: Li(xj)=δijL_i(x_j)=\delta_{ij}.

  • Lagrange 基函数满足基数条件:Li(xj)=δijL_i(x_j)=\delta_{ij}

  • Newton and Lagrange forms represent the same unique interpolation polynomial.

  • 牛顿形式与 Lagrange 形式表示同一个唯一插值多项式。

  • Hermite interpolation imposes value and derivative matching at selected nodes.

  • Hermite 插值在指定节点同时匹配函数值与导数。

  • nn 次多项式插值由 n+1n+1 个独立约束唯一确定。

  • For degree-nn polynomial interpolation, n+1n+1 independent constraints determine uniqueness.

定义与公式

Definitions and Formulas

Lagrange basis:

Lagrange 基函数:

Li(x)=jixxjxixjL_i(x)=\prod_{j\ne i}\dfrac{x-x_j}{x_i-x_j}.

插值多项式:

Interpolation polynomial:

pn(x)=i=0nyiLi(x)p_n(x)=\sum_{i=0}^{n} y_iL_i(x).

Hermite setting at two nodes x0,x1x_0,x_1: match f(x0),f(x0),f(x1),f(x1)f(x_0),f'(x_0),f(x_1),f'(x_1).

两节点 Hermite 情形:匹配 f(x0),f(x0),f(x1),f(x1)f(x_0),f'(x_0),f(x_1),f'(x_1)

A practical Hermite-Newton template from lecture:

课堂中的实用 Hermite-Newton 模板:

Q(x)=Q(x0)+Q[x0](xx0)+c(xx0)2+d(xx0)2(xx1)Q(x)=Q(x_0)+Q'[x_0](x-x_0)+c(x-x_0)^2+d(x-x_0)^2(x-x_1).

推导

Derivations

Lagrange Basis for Two Points

两点情形的 Lagrange 基函数

对节点 x1,x2x_1,x_2,要求 L1(x1)=1L_1(x_1)=1L1(x2)=0L_1(x_2)=0

For nodes x1,x2x_1,x_2, impose L1(x1)=1L_1(x_1)=1, L1(x2)=0L_1(x_2)=0.

Hence L1(x)=xx2x1x2L_1(x)=\dfrac{x-x_2}{x_1-x_2} and L2(x)=xx1x2x1L_2(x)=\dfrac{x-x_1}{x_2-x_1}.

因此 L1(x)=xx2x1x2L_1(x)=\dfrac{x-x_2}{x_1-x_2}L2(x)=xx1x2x1L_2(x)=\dfrac{x-x_1}{x_2-x_1}

Quadratic Lagrange Basis at Three Points

三点二次 Lagrange 基函数

对节点 x1,x2,x3x_1,x_2,x_3,每个 LiL_i 是二次函数并在其余两点处为零。

For nodes x1,x2,x3x_1,x_2,x_3, each LiL_i is degree 2 and vanishes at the other two nodes.

由此直接得到乘积表达式与插值求和式。

This directly yields the product form and interpolation sum.

Hermite Decomposition Idea

Hermite 分解思想

先构造满足初始值与导数约束的简化模型 L(x)L(x)

Construct a simpler model L(x)L(x) satisfying initial value and derivative constraints.

定义余项 g(x)=f(x)L(x)g(x)=f(x)-L(x),并施加重零点条件如 g(x0)=g(x0)=0g(x_0)=g'(x_0)=0

Define gap g(x)=f(x)L(x)g(x)=f(x)-L(x) and force repeated zeros such as g(x0)=g(x0)=0g(x_0)=g'(x_0)=0.

由因式分解得到 (xx0)2(x-x_0)^2 形式,从而确定高阶系数。

Then factorization gives terms like (xx0)2(x-x_0)^2, which determines higher coefficients.

例题精讲

Worked Examples

Example Block 1: Lagrange Linear Interpolation 例题模块1:Lagrange 线性插值

Given f(1)=3f(1)=3, f(2)=5f(2)=5.

给定 f(1)=3f(1)=3f(2)=5f(2)=5

L1(x)=x212=(x2)L_1(x)=\dfrac{x-2}{1-2}=-(x-2), L2(x)=x121=x1L_2(x)=\dfrac{x-1}{2-1}=x-1.

So f(x)=3L1(x)+5L2(x)=2x+1f(x)=3L_1(x)+5L_2(x)=2x+1.

f(x)=3L1(x)+5L2(x)=2x+1f(x)=3L_1(x)+5L_2(x)=2x+1

例题模块2:点 (1,3),(2,5),(5,8)(1,3),(2,5),(5,8) 的二次插值

Example Block 2: Quadratic Interpolation at (1,3),(2,5),(5,8)(1,3),(2,5),(5,8)

用标准乘积公式构造 L1,L2,L3L_1,L_2,L_3

Build L1,L2,L3L_1,L_2,L_3 with the standard product formula.

Then p2(x)=3L1(x)+5L2(x)+8L3(x)p_2(x)=3L_1(x)+5L_2(x)+8L_3(x).

于是 p2(x)=3L1(x)+5L2(x)+8L3(x)p_2(x)=3L_1(x)+5L_2(x)+8L_3(x)

Example Block 3: Hermite with Q(0)=3Q(0)=3, Q(0)=2Q'(0)=2, Q(5)=4Q(5)=4 例题模块3:Q(0)=3,Q(0)=2,Q(5)=4Q(0)=3, Q'(0)=2, Q(5)=4 的 Hermite 问题

先取 L(x)=3+2xL(x)=3+2x

Start with L(x)=3+2xL(x)=3+2x.

因余项在 x=0x=0 处有二重零点,设 Q(x)=L(x)+cx2Q(x)=L(x)+cx^2

Let Q(x)=L(x)+cx2Q(x)=L(x)+cx^2 because gap has double zero at x=0x=0.

Use Q(5)=4Q(5)=4: 4=3+10+25c4=3+10+25c, so c=925c=-\dfrac{9}{25}.

Q(5)=4Q(5)=44=3+10+25c4=3+10+25c,故 c=925c=-\dfrac{9}{25}

Hence Q(x)=3+2x925x2Q(x)=3+2x-\dfrac{9}{25}x^2.

因此 Q(x)=3+2x925x2Q(x)=3+2x-\dfrac{9}{25}x^2

误差(Error)分析

Error Analysis

  • 当节点分布不佳或过近时,插值敏感性会增大。

  • Interpolation sensitivity grows when nodes are badly distributed or too close.

  • 高阶模型虽然可能降低插值残差,但也可能放大舍入误差(Error)

  • Higher-order models can amplify rounding errors despite smaller interpolation residuals.

  • Hermite conditions improve local shape matching but increase algebraic complexity.

  • Hermite 约束改善局部形状匹配,但会增加代数复杂度。

常见错误

Common Mistakes

警示模块

Warning Block

  • Forgetting denominator terms in Lagrange basis.

  • 遗漏 Lagrange 基函数分母项。

  • 在牛顿差商(Divided Difference)中混淆节点顺序。

  • Mixing node order in Newton divided differences.

  • Not enforcing derivative constraints exactly in Hermite construction.

  • 在 Hermite 构造中未严格满足导数约束。

  • 过早使用过多小数近似。

  • Using too many decimal approximations too early.

总结

Summary

总结模块

Summary Block

  • 第3周统一了插值视角,并引入了带导数约束的拟合。

  • Week 3 unified interpolation viewpoints and introduced derivative-aware fitting.

  • Lagrange gives a direct basis form, while Newton form is efficient for incremental updates.

  • Lagrange 形式直观,牛顿形式便于增量更新。

  • Hermite interpolation extends approximation quality by encoding slope information.

  • Hermite 插值通过编码斜率信息提升了逼近质量。

练习题

Practice Questions

  • Construct the quadratic polynomial through (2,6),(3,1),(5,8)(2,6),(3,1),(5,8) in both Newton and Lagrange forms.

  • 分别用牛顿形式和 Lagrange 形式构造经过 (2,6),(3,1),(5,8)(2,6),(3,1),(5,8) 的二次多项式。

  • 求满足 f(2)=1f(2)=1f(3)=f(4)=f(7)=0f(3)=f(4)=f(7)=0 的三次多项式。

  • Find the cubic satisfying f(2)=1f(2)=1 and f(3)=f(4)=f(7)=0f(3)=f(4)=f(7)=0.

  • Solve a Hermite problem with f(1)=3f(1)=3, f(5)=4f(5)=4, f(1)=2f'(1)=2, f(5)=7f'(5)=7.

  • 求解满足 f(1)=3f(1)=3f(5)=4f(5)=4f(1)=2f'(1)=2f(5)=7f'(5)=7 的 Hermite 插值问题。