Lagrange Function Interpolation
Overview
{% L_k(x) = \Pi \frac{x - x_i}{x_k - x_i} %}
for i=0 to n and not equal to k.
{% p_L(x) = \sum_{k=0}^n f(x_k)L_k(x) %}
(
komzsik pg.10)
Lagrange Module
the lagrange.mjs module includes a method for performing a Lagrange interpolation. The known points of the
function are represented as an array of arrays. (The first number is the x value, the second is the y value).
The interpolate method takes the original points,
and an x value and returns the interpolated y value.
let nw = await import('/lib/approximation/interpolation/v1.0.0/lagrange.mjs');
let points = [[0,0],[1,2], [2,1], [3,2.5]];
let int1 = nw.interpolate(points,3)
Try it!