数值分析读书笔记(5)数值逼近问题(I)----插值极其数值计算

数值分析读书笔记(5)数值逼近问题(I)----插值极其数值计算

给出一般性的插值概念

给定f(x),x \in [a,b],已知它在n+1个互异的节点x_{0},x_{1},\dots上的函数值为y_{0},y_{1},\dots
目的即寻求\varphi (x),使得\varphi(x_{i})=f(x_{i})=y_{i}
令所有的\varphi(x)组成\Phi,通常\Phi是有限维线性空间,记
\Phi=span\{\varphi_{i}(x)\}_{i=0}^{n}
其中\varphi_{i}(x)为一组基, 于是有\varphi(x)=\sum_{i=0}^{n}{a_{i}\varphi_{i}(x)}
故我们可以利用序列\{a_{i}\}_{i=0}^{n}来确定\varphi(x), 这里的\varphi(x)就是插值函数

通过概念我们可以看出来,目的就是让插值函数去接近给定的函数


1.关于多项式插值

当给定插值函数是多项式函数的时候, 我们可以产生一种插值的方案, 下面介绍一下Lagrange插值

P(x)=a_{0}+a_{1}x+a_{2}x^{2}+\cdots +a_{n}x^{n}=\sum_{i=0}^{n}{a_{i}x^{i}}
由于P(x_{i})=y_{i},i=0,1,2,\dots,n
\left\{ \begin{aligned} a_{0}+a_{1}x_{0}+\cdots+a_{n}x^{n}_{0}&=y_{0}\\\vdots\\a_{0}+a_{1}x_{n}+\cdots+a_{n}x^{n}_{n}&=y_{0}\end{aligned}\right.
得系数阵为A=\begin{pmatrix}1&x_{0}&\cdots&x_{0}^{n}\\\vdots&\vdots&\ddots&\vdots\\1&x_{n}&\cdots&x_{n}^{n}\end{pmatrix}
由Vandermonde行列式的特性,我们可以知道\begin{vmatrix}A\end{vmatrix}=\prod_{0\leq i<j\leq n}(x_{j}-x_{i})
x_{i}互异,则有唯一解
构造插值基函数l_{i}(x_{j})=\delta_{ij}=\left\{\begin{aligned} &1 && i=j\\&0&&i\neq j\end{aligned}\right.
i \neq j时,l_{i}(x_{j})=0,故
l_{i}(x)=c_{i}\prod_{k=0,k\neq i}^{n}{(x-x_{k})}
又对于c_{i} 由于l_{i}(x_{j})=1当仅当i=j,故
l_{i}(x_{i})=c_{i}\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})}=1
所以可以得到c_{i}=\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})}^{-1}
我们将c_{i}回代回去,则有
l_{i}(x)=\prod_{k=0,k\neq i}^{n}{\frac{(x-x_{k})}{(x_{i}-x_{k})}}
L_{n}(x)=\sum_{i=0}^{n}y_{i}l_{i}(x)=\sum_{i=0}^{n} \left ( y_{i}\prod_{k=0,k\neq i}^{n}{\frac{(x-x_{k})}{(x_{i}-x_{k})}} \right)
上式即为所求的Lagarange插值函数

这里为了运算记录方便, 记\omega_{n+1}(x)=\prod_{k=0}^{n}(x-x_{k})
则有\omega'_{n+1}(x_i)=\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})},\frac{\omega_{n+1}(x)}{x-x_{i}}=\prod_{k=0,k\neq i}^{n}{(x-x_{k})}
L_{n}(x)=\sum_{i=0}^{n}\left({y_{i}\frac{\omega_{n+1}(x)}{(x-x_{i})\omega'_{n+1}(x_{i})}}\right)

下面继续讨论Lagrange插值的误差,引入误差余项
R(x)\equiv f(x)-L_{n}(x)
我们引入一个辅助函数
F(t)=f(t)-L_{n}(t)-K(x)\omega_{n+1} (t) , t \in [a,b] , x \neq x_{i} , i=0, 1, 2, \dots
这里面对于辅助函数的构造,其中末尾一项是保证当x等于节点中的一个时,误差为0
其中K(x)\omega_{n+1}(x)=f(x)-L_{n}(x)
t=x_{0}, x_{1},\dots,x_{n}是辅助函数的n+2个相异的零点

注意到Rolle定理

\varphi (x) , x \in [a ,b] , \varphi (a) =\varphi (b) = 0, \text{其中}\varphi (x) \text{满足连续等条件, 则必有} \xi \in [a,b],\text{使得}\varphi '(\xi) = 0

F(t) = f(t) - L_{n}(t) - K(x)\omega _{n+1}(t),\text{对}F(t),F'(t),\text{....应用Rolle定理}

\text{必有}\xi \in [a,b] , \text{使得}F^{(n+1)}(\xi) =0 ,\text{故}f^{(n+!)}(\xi)-K(x)(n+1)!=0
\text{故}K(x)=\frac{f^{(n+1)}(x)}{(n+1)!}
\text{从而} R_{n}(x)=\frac{f^{(n+1)}(x)}{(n+1)!}\omega_{n+1}(x)

以上是关于Lagrange插值的介绍,针对Lagrange插值,节点个数的增加或者减少的时候,插值基函数需要变动,为了解决这一问题,我们引入Newton插值

N_{n}(x) = a_{0}+a_{1}(x-x_{0}) + \cdots + a_{n}(x-x_{0})(x-x_{1})\cdots(x-x_{n})
also\ define \quad N_{n-1}(x)= a_{0}+a_{1}(x-x_{0}) + \cdots + a_{n-1}(x-x_{0})(x-x_{1})\cdots(x-x_{n-1})
For \ \ x_{i} \ (i=0,1,\cdots,n-1) \ \ \ N_{n-1}(x)=N_{n}(x)=y_{i}
So \ \ N_{n}(x)-N_{n-1}(x)=c(x-x_{0})(x-x_{1})\cdots(x-x_{n-1})
When \ \ x=x_{n}
N_{n}(x_{n})-N_{n-1}(x_{n})=y_{n}-N_{n-1}(x_{n})=c\prod _{i=0}^{n-1}(x-x_{i})
We \ can \ get \ c=[y_{n}-N_{n-1}(x)]\prod _{i=0}^{n-1}(x-x_{i})^{-1}
Pay \ attention \ to \ that
N_{n-1}(x)=\sum _{i=0}^{n-1}{y_{i}l_{i}(x_{n})}=\sum_{i=0}^{n-1}\left({y_{i}\prod_{k=0,k\neq i}^{n-1}\left(\frac{x_{n}-x_{k}}{x_{i}-x_{k}}\right)}\right)
So \ \ c=y_{n}\prod _{i=0}^{n-1}(x_{n}-x_{i})^{-1} - N_{n-1}(x_{n})\prod_{i=0}^{n-1}(x_{n}-x_{i})^{-1}
N_{n-1}(x_{n})\prod_{i=0}^{n-1}(x_{n}-x_{i})^{-1} =\sum_{i=0}^{n-1}\left({y_{i}\prod_{k=0,k\neq i}^{n-1}\left(\frac{x_{n}-x_{k}}{x_{i}-x_{k}}\right)}\right) / \prod_{i=0}^{n-1}(x_{n}-x_{i})
So
N_{n-1}(x_{n})\prod_{i=0}^{n-1}(x_{n}-x_{i})^{-1} =- \sum _{i=0}^{n-1}\left(y_{i}\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})^{-1}} \right)
We \ can \ get \ \ \ c=y_{n}\prod_{i=0}^{n-1}{(x_{n}-x_{i})^{-1}}+\sum_{i=1}^{n-1}{\left(y_{i}\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})^{-1}} \right)}
Because \ of \ that
We \ get. \ \ \ N_{n}(x)-N_{n-1}(x)=c\prod _{i=0}^{n-1}(x-x_{i})= \left[\sum_{i=1}^{n-1}{\left(y_{i}\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})^{-1}} \right)} \right] \sum_{i=0}^{n-1}(x-x_{i})

这里引入差商(Difference Quotient)的概念

Let. \ f[x_{0},\cdots,x_{n}]=\sum_{i=1}^{n-1}{\left(y_{i}\prod_{k=0,k\neq i}^{n}{(x_{i}-x_{k})^{-1}} \right)}
N_{n}(x)=f[x_{0}]+f[x_{0},x_{1}](x_{0}-x_{1})+\cdots + f[x_{0},x_{1},\cdots , x_{n}]\prod _{i=0}^{n-1}(x-x_{i})
The \ Difference \ Quotient \ is \ like \ that
f[x_{i},x_{j}]=\frac{f(x_i)-f(x_{j})}{x_{i}-x_{j}}\ , \ \ f[x_{i},x_{j},x_{k}]=\frac{f[x_{i},x_{j}]-f[x_{j},x_{k}]}{x_{i}-x_{k}}

我们可以利用这里的差商的概念写出Newton插值公式
N_{n}(x)=f(x_{0})+f[x_{0},x_{1}](x_{0}-x_{1})+\cdots + f[x_{0},x_{1},\cdots,x_{n}](x-x_{0})(x-x_{1})\cdots (x-x_{n-1})

其实Newton插值公式和Lagrange插值公式其实本质上是一样的,只不过是书写的方式不同,但是这样的不同的书写方式在实际操作中带来了很大的便利,当需要增加一个插值点的时候,只需要在原插值多项式的后面再添加一个新的项就可以了

有时候我们不但要求插值函数P(x)在节点处的函数值与被插值函数f(x)的值相等,而且要求在节点处的导数值也相等,这就引出了了一种新的插值方案Hermit插值

Given \ f(x) , \ and \ n+1 \ different\ points\ x_{0},x_{1},\cdots , x_{n}
Let \ f(x_i)=y_i\ \ \ \ f'(x_i)=y_i'
We \ can\ construct\ a\ polynomial
H_{2n+1}(x_i)=y_i \ \ \ \ H'_{2n+1}(x_i)=y_i'

我们这次要构造的多项式比起之前的lagrange多项式,多了导数值相等的条件,那我们就利用两组基函数来试着构造这一多项式

l_{0j}(x_i)=\delta _{ij},\ l_{0j}'(x_{i})=0 l_{1j}(x_i)=0, \ l_{1j}'(x_i)=\delta_{ij} So\ we\ get\ the\ simple \ polynomial\ : \ \ H_{2n+1}(x)=\sum_{j=0}^{n}y_{j}l_{0j}(x)+\sum_{j=0}^{n}{y'_{j}l_{1j}(x)} When\ i\neq j\ , l_{0j}(x_i)\ and\ l_{0j}(x_i)' \ always\ equal\ zero Because\ of\ that\ , Assume\ l_{0j}(x)=(ax+b)l_{j}^{2}(x) \left\{{\begin{align}(ax_j+b)l_j^{2}(x_j)=1 l_j(x_j)[al_j(x_j)+2(ax_j+b)l_j'(x_j)]=0\end{align}}\right. About \ the \ second \ formula \ , \ turned \ from\ That\ means\ we\ just\ to\ solve\ the\ following: ax_{j}+b=1\ \ \ and\ \ \ a+2(ax_{j}+b)l_{j}'(x_j)=0 We\ get\ that\ :\ a=-2l_{j}'(x_{j}),\ \ b=1+2x_{j}l_{j}'(x_j) Similarly\ l_{1j}(x)=(cx+d)l_{j}(x_{j}) And\ we\ also\ get\ c=1\ and\ d=-x_{j} So\ we\ can\ easily\ build\ H_{2n+1}(x) The\ result\ is\ that\ H_{2n+1}(x)=\sum_{j=0}^{n}{y_{j}[2(x_{j}-x)l_{j}'(x)+1]l^{2}_{j}(x)+\sum_{j=0}^{n}y'_{j}[(x-x_{j})l_{j}^{2}(x)]} Do\ some\ job\ about\ making\ formula\ neat We\ get\ that\ H_{2n+1}(x)=\sum^{n}_{j=0}{l^{2}_{j}(x)[y_{j}+(x-x_{j})(y_{j}'-2y_j)l_{j}'(x_{j})]}

这里我们需要提及的是,使用上述方法对各个节点进行插值的时候,很有可能在端点处产生一定程度的Runge现象,解决的手段可以使用分段线性插值构造出一系列的分段函数,对于分段线性插值,我们可以理解为对于多个划分的子区间进行Lagrange插值得到的一系列分段函数,当然分段插值也有非线性的,例如分段的二次插值,就是在划分的多个子区间上使用Lagrange2次插值.

这里由于某些教材的不同,可能介绍了Hermit三次插值的方案,在上述的公式中可以令n=1即可.

推荐阅读更多精彩内容