{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $f \\colon [t_0, T] \\times \\R^d \\to \\R^d$ be of class $C^2$, and consider the [[initial value problem|0FXDW992DS]] $y' = f(t, y)$, $y(t_0) = y_0$ with exact solution $y$.\n*Heun's method* with step $h \u003e 0$ computes a predictor $\\tilde y_{n+1} = y_n + h f(t_n, y_n)$ and then\n$$y_{n+1} = y_n + \\frac{h}{2}\\Big( f(t_n, y_n) + f(t_{n+1}, \\tilde y_{n+1}) \\Big), \\qquad t_{n+1} = t_n + h.$$\nIts [[local truncation error|T220HF0562]] is $O(h^3)$, so it is a Runge–Kutta method of order $2$.\n\n## Remarks\n\nProof idea: by [[Taylor's theorem|03QHBVW4TT]], $f\\big(t + h, y + h f\\big) = f + h(f_t + f_y f) + O(h^2)$ at $(t, y)$, so the increment is $h f + \\frac{h^2}{2}(f_t + f_y f) + O(h^3)$, which matches the Taylor expansion of $y(t + h)$ up to $h^2$.\nIn Butcher form it has $c = (0, 1)$, $a_{21} = 1$ and $b = (\\tfrac12, \\tfrac12)$.\nExample: for $y' = y$, $y(0) = 1$ and $h = 0.1$, one step gives $\\tilde y_1 = 1.1$ and $y_1 = 1 + 0.05 (1 + 1.1) = 1.105$, against $e^{0.1} \\approx 1.10517$; the [[Euler method|0JARTXX4XP]] gives $1.1$.\nIf $f$ does not depend on $y$, the method is the trapezoidal rule for $\\int f(t)\\,dt$.\n\n## Explanations\n\n### L1 human\n\nHeun's method first takes a trial Euler step to guess where the solution goes.\nIt then measures the slope at the guessed endpoint, averages it with the slope at the start, and redoes the step with this average slope.\nThe averaging cancels most of the error of the plain Euler step.\n\n### L2 human\n\nHeun's method is also called the improved Euler method or the explicit trapezoidal method.\nIt is the simplest predictor–corrector scheme: an explicit Euler predictor followed by one correction with the trapezoidal rule.\nLike the [[midpoint method|WHK8D383YT]], it is a two-stage explicit [[Runge–Kutta method|7DBPJKYC6C]] of order $2$.\nThe difference between its result and the Euler predictor gives a cheap estimate of the local error for step size control.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "7DBPJKYC6C"
    ],
    "kind": "statement",
    "msc": [
      "65L06",
      "65L05"
    ],
    "name": "Heun's method",
    "role": "proposition",
    "same_as": {
      "wikidata": "Q1531998",
      "wikipedia": "Heun's method"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Heun%27s_method"
      }
    ],
    "tag": "RJEK60G28F",
    "uses": [
      "7DBPJKYC6C",
      "0FXDW992DS",
      "T220HF0562",
      "0JARTXX4XP",
      "03QHBVW4TT"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/RJEK60G28F/",
  "links": [
    {
      "field": "about",
      "target": "7DBPJKYC6C"
    },
    {
      "field": "uses",
      "target": "7DBPJKYC6C"
    },
    {
      "field": "uses",
      "target": "0FXDW992DS"
    },
    {
      "field": "uses",
      "target": "T220HF0562"
    },
    {
      "field": "uses",
      "target": "0JARTXX4XP"
    },
    {
      "field": "uses",
      "target": "03QHBVW4TT"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/RJEK60G28F.md",
  "msc": [
    "65L06",
    "65L05"
  ],
  "name": "Heun's method",
  "prov": null,
  "role": "proposition",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/RJE/RJEK60G28F.md",
  "status": null,
  "tag": "RJEK60G28F",
  "uri": "m2://RJEK60G28F",
  "url": "https://tamnd.github.io/math2/wiki/heuns-method/",
  "writing": {
    "tag": "RJEK60G28F",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
