This is an excerpt from my math models textbook. It’s about Lagrange Polynomials which is a technique that lets you fit a polynomial to a set of any number of unique points (x_1,y_1) … (x_n,y_n) so long as all your x-values are different (otherwise it wouldn’t be a function, and couldn’t be a polynomial). The polynomial you’ll calculate will be the unique, lowest degree polynomial that passes through all points.

  • pruwyben@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    27
    ·
    9 months ago

    If you’re not very convincing, convince yourself that the polynomial is not cubic. When you fail, you will be convinced that it is cubic. QED

  • zkfcfbzr@lemmy.world
    link
    fedilink
    English
    arrow-up
    21
    ·
    edit-2
    9 months ago

    It’s not too bad, once you consider that everything in each term is a constant value, except for “x” itself.

    So the numerator of each term is the product of three linear factors, like (x-4)(x-2)(x-6), which should produce a cubic, like x³ - 12x² + 44x - 48. Then the denominator of each term is a pure constant, so it would be like taking that cubic and dividing it by 4, getting 0.25x³ - 3x² + 11x - 12. Then the yₙ terms are also constants, so no different than doing something like multiplying by 2, getting you something like 0.5x³ - 6x² + 22x - 24, if I take that example a bit too far. And at that point it’s just the sum of four cubics, which will be cubic as long as the x³ terms don’t perfectly cancel out - which I believe would only happen if the four pairs of points used to make the function were all perfectly laying on the same line or parabola.

    The construction’s also pretty clever: OP said the point was to fit the function to the four points (x₁, y₁), (x₂, y₂), (x₃, y₃), (x₄, y₄). Let’s say we set x = x₂, then. Because (x-x₂) appears in the numerator of every term but the second term, every term but the second term will have a 0 in its numerator and cancel out - so we only need to consider the second term. Its numerator is then (x₂-x₁)(x₂-x₃)(x₂-x₄) - exactly the same as its denominator. So they both cancel out, leaving only y₂ - meaning we get P₃(x₂) = y₂, as desired.

  • Rentlar@lemmy.ca
    link
    fedilink
    English
    arrow-up
    8
    ·
    9 months ago

    Sure I can convince myself, but how am I going to get Yi to agree? He’s known to be rather stubborn.

    • sirprize@lemm.ee
      link
      fedilink
      English
      arrow-up
      14
      ·
      edit-2
      9 months ago

      Replace the words “Convince yourself” with “You can verify” and it might make more sense.

      • Leate_Wonceslace@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        9 months ago

        No, I got that part, but I don’t think I understand the significance of the indexed y values and their relationships to the indexed x values. The criterion seems to suggest that P3(xn)=yn for each, but that strikes me as something that is defined as a constraint rather than something that is to be proved. Also, I woke up then and now so that might be playing a factor in my confusion.

        • sirprize@lemm.ee
          link
          fedilink
          English
          arrow-up
          5
          ·
          9 months ago

          OK, you got it then, I believe. P3 is specifically built so that P3(xn)=yn for n from 1 to 4. The proof lies in its construction. I guess the sentence can be understood as “we know it works because we built it like that, however you may verify it yourself”

          • metiulekm
            link
            fedilink
            English
            arrow-up
            6
            ·
            9 months ago

            I feel like the sentence also means “it’s kinda obvious when you think about it, so we won’t explain, but it’s actually important, so you probably should make sure you agree”.

    • yggdar@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      9 months ago

      The function should be cubic, so you should be able to write it in the form “f(x) = ax^3 + bx^2 + cx + d”. You could work out the entire thing to put it in that form, but you don’t need to.

      Since there are no weird operations, roots, divisions by x, or anything like that, you can just count how many times x might get multiplied with itself. At the top of each division, there are 3 terms with x, so you can quite easily see that the maximum will be x^3.

      It’s useful to know what the values x_i and x_y are though. They describe the 3 points through which the function should go: (x_1, y_1) to (x_3, y_3).

      That also makes the second part of the statement ready to check. Take (x_1, y_1) for example. You want to be sure that f(x_1) = y_1. If you replace all of the “x” in the formula by x_1, you’ll see that everything starts cancelling each other out. Eventually you’ll get “1 * y_1 + 0 * y_2 + 0 * y_3”, thus f(x_1) is indeed y_1.

      They could have explained this a bit better in the book, it also took me a little while to figure it out.

  • Buddahriffic@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 months ago

    If you have a series of (nx + m) terms multiplied together (where each n and m can be different), just count the number of times x comes up (let’s call that z), and the order of the function will be x^z. For z = 3, that’s cubic. None of the other terms matter for the expansion. If there’s an x^3 and no higher powers of x, it will always be cubic and the coefficients of any of the terms are irrelevant.

    If you’re studying computer science, you can think of it like big O notation.

    And for the other part, one trick for questions like that is to look at what happens when you substitute an equality they are talking about, specifically looking for terms that result in 0s or 1s and can be cancelled out of the equation. If you’re not given actual values for any coefficients, there’s not much else interesting you can do to a polynomial like that, other than maybe take the derivative or integrate.