Lagrangian Polynomials



Table 7.3: Fitting a polynomial to data.
x f(x)
3.2 22.0
2.7 17.8
1.0 14.2
4.8 38.3
5.6 51.7

$\displaystyle P_3(x)=\frac{(x-2.7)(x-1.0)(x-4.8)}{(3.2-2.7)(3.2-1.0)(3.2-4.8)}22.0+
$

$\displaystyle \frac{(x-3.2)(x-1.0)(x-4.8)}{(2.7-3.2)(2.7-1.0)(2.7-4.8)}17.8+
$

$\displaystyle \frac{(x-3.2)(x-2.7)(x-4.8)}{(1.0-3.2)(1.0-2.7)(1.0-4.8)}14.2+
$

$\displaystyle \frac{(x-3.2)(x-2.7)(x-1.0)}{(4.8-3.2)(4.8-2.7)(4.8-1.0)}38.3
$


Example py-file: Interpolation of gasoline prices. Lagrange Interpolation. myLagInt_gasoline.py
Figure 7.3: Lagrange Polynomial Interpolation - Gasoline Case.
Image 13-6
Image gasoline_lagrange