{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet a [[partial differential equation|GC5BDZ6QBC]] $\\mathcal{L} u = f$ be given on a domain $\\Omega \\subseteq \\R^d$, possibly with time, together with boundary or initial conditions.\nThe *finite difference method* consists of:\n\n1. A grid: finitely many points $x_j$ of $\\overline{\\Omega}$, usually $x_j = jh$ with mesh size $h \u003e 0$, and time levels $t_n = nk$ with time step $k \u003e 0$.\n2. Difference quotients: each [[partial derivative|09EGC6F8PT]] in $\\mathcal{L}$ is replaced by a linear combination of grid values, such as $(u_{j+1} - u_j)/h$ for $\\partial_x u$ or $(u_{j+1} - 2u_j + u_{j-1})/h^2$ for $\\partial_x^2 u$.\n3. The discrete problem: the resulting algebraic equations and the discretized side conditions are solved for the grid values $u_j \\approx u(x_j)$.\n\n## Remarks\n\nThe local truncation error is the residual left when the exact solution is put into the scheme.\nThe scheme is consistent of order $p$ if this error is $O(h^p)$; for example, Taylor expansion gives $\\frac{u(x+h) - 2u(x) + u(x-h)}{h^2} = u''(x) + \\frac{h^2}{12} u^{(4)}(\\xi)$ for some $\\xi$ in $(x - h, x + h)$ when $u \\in C^4$.\nExample: for the heat equation $u_t = u_{xx}$, the explicit scheme is $u_j^{n+1} = u_j^n + r (u_{j+1}^n - 2u_j^n + u_{j-1}^n)$ with $r = k/h^2$.\nIt is consistent of order $1$ in $k$ and $2$ in $h$.\nIt is stable in the maximum norm when $r \\le \\tfrac12$, since then $u_j^{n+1}$ is a convex combination of $u_{j-1}^n, u_j^n, u_{j+1}^n$.\nNon-example: the finite element method also yields algebraic equations on a mesh, but it does not satisfy clause 2.\nIt imposes the equation in weak form against basis functions instead of replacing derivatives by difference quotients.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "X7HYEBA5SA",
    "kind": "definition",
    "msc": [
      "65M06",
      "65N06"
    ],
    "name": "Finite difference method",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Finite_difference_method"
      }
    ],
    "tag": "1QCG88BQC2",
    "uses": [
      "GC5BDZ6QBC",
      "09EGC6F8PT"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/1QCG88BQC2/",
  "links": [
    {
      "field": "defines",
      "target": "X7HYEBA5SA"
    },
    {
      "field": "uses",
      "target": "GC5BDZ6QBC"
    },
    {
      "field": "uses",
      "target": "09EGC6F8PT"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/1QCG88BQC2.md",
  "msc": [
    "65M06",
    "65N06"
  ],
  "name": "Finite difference method",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/1QC/1QCG88BQC2.md",
  "status": null,
  "tag": "1QCG88BQC2",
  "uri": "m2://1QCG88BQC2",
  "url": "https://tamnd.github.io/math2/wiki/finite-difference-method-definition/",
  "writing": {
    "tag": "1QCG88BQC2",
    "kind": "definition",
    "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
      }
    ]
  }
}
