拉格朗日插值法(Lagrange polynomial)

\(n^2\) 暴力插值:

\(f(k) = \sum^n_{i=1} y_i \cdot \prod_{j \neq i} \frac{k – x_j}{x_i – x_j}\)

横坐标连续时,可 \(O(n)\) 插值:

\(qz_i = \prod^i_{j=0} (k – j)\)

\(hz_i = \prod^n_{j=i} (k – j)\)

\(f(k) = \sum^n_{i=1} y_i \cdot \frac{qz_{i – 1} \times hz_{i+1}}{(i – 1)! (n – i)!}\)

求 \(i^k\) :

设 \(qzik_i = \sum_{w=1}^i w^k\)

\(f(k) = \sum^{k+2}_{i=1} qzik_i \cdot \frac{qz_{i – 1} \times hz_{i+1}}{(-1)^{(k-i) \& 1}(i – 1)! (k + 2 – i)!}\)

————————

\(n ^ 2 \) interpolation:

\(f(k) = \sum^n_{i=1} y_i \cdot \prod_{j \neq i} \frac{k – x_j}{x_i – x_j}\)

When the abscissa is continuous, it can be \ (O (n) \) interpolated:

\(qz_i = \prod^i_{j=0} (k – j)\)

\(hz_i = \prod^n_{j=i} (k – j)\)

\(f(k) = \sum^n_{i=1} y_i \cdot \frac{qz_{i – 1} \times hz_{i+1}}{(i – 1)! (n – i)!}\)

Find \ (I ^ k \):

Set \ (qzik_i = \ sum {w = 1} ^ I w ^ k \)

\(f(k) = \sum^{k+2}_{i=1} qzik_i \cdot \frac{qz_{i – 1} \times hz_{i+1}}{(-1)^{(k-i) \& 1}(i – 1)! (k + 2 – i)!}\)