{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $K$ be a [[field|04C5ZBG1WT]], let $n \\ge 0$, let $x_0, \\dots, x_n \\in K$ be pairwise distinct, let $y_0, \\dots, y_n \\in K$, and let $x \\in K$.\n*Neville's algorithm* computes the numbers $p_{i,j}$ for $0 \\le i \\le j \\le n$ by the recursion\n\n1. $p_{i,i} = y_i$ for $0 \\le i \\le n$;\n2. for $i \u003c j$,\n$$p_{i,j} = \\frac{(x - x_i) \\, p_{i+1,j} - (x - x_j) \\, p_{i,j-1}}{x_j - x_i},$$\n\nin order of increasing $j - i$, and returns $p_{0,n}$.\n\n## Remarks\n\nBy induction on $j - i$, the number $p_{i,j}$ is the value at $x$ of the [[interpolation polynomial|SS1YMS2NPC]] of degree at most $j - i$ through $(x_i, y_i), \\dots, (x_j, y_j)$.\nIndeed, the same recursion with $x$ as a variable gives a polynomial of degree at most $j - i$.\nAt $x = x_i$ it gives $p_{i,j-1}(x_i) = y_i$, and at $x = x_j$ it gives $p_{i+1,j}(x_j) = y_j$.\nAt an inner node $x_k$ both terms give $y_k$.\nSo the output $p_{0,n}$ is the value at $x$ of the interpolation polynomial of all the data.\n\nExample: data $(0, 1)$, $(1, 3)$, $(2, 7)$ and $x = 3$.\nThen $p_{0,1} = \\frac{3 \\cdot 3 - 2 \\cdot 1}{1} = 7$, $p_{1,2} = \\frac{2 \\cdot 7 - 1 \\cdot 3}{1} = 11$ and $p_{0,2} = \\frac{3 \\cdot 11 - 1 \\cdot 7}{2} = 13$.\nThis agrees with the interpolation polynomial $x^2 + x + 1$ at $3$.\n\nNon-example: if two nodes coincide, $x_i = x_j$ with $i \u003c j$, the recursion divides by $x_j - x_i = 0$, so the algorithm is not defined.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "58AM5FK67J",
    "kind": "definition",
    "msc": [
      "65D05",
      "41A05"
    ],
    "name": "Neville's algorithm",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Neville%27s_algorithm"
      }
    ],
    "tag": "KVZ7D84541",
    "uses": [
      "SS1YMS2NPC",
      "04C5ZBG1WT"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/KVZ7D84541/",
  "links": [
    {
      "field": "defines",
      "target": "58AM5FK67J"
    },
    {
      "field": "uses",
      "target": "SS1YMS2NPC"
    },
    {
      "field": "uses",
      "target": "04C5ZBG1WT"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/KVZ7D84541.md",
  "msc": [
    "65D05",
    "41A05"
  ],
  "name": "Neville's algorithm",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/KVZ/KVZ7D84541.md",
  "status": null,
  "tag": "KVZ7D84541",
  "uri": "m2://KVZ7D84541",
  "url": "https://tamnd.github.io/math2/wiki/nevilles-algorithm-definition/",
  "writing": {
    "tag": "KVZ7D84541",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
