in reply to Re^3: Lagrange Polynomials in Perl
in thread Lagrange Polynomials in Perl

It should be exact at the points you supply it, and it does work for that. Unfortunately since the algorithm only sees points and not the whole polynomial, it's a left hand doesn't know what the right hand is doing situation...and you still get some error between the points you supply. Although I have tried it with some polynomials, and it's pretty convincing.

Replies are listed 'Best First'.
Re^5: Lagrange Polynomials in Perl
by hdb (Monsignor) on Apr 29, 2015 at 14:59 UTC

    My understanding from Lagrange_polynomial is that it is exact for polynomials. So if you see differences you might still have an issue.

      If you look under the examples on the wikipedia article, example 1 gives an exact result, and example 2 gives a non-exact one. Although, "polynomials that give exact interpolations" would be a really interesting paper.