{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $h \u003e 0$ and let $G$ be a finite set of $N$ nodes $x_{ij} = (ih, jh)$ of a square grid in $\\R^2$.\nLet $F_{ij} \u003e 0$ be a speed at each node, and let $S \\subset G$ be a nonempty set of source nodes with given values $T_{ij} \\ge 0$.\nFor $T$ on $G$ write $a = \\min(T_{i-1,j}, T_{i+1,j})$ and $b = \\min(T_{i,j-1}, T_{i,j+1})$, with missing neighbours ignored.\nThe upwind discretization of the [[eikonal equation|HGMX1QGTAZ]] $\\abs{\\nabla T} = 1/F$ at a node $x_{ij} \\notin S$ is\n$$\\big( \\max(T_{ij} - a, 0) \\big)^2 + \\big( \\max(T_{ij} - b, 0) \\big)^2 = \\frac{h^2}{F_{ij}^2}.$$\nThe *fast marching method* first marks the nodes of $S$ as accepted.\nIt then repeats two steps until all nodes are accepted.\nFirst, it computes a tentative value at each non-accepted neighbour of an accepted node.\nThis value solves the equation above, with only accepted neighbours used in $a$ and $b$.\nSecond, it accepts the node with the smallest tentative value.\nAssume the grid graph on $G$ is connected.\nThen:\n\n1. every node is accepted exactly once, and the method stops;\n2. the nodes not in $S$ are accepted in nondecreasing order of their values;\n3. the final values satisfy the upwind equation at every node not in $S$;\n4. with the tentative values kept in a binary [[heap|V389A4WGH9]], the method uses $O(N \\log N)$ operations.\n\n## Remarks\n\nThe upwind equation has the causality property: its solution $T_{ij}$ is larger than every neighbour value that enters it with a nonzero term.\nHence a newly computed tentative value is never smaller than the last accepted value, which gives claim 2, and accepting the smallest tentative value never needs to be undone.\nThe source values are arbitrary, so claim 2 is only about the nodes outside $S$.\nThis is the same argument as for Dijkstra's algorithm, which the method resembles; Dijkstra's algorithm on the grid graph would measure distance along grid edges only.\nEach node is inserted and updated a bounded number of times, and each heap operation costs $O(\\log N)$, which gives claim 4.\n\nExample: with $F \\equiv 1$ and one source with $T = 0$ at the origin, the computed $T$ approximates the Euclidean distance to the origin.\nAt the node $(h, h)$, both neighbours $(h, 0)$ and $(0, h)$ have value $h$, and the equation gives $T = h + h/\\sqrt{2} \\approx 1.71 h$, near the true value $\\sqrt{2} h \\approx 1.41 h$.\nThe error is of first order in $h$.\n\n## Explanations\n\n### L1 human\n\nImagine a fire that starts on a set of points and spreads at a given speed, which may vary from place to place.\nThe fast marching method computes the arrival time of the fire at every grid point.\nIt sweeps outward from the start like a front, always fixing the point that the fire reaches next.\nEach point is fixed once, so the whole computation is nearly as fast as visiting every point once.\n\n### L2 human\n\nThe eikonal equation is a stationary Hamilton–Jacobi equation, and its relevant solution is the [[viscosity solution|H1ERJ3T75T]].\nThe upwind scheme above is monotone and consistent, and as $h \\to 0$ its solutions approximate the viscosity solution.\nThe fast marching method solves this nonlinear system in one pass, instead of by repeated sweeps or iterations.\nIt is used to build signed distance functions for the [[level-set method|7KWR08FJET]], to compute shortest paths around obstacles, and in seismic travel time computations.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "HGMX1QGTAZ"
    ],
    "kind": "statement",
    "msc": [
      "65N06",
      "35F21",
      "65D18"
    ],
    "name": "Fast marching method",
    "role": "proposition",
    "same_as": {
      "wikidata": "Q5437042",
      "wikipedia": "Fast marching method"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Fast_marching_method"
      }
    ],
    "tag": "DAK6EJK20R",
    "uses": [
      "HGMX1QGTAZ",
      "V389A4WGH9",
      "H1ERJ3T75T"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/DAK6EJK20R/",
  "links": [
    {
      "field": "about",
      "target": "HGMX1QGTAZ"
    },
    {
      "field": "uses",
      "target": "HGMX1QGTAZ"
    },
    {
      "field": "uses",
      "target": "V389A4WGH9"
    },
    {
      "field": "uses",
      "target": "H1ERJ3T75T"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/DAK6EJK20R.md",
  "msc": [
    "65N06",
    "35F21",
    "65D18"
  ],
  "name": "Fast marching method",
  "prov": null,
  "role": "proposition",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/DAK/DAK6EJK20R.md",
  "status": null,
  "tag": "DAK6EJK20R",
  "uri": "m2://DAK6EJK20R",
  "url": "https://tamnd.github.io/math2/wiki/fast-marching-method/",
  "writing": {
    "tag": "DAK6EJK20R",
    "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
      }
    ]
  }
}
