User Tools

Site Tools


gibson:teaching:fall-2016:math753:lagrangepoly

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
gibson:teaching:fall-2016:math753:lagrangepoly [2016/11/11 12:29]
gibson
gibson:teaching:fall-2016:math753:lagrangepoly [2016/11/11 12:34]
gibson
Line 6: Line 6:
  
 \begin{equation*} ​ \begin{equation*} ​
-P(x) = y_1 \frac{(x-x_2)(x-x_3)}{(x_1-x_2)(x_1-x_3)} + y_1 \frac{(x-x_1)(x-x_3)}{(x_2-x_1)(x_2-x_3)} + y_3 \frac{(x-x_1)(x-x_2)}{(x_3-x_1)(x_3-x_1)} +P(x) = y_1 \frac{(x-x_2)(x-x_3)}{(x_1-x_2)(x_1-x_3)} + y_1 \frac{(x-x_1)(x-x_3)}{(x_2-x_1)(x_2-x_3)} + y_3 \frac{(x-x_1)(x-x_2)}{(x_3-x_1)(x_3-x_2)} 
 \end{equation*} \end{equation*}
  
 It's easy to see the polynomial goes through each data point. If you plug in $x=x_1$, the second and third terms vanish, and the fraction in the first term is $1$, so that $P(x_1) = y_1$. Similar simplifications occur when plugging in $x=x_2$, to get $P(x_2) = y_2$, and similar for $P(x_3) = y_3$. Also, since everything on the right-hand-side except $x$ is a constant, it's clear that the $P(x)$ is a polynomial in $x$ of order 2. The generalization to higher-order polynomials is straightforward. It's easy to see the polynomial goes through each data point. If you plug in $x=x_1$, the second and third terms vanish, and the fraction in the first term is $1$, so that $P(x_1) = y_1$. Similar simplifications occur when plugging in $x=x_2$, to get $P(x_2) = y_2$, and similar for $P(x_3) = y_3$. Also, since everything on the right-hand-side except $x$ is a constant, it's clear that the $P(x)$ is a polynomial in $x$ of order 2. The generalization to higher-order polynomials is straightforward.
  
 +For example, let's fit a 2nd order polynomial to $(0,4), (1,3), (2,6)$. Plugging into the formula gives
  
 +\begin{equation*} ​
 +P(x) = 4 \frac{(x-1)(x-2)}{(-1)(-2)} + 3 \frac{(x)(x-2)}{(1)(-1)} + 6 \frac{(x)(x-1)}{(2)(1)} ​
 +\end{equation*}
gibson/teaching/fall-2016/math753/lagrangepoly.txt ยท Last modified: 2016/11/11 12:39 by gibson