Talk:Lagrange polynomial

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Overhaul[edit]

I did a complete overhaul of the page. At the moment it is quite technical, maybe someone could add a practical example. MathMartin 16:58, 25 Apr 2004 (UTC)

Good work, sorry for all the errors, they were mine... Nixdorf 18:18, 25 Apr 2004 (UTC)
No sweat, I have not found any big errors. The article was just a bit small and blurry. I hope it is better now. Is there any reason you used t instead of x as a variable ? MathMartin 22:55, 25 Apr 2004 (UTC)
Not really, use x if you prefer. I come from physics so I like to think of it as "time", but generally, perhaps x is better. Nixdorf 16:33, 26 Apr 2004 (UTC)
Sorry to barge in to this but this page does not sound like a wikipedia article. This is not a maths textbook so I think it might be a good idea to change the language use within this page. Refer to other pages on mathematics for ideas 155.198.155.73 (talk) 15:39, 9 March 2010 (UTC)[reply]

Some one shoud add that can also be writen as

with

Multiplying by four[edit]

Do we really have to multiply everything by four, so that we get integers? It gave me something of a double-take. I think it would be more intuitive the other way, so it is easier to figure out what numbers came from where. Sim 16:29, 6 March 2007 (UTC)[reply]

I assume you're talking about using factors like in the construction of the Lagrange polynomial, instead of , in which case, I agree that it's better to do it the other way. Please go ahead and change it. -- Jitse Niesen (talk) 09:36, 7 March 2007 (UTC)[reply]
agreed. I wasted a good 30 minutes wondering if I had completely forgot how to do algebra because my numbers didn't match what was given here (and worse, there is NO indication that some transformation has been done). It is VERY confusing for people who are attempting to digest and understand how something works, when they don't really know what to expect anyway, and then there are unstated transformations being done in the formulas. I'm not going to change the formulas, but I will make a note of the multiplication by four. Omnirizon (talk) 21:37, 9 January 2010 (UTC)[reply]

Errors[edit]

Any chance of a brief discussion of errors for Lagrange interpolation, preferably by someone who understands it properly (i.e., not me!)? me_and 21:21, 9 June 2007 (UTC)[reply]

Efficient code[edit]

instead of

     for (int j = 0; j < degree; ++j) {
        // The i-th term has to be skipped
        if (j != i) {
           weight *= (desiredPos - pos[j]) / (pos[i] - pos[j]);
        }
     }

it is more efficient to do two for loops


     for (int j=0; j<i; j++) {
        weight *= (desiredPos - pos[j]) / (pos[i] - pos[j]); 
     }

     for(int j=i+1; j<=degree; j++) {
        weight *= (desiredPos - pos[j]) / (pos[i] - pos[j]); 
     }

This avoid the cost of a test at each iteration. —Preceding unsigned comment added by 199.212.17.130 (talk) 14:44, 6 August 2008 (UTC)[reply]

     prod = 1;
     for (int j=0; j<i; j++) {
        prod *= (pos[i] - pos[j]);
        weight *= (desiredPos - pos[j]);
     }

     for(int j=i+1; j<=degree; j++) {
        prod *= (pos[i] - pos[j]);
        weight *= (desiredPos - pos[j]);
     }
     weight /= prod;

This avoids the cost of a division each iteration. dila (talk) 08:09, 3 June 2009 (UTC)[reply]

Discovery[edit]

It was first discovered by Edward Waring in 1779 and later rediscovered by Leonhard Euler in 1783.

Is that likely to really be right? It's a pretty straightforward idea and it wouldn't surprise me if it goes back to the beginnings of algebra in the middle ages and has been rediscovered many times. I discovered it myself in 10th grade and I'm not all that good at math. 66.127.55.192 (talk) 18:35, 5 February 2010 (UTC)[reply]

True but as all discoveries go, they are 'discovered' by the person who first puts in on paper and publishes the result/knowledge to the public so that they may use it. And it is not inconceivable that this was first done by Edward Waring in 1779 and later independently also by Leonhard Euler in 1783. Jeroendv (talk) 14:13, 24 October 2010 (UTC)[reply]
Lagrange interpolation formula has a determinant form. 70.53.231.164 (talk) 23:52, 23 January 2015 (UTC)[reply]

Barycentric[edit]

How is barycentric first form supposed to work? It says it avoids the cost of recomputing the whole lot of numbers on each query but it has the (x - x[j]) denominator in w[j]/(x-x[j]) which is potential division by zero. — Preceding unsigned comment added by 93.85.168.72 (talk) 22:53, 24 November 2013 (UTC)[reply]

Yes, I think it should be added somewhere that this form may become pathologic when one tries to interpolate too close to a x(j) position. — Preceding unsigned comment added by PBenard (talkcontribs) 09:14, 30 January 2014 (UTC)[reply]
I added some explanation of why this is okay. In computer implementations, when your formula results in NaN, you must double-check if the input was one of the nodes and if so return the corresponding value. –jacobolus (t) 04:30, 20 June 2022 (UTC)[reply]

Type setting problem[edit]

In the section 'Main idea' the mathematical text is italicized, which is right, but the brackets are too, which isn't. 86.185.221.253 (talk) 17:52, 10 February 2015 (UTC)[reply]

Notation[edit]

I have twice reverted a new editor's notational change from "k" to "n − 1" in this article and I think that I should explain why I have done so more fully. One reason the new editor made the change was that in computer science it is typical that k denotes an internal variable while n is a terminating degree for a polynomial. Even if there were such rigid typecasting of symbols, which I doubt, the more troubling issue is that the editor is trying to enforce the conventions of a discipline (computer science in this case) on the article. This may be okay if the article was clearly identified as a component of that discipline, but this article is much more general than that and should not be using such limited conventions. If the change had simply been replacing k by n, I would have said to myself "Silly wabbit!" and let it slide, but there is also a matter of aesthetics. Having the upper limit of a summation being given by a single letter, especially in a primary definition, both looks better and has more meaning in general. Derived results may require some function of that parameter to be used in one or both of the limits, but this is unavoidable. In mathematical treatments that I have seen, the upper limit is most often given by a single symbol and I am aware that with zero-based indexing this is not always the case. So, one should not argue that one style is to be preferred to the other; both appear in the literature. In cases such as this, where two reasonably valid possibilities exist, the general Wikipedia stance is to leave the original alone unless there is a compelling reason to change (similar to American vs. British English variations). This is necessary to prevent constant back and forth changes with no significance as new editors come into the playing field. --Bill Cherowitzo (talk) 00:26, 29 January 2017 (UTC)[reply]

I think it would be beneficial to replace k with n because using j and m as indices in the range [0, k] is unconventional and kind of confusing. But it doesn’t really matter. –jacobolus (t) 04:31, 20 June 2022 (UTC)[reply]
Can the comment be simplified to the following?
Summing to "n-1" can cause confusion for new readers since, since the upper term in the sum might not exist.
This formulation doesn't require any canonical choice for indexing since sum_{c}^{n-1} doesn't make sense for n=c, regardless of the choice of c. It also makes taste and aesthetics irrelevant.
— Preceding unsigned comment added by 192.136.116.2 (talk) 00:38, 13 April 2024 (UTC)[reply]
I'm not sure I understand what you are asking for. Personally, I think the current article seems fine, though I would still recommend replacing k with n. –jacobolus (t) 04:10, 13 April 2024 (UTC)[reply]

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Lagrange polynomial. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 14:20, 15 December 2017 (UTC)[reply]

Runge's example[edit]

I think the classic Runge's example, as shown e.g. in https://www.math.usm.edu/lambers/mat772/fall10/lecture5.pdf is even more illustrative of the problem with Lagrange interpolation. This is a problem likely to occur with real-world data, to even worse degrees, and I worry that the article might not give enough prominence to it. — Preceding unsigned comment added by 77.61.180.106 (talk) 16:05, 1 January 2021 (UTC)[reply]

Runge's phenomenon is essentially a problem with equally spaced nodes. In practice it's not a problem since if the function being interpolated is smooth, using Chebyshev or Legendre nodes is guaranteed to converge to the function being interpolated, see [1] or [2] AwkwardWhale (talk) 12:43, 3 November 2021 (UTC)[reply]

References

Missing equidistant point constraint[edit]

Newton's method and all similar forward and backward difference formulations require that the points be spaced equally, something that Lagrangian polynomials do not require. However, I did not see this mentioned and should be mentioned early to alert users of the viability of this solution.

Source: "Applied Numerical Analyis", 3rd Edition, 1984, Authors: Curtis F. Gerald/Patrick O. Wheatley, Publisher: Addison Wesley Yamex5 (talk) 17:48, 6 November 2021 (UTC)[reply]

The second sentence is nonsense[edit]

The first two sentences of the article are as follows:

"In numerical analysis, Lagrange polynomials are used for polynomial interpolation. For a given set of points with no two values equal, the Lagrange polynomial is the polynomial of lowest degree that assumes at each value the corresponding value , so that the functions coincide at each point."

There has been no reference whatsoever to any "function" other than the Lagrange polynomial. So it is ridiculous to say "the functions coincide".

I hope someone knowledgeable about this subject can rewrite this nonsense. 2601:200:C000:1A0:A811:7DCB:E6BC:FA8A (talk) 18:41, 12 November 2021 (UTC)[reply]

I rewrote the intro. Is that clearer? –jacobolus (t) 04:32, 20 June 2022 (UTC)[reply]