{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $X$ and $Y$ be normed spaces with [[norms|0V2WP9B1MF]] $\\norm{\\cdot}$, and let $f \\colon X \\to Y$ be a problem.\nAn *algorithm* for $f$ is a family of maps $\\tilde f \\colon X \\to Y$, one for each floating-point system, with unit roundoff $u$ as in [[machine epsilon|JA3QXVF2B8]].\nAll [[$O$ bounds|0TGV80E6A4]] below are as $u \\to 0$, uniform in $x \\ne 0$.\n\n1. The algorithm is *backward stable* if for each $x$ there is $\\tilde x$ with $\\tilde f(x) = f(\\tilde x)$ and $\\norm{\\tilde x - x}/\\norm{x} = O(u)$.\n2. The algorithm is *stable* if for each $x$ there is $\\tilde x$ with $\\norm{\\tilde x - x}/\\norm{x} = O(u)$ and $\\norm{\\tilde f(x) - f(\\tilde x)}/\\norm{f(\\tilde x)} = O(u)$.\n3. The algorithm is *forward stable* if $\\norm{\\tilde f(x) - f(x)}/\\norm{f(x)} = O(\\kappa(x) \\, u)$, where $\\kappa(x)$ is the relative condition number of $f$ at $x$.\n\n## Remarks\n\nExample: computing $x_1 + x_2$ as $\\mathrm{fl}(x_1 + x_2) = (x_1 + x_2)(1 + \\delta)$, $\\abs{\\delta} \\le u$, is backward stable, with $\\tilde x = (x_1(1 + \\delta), x_2(1 + \\delta))$; this is the [[backward error|CMXHRNWY35]] computation.\nNon-example: computing $1 - \\cos t$ by forming $\\mathrm{fl}(\\cos t)$ and subtracting it from $1$ is not stable for small $t$.\nThe result, of order $t^2/2$, carries an absolute error of order $u$, so its relative error is of order $u/t^2$.\nThis is not $O(u)$, and a relative perturbation of $t$ of order $u$ cannot explain it.\nThe formula $2 \\sin^2(t/2)$ computes the same quantity stably.\nBackward stability implies stability, and a backward stable algorithm has relative forward error $O(\\kappa(x) u)$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "1AKB4XHMTH",
    "kind": "definition",
    "msc": [
      "65G50",
      "65F35"
    ],
    "name": "Numerical stability",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Numerical_stability"
      }
    ],
    "tag": "QWYQ3JNK0B",
    "uses": [
      "CMXHRNWY35",
      "JA3QXVF2B8",
      "0TGV80E6A4",
      "0V2WP9B1MF"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/QWYQ3JNK0B/",
  "links": [
    {
      "field": "defines",
      "target": "1AKB4XHMTH"
    },
    {
      "field": "uses",
      "target": "CMXHRNWY35"
    },
    {
      "field": "uses",
      "target": "JA3QXVF2B8"
    },
    {
      "field": "uses",
      "target": "0TGV80E6A4"
    },
    {
      "field": "uses",
      "target": "0V2WP9B1MF"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/QWYQ3JNK0B.md",
  "msc": [
    "65G50",
    "65F35"
  ],
  "name": "Numerical stability",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/QWY/QWYQ3JNK0B.md",
  "status": null,
  "tag": "QWYQ3JNK0B",
  "uri": "m2://QWYQ3JNK0B",
  "url": "https://tamnd.github.io/math2/wiki/numerical-stability-definition/",
  "writing": {
    "tag": "QWYQ3JNK0B",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
