Computer Sciences for Engineers October 22 2020 Lagrange
Computer Sciences for Engineers October 22, 2020 Lagrange interpolation dr. Nagy Noémi
The Lagrange interpolation If n points are given, then a polynomial of ddegree n-1 (maximum exponent is n-1) can be fitted to it.
The Lagrange interpolation In our first example, the following points should be given. Fit a Lagrange interpolation polynomial to the points. To make it easier to refer to these points, let us mark and calculate the Lagrange functions with their help
The Lagrange interpolation In the next step, we rewrite the previously defined datas. The Lagrange interpolation function is obtained as follows: Finally, we merge the members x: So the polynomial which is fitting to the points is: If we substitute the x-s given in the polynom, we would get the y-s back, so this polynomial really fits our points.
The Lagrange interpolation In our next example, we know mor points from our function that the previous one. This means that the more points are known, the more Lagrange auxiliary functions we would have to define, and they would also have increasing degree… One way to do this is to fit a polynomial of lower degree to our points. This, in turn, results in the need to fit the polynomial with fewer points, since it was previously stated that the number of points given. e. g. 2 points of first degree polynomial – straight – can be fitted, a second degree polynomial – parabola – 3 points, etc. In general, a polynomial of degree (n-1) can be fitted at n points. The problem can therefore be solved by using fewer points if we eant a polynomial with a lower degree. The only question is how to choose the „few” pieces from the „many” points… As an introduction, I usually ask in classes on this topic who knows the participants best, who could give the best description of them… Usually the answer comes quickly to friends, family, etc. In summary, the closest. Fortunately, in the case of numbers, it is easy to tell which numbers are closest to a given value…
The Lagrange interpolation The task: The following points are given. Approximate the value f(0. 36) with a quadratic Lagrange interpolation polynomial. We have to approximate the value of the function with a quadratic Lagrange interpolation polynomial, which means that we have to choose 2+1=3 points from the above points, namely those whose first coordinate (x) is closest to 0. 36. In the next step, we define the Lagrange functions: not relevant, because The value of f(0. 36) can be approximated by the value of p(0. 36): Finally, the Lagrange polynomial:
The Lagrange interpolation You can make the calculation somewhat easier by automatically replacing the searched point (in this case 0. 36) in the Lagrange functions: not relevant, because Hence
- Slides: 7