拉格朗日插值公式
拉格朗日插值公式找到一个称为拉格朗日多项式的多项式,该多项式在任意点取特定值。它是函数f(x) 的 n次多项式表达式。插值法用于在一组离散的已知数据点范围内寻找新的数据点。
拉格朗日插值公式
给定几个实数值 x 1 , x 2 , x 3 , ..., x n和 y 1 , y 2 , y 3 , ..., y n并且会有一个实系数满足条件 P(x i ) = 的多项式 P y i , ∀i = {1, 2, 3, ..., n} 并且多项式 P 的次数必须小于实数值的计数,即 degree(P) < n。不同阶即 n阶的拉格朗日插值公式为:
n阶的拉格朗日插值公式是-
如果 那么多项式的次数为1,
一阶多项式的拉格朗日插值公式是-
同样对于二阶多项式,拉格朗日插值公式是-
拉格朗日定理的证明
Let’s consider a nth degree polynomial of given form
Substitute observations xi to get Ai
Put x = x0 then we get A0
f(x0) = y0 = A0(x0 – x1)(x0 – x2)(x0 – x3)…(x0 – xn)
A0 = y0/(x0 – x1)(x0 – x2)(x0 – x3)…(x0 – xn)
By substituting x = x1 we get A1
f(x1) = y1 = A1(x1 – x0)(x1 – x2)(x1 – x3)…(x1 – xn)
A1 = y1/(x1 – x0)(x1 – x2)(x1 – x3)…(x1 – xn)
In similar way by substituting x = xn we get An
f(xn) = yn = An(xn – x0)(xn – x1)(xn – x2)…(xn – xn-1)
An = yn/(xn – x0)(xn – x1)(xn – x2)…(xn – xn-1)
If we substitute all values of Ai in function f(x) where i = 1, 2, 3, …n then we get Lagrange Interpolation Formula.
让我们看一些关于拉格朗日插值公式的示例问题。
示例问题
问题 1:对于给定的点集 (1, 2),(3, 4) 求 y 在 x = 2 处的值
解决方案:
Given,
(x0, y0) = (1, 2)
(x1, y1) = (3, 4)
x = 2
As per the 1st order Lagrange Interpolation Formula,
= (-2/-2) + (4/2)
= 1 + 2
y = 3
问题 2:对于给定的点集 (9, 2), (3, 10) 求 y 在 x = 5 处的值
解决方案:
Given,
(x0, y0) = (9, 2)
(x1, y1) = (3, 10)
x = 5
As per the 1st order Lagrange Interpolation Formula,
= (4/6) + (-40/-6)
= (2/3) + (20/3)
= 22/3
y = 7.33
问题 3:对于给定的点集 (1, 6), (3, 4), (2, 5) 求 y 在 x = 1 处的值
解决方案:
Given,
(x0, y0) = (1, 6)
(x1, y1) = (3, 4)
(x2, y2) = (2, 5)
x = 1
As per the 2nd order Lagrange Interpolation Formula
= (12/2) + 0 + 0
y = 6
问题 4:对于给定的点集 (9, 6), (3, 5), (1, 12) 求 y 在 x = 10 处的值
解决方案:
Given,
(x0, y0) = (9, 6)
(x1, y1) = (3, 5)
(x2, y2) = (1, 12)
x = 10
As per the 2nd order Lagrange Interpolation Formula,
= (63/8) + (-15/4) + (21/4)
= (63-30 + 42)/8
= 75/8
y = 9.375
问题 5:对于给定的点集 (1, 10), (2, 4), (3, 4), (5, 7) 求 y 在 x = 7 处的值
解决方案:
Given,
(x0, y0) = (1, 10)
(x1, y1) = (2, 4)
(x2, y2) = (3, 4)
(x3, y3) = (5, 7)
x = 7
As per the 3rd order Lagrange Interpolation Formula,
= -50 + 64 – 60 + 35
= 99 – 110
y = -11
问题 6:对于给定的点集 (5, 12), (6, 13), (7, 14), (8, 15) 求 y 在 x = 10 处的值
解决方案:
Given,
(x0, y0) = (5, 12)
(x1, y1) = (6, 13)
(x2, y2) = (7, 14)
(x3, y3) = (8, 15)
x = 10
As per the 3rd order Lagrange Interpolation Formula
= -48 + 195 – 280 + 150
y = 17
问题 7:对于给定的点集 (-2, 5),(1, 7),在 x = 0 处找到 y 的值
解决方案:
Given,
(x0, y0) = (-2, 5)
(x1, y1) = (1, 7)
x = 0
As per the 1st order Lagrange Interpolation Formula
= (5/3) + (14/3)
= 19/3
y = 6.33