Skip to content

Files

Latest commit

81dd591 · Jul 1, 2023

History

History

Bonus_01_Lagrange

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 1, 2023
Jul 1, 2023
Jul 1, 2023
Jul 1, 2023

Lagrange

Given a set of points, polynomial interpolation is the task of finding a polynomial with lowest degree that passes through all the points. Assume the set ( x 0 , y 0 ) , , ( x n , y n ) of points. Then a suitable polynomial is given by

L ( x ) := j = 0 n y j l j ( x )

where the Lagrange polynomials l j ( x ) are defined as follows:

l j ( x ) := 0 k n k j x x k x j x k

  1. lagrange
    Implement the function lagrange : (float * float) list -> (float -> float) that returns the interpolated polynomial L .