Skip to content

Instantly share code, notes, and snippets.

View varun-doshi's full-sized avatar
💻
shipping

Varun Doshi varun-doshi

💻
shipping
View GitHub Profile

Lagrange Interpolation

Sounds scary? Probably more than it should.

Lagrange Interpolation is a method to find an equation passing through a given set of points.

Lagrange Interpolation Formula

Given a set of data points $( (x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) )$, the goal is to find a polynomial $P(x)$ such that:

Fields

Fields denoted by {F,+,x} are a set of elements which consists of 2 binary operations and must have the following properties:

  • Closure: For any a,b in F, the result of (a+b) or (a.b) will also be a member of the Field F i.e if (a.b)=c, then c belongs to the set F as well.
  • Associative: For any a,b,c in F: $$a+(b+c)=(a+b)+c$$ $$a.(b.c)=(a.b).c$$
  • Commutative: For any a,b in F: $$a+b=b+a$$ $$a.b=b.a$$
  • Additive Identity: There exists an element e in F such that for all a in F: