### Lagrange Polynomial

 Least square regression is a good choice for experimental data having inherent error. In the most of cases, curves obtained by least square method don’t pass through the main points. In some cases the main points are exact and it is desired that the fitted curve passes through the main points. In this situation, interpolation methods are the best choices for curve fitting. Mathematically, it can be shown that for n+1 points [xi ,f(xi)] there is one and only one polynomial that pass through all the points. This polynomial can be written as follows: There are several techniques to find this polynomial. Lagrange interpolating method is one of the simplest ways to find the interpolating polynomial. This method can be presented as follows: For any arbitrary n+1 points [xi ,f(xi)] the related polynomial which passes through all the points is: where, The algorithm of the Lagrange interpolating method can be written as follows:   Step 1: Let f = 0 Step 2: For i = 1 to n+1 do steps 3 to 6 Step 3: Let s = 1 Step 4: For j = 1 to n+1 do step 5 Step 5: if i and j are not equal then let   Step 6: f = f + s f(xi) Step 7: End.           Curve Fitting (Source Code in C++)                                           o