{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $m \u003c n$ be integers, let $p \\ge 1$ be an integer, and let $f \\colon [m, n] \\to \\R$ have a continuous $p$-th derivative.\nLet $B_k$ be the [[Bernoulli numbers|0RAS24E1R5]] with $B_2 = \\frac16$, and let $P_p(x) = B_p(x - \\floor{x})$, where $B_p(t)$ is the [[Bernoulli polynomial|BXQKBJJGFG]] of degree $p$.\nThen\n$$\\sum_{i=m}^{n} f(i) = \\int_m^n f(x)\\, dx + \\frac{f(m) + f(n)}{2} + \\sum_{k=1}^{\\floor{p/2}} \\frac{B_{2k}}{(2k)!} \\bigl(f^{(2k-1)}(n) - f^{(2k-1)}(m)\\bigr) + R_p,$$\nwhere\n$$R_p = (-1)^{p+1} \\int_m^n f^{(p)}(x) \\, \\frac{P_p(x)}{p!}\\, dx.$$\n\n## Remarks\n\nThe proof is repeated integration by parts on each interval $[i, i + 1]$, using $B_k'(t) = k B_{k-1}(t)$ and the fact that $B_k(0) = B_k(1)$ for $k \\ge 2$.\nFor $p = 1$ the formula reads $\\sum_{i=m}^{n} f(i) = \\int_m^n f + \\frac{f(m) + f(n)}{2} + \\int_m^n f'(x) \\bigl(x - \\floor{x} - \\frac12\\bigr)\\, dx$.\nExample: for $f(x) = x^2$ on $[0, n]$ with $p = 3$, the remainder vanishes since $f''' = 0$, and the formula gives $\\sum_{i=0}^{n} i^2 = \\frac{n^3}{3} + \\frac{n^2}{2} + \\frac{1}{12} \\cdot 2n = \\frac{n(n+1)(2n+1)}{6}$.\nThe infinite series obtained by letting $p \\to \\infty$ usually diverges, so the formula is used with a fixed $p$ and an estimate of $R_p$.\n\n## Explanations\n\n### L1 human\n\nThe formula compares a sum of values $f(m) + \\cdots + f(n)$ with the integral of $f$.\nThe difference is given by the end values of $f$ and its derivatives, with the Bernoulli numbers as coefficients, plus a small remainder.\n\n### L2 human\n\nIn one direction it estimates sums by integrals: it gives [[Stirling's formula|0KC0F51T6A]] for $\\ln n!$, asymptotics of harmonic numbers, and the values of power sums $\\sum i^k$ as polynomials in $n$.\nIn the other direction it estimates integrals by sums: it describes the error of the trapezoidal rule, and it explains why that rule is very accurate for smooth periodic functions.\nIt is a quantitative link between [[series|0JH4MN4K1C]] and the [[Riemann integral|0QM4TXT3DR]].\n",
  "commit": "5fc425f97f1f6b11da5892c2948ef8c5d8805665",
  "front": {
    "about": [
      "0JH4MN4K1C",
      "0QM4TXT3DR"
    ],
    "kind": "statement",
    "msc": [
      "65B15",
      "40A25",
      "26A42"
    ],
    "name": "Euler–Maclaurin formula",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q282023",
      "wikipedia": "Euler–Maclaurin formula"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Euler%E2%80%93Maclaurin_formula"
      }
    ],
    "tag": "9P839VB8S7",
    "uses": [
      "0RAS24E1R5",
      "BXQKBJJGFG",
      "0QM4TXT3DR",
      "0JH4MN4K1C"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/9P839VB8S7/",
  "links": [
    {
      "field": "about",
      "target": "0JH4MN4K1C"
    },
    {
      "field": "about",
      "target": "0QM4TXT3DR"
    },
    {
      "field": "uses",
      "target": "0RAS24E1R5"
    },
    {
      "field": "uses",
      "target": "BXQKBJJGFG"
    },
    {
      "field": "uses",
      "target": "0QM4TXT3DR"
    },
    {
      "field": "uses",
      "target": "0JH4MN4K1C"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/9P839VB8S7.md",
  "msc": [
    "65B15",
    "40A25",
    "26A42"
  ],
  "name": "Euler–Maclaurin formula",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/9P8/9P839VB8S7.md",
  "status": null,
  "tag": "9P839VB8S7",
  "uri": "m2://9P839VB8S7",
  "url": "https://math2.tamnd.com/wiki/euler-maclaurin-formula/",
  "writing": {
    "tag": "9P839VB8S7",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
