ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Lagrange polynomial

2022-03-26 17:33:55  阅读:190  来源: 互联网

标签:frac ell cdots points Lagrange polynomial


Lagrange polynomial

(All the below are from Wiki.)

Wiki: Lagrange polynomials are used for polynomial interpolation of a given set of points \((x_j,y_j)\).

Given a set of k+1 data points:

\[(x_0,y_0),\cdots,(x_i,y_i),\cdots,(x_k,y_k) \]

The interpolation polynomial of the above data points:

\[L(x) = \sum_{i=0}^k \ell_i(x)y_i \]

is expressed as a linear combination of Lagrange basis polynomials \(\ell_i(x)\) and \(y_i\),and \(\ell_i(x)\) is:

\[\ell_i(x)=\prod_{j\neq i}^{k}\frac{x-x_j}{x_i-x_j}=\frac{x-x_0}{x_i-x_0}\cdots\frac{x-x_{i-1}}{x_i-x_{i-1}}\frac{x-x_{i+1}}{x_i-x_{i+1}}\cdots\frac{x-x_k}{x_i-x_k} \]

And we have the following relation:

\[\ell_i(x_j)=\delta_{ij} = \begin{cases}1, \quad j=i\\0, \quad j\neq i \end{cases} \]

For example, when \(j=i\), we have:

\[\ell_i(x_i)=\frac{x_i-x_0}{x_i-x_0}\cdots\frac{x_i-x_j}{x_i-x_j}\cdots\frac{x_i-x_k}{x_i-x_k}=1 \]

when \(j\neq i\), we have:

\[\ell_i(x_j)=\frac{x_j-x_0}{x_i-x_0}\cdots(\frac{x_j-x_j}{x_i-x_j})\cdots\frac{x_j-x_k}{x_i-x_k}=0 \]

Therefore, we have the following:

\[L(x_j)=\sum_{i=0}^k\ell_i(x_j)y_i=\sum_{i=0}^k\delta_{ij}y_j=y_j \]

  • Example:

​ Say we want to interpolate \(f(x)=x^2\) with given points \((1,1),(2,4),(3,9)\)

​ The interpolating polynomial is therefore:

\[L(x)=\sum_{i=0}^3\ell_i(x)y_i\\ =\ell_0(x)y_0+\ell_1(x)y_1+\ell_2(x)y_2\\ =\frac{x-2}{1-2}\cdot\frac{x-3}{1-3}\cdot1+\frac{x-1}{2-1}\frac{x-3}{2-3}\cdot4+\frac{x-1}{3-1}\frac{x-2}{3-2}\cdot9 = x^2 \]

  • Drawback:

    When an additional point is incorporated, we should recalculate all the Lagrange basis polynomial. An improved form is the Newton polynomials.

Wiki: Lagrange and other interpolation at equally spaced points yield a polynomial oscillating above and below the true function. This behaviour tends to grow with the number of points, leading to a divergence known as Runge's phenomenon; the problem may be eliminated by choosing interpolation points at Chebyshev nodes.

标签:frac,ell,cdots,points,Lagrange,polynomial
来源: https://www.cnblogs.com/miccoui/p/16059994.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有