ποΈ Starting from known points#
Given the task of constructing a function
f(x)that passes through the points
P1β(x1β,y1β),P2β(x2β,y2β),β―,Pnβ(xnβ,ynβ), first let the projection of the i th point onto the x axis be
Piβ²β(xiβ,0)Next, consider constructing n functions:
f4β(x),f2β(x),β―,fnβ(x)such that for the i th function
fiβ(x)its graph passes through
{Pjβ²β(xjβ,0),(jξ =i)Piβ(xiβ,yiβ)βThus, we can derive the desired function as:
f(x)=i=1βnβfiβ(x)We can assume that
fiβ(x)=aβ
jξ =iββ(xβxjβ)By substituting the point
Piβ(xiβ,yiβ)we find that
a=βjξ =iβ(xiββxjβ)yiββTherefore
fiβ(x)=yiββ
βjξ =iβ(xiββxjβ)βjξ =iβ(xβxjβ)β=yiββ
jξ =iββxiββxjβxβxjββThus, we obtain the Lagrange interpolation formula as:
f(x)=i=1βnβyiββ
jξ =iββxiββxjβxβxjββHere’s a breakdown of its components:
f(x): The interpolating polynomialn: The number of given pointsx_i, y_i: The given points through which the polynomial must passβ: The product symbol, indicating multiplication of terms
The formula creates a weighted sum of basis polynomials, each passing through one point and zero at all others. This ensures the resulting polynomial satisfies all given points.
The naive implementation of this algorithm has a time complexity of O(n^2), but it can be optimized to O(nlog^2n). For more details, refer to fast polynomial interpolation.
π References#