{
 "id": "ep45rdezcy",
 "slug": "method-of-lines",
 "title": "Method of lines",
 "updated": "2026-09-30",
 "topic_path": [
  {
   "id": "physical",
   "label": "Physical world and mathematics",
   "api_url": "https://www.edgepedia.org/api/v1/topics/physical"
  },
  {
   "id": "physical.math",
   "label": "Mathematics and statistics",
   "api_url": "https://www.edgepedia.org/api/v1/topics/physical.math"
  },
  {
   "id": "physical.math.analysis",
   "label": "Analysis and mathematical models",
   "api_url": "https://www.edgepedia.org/api/v1/topics/physical.math.analysis"
  },
  {
   "id": "physical.math.analysis.numerical_analysis_and_computation",
   "label": "Numerical analysis and computation",
   "api_url": "https://www.edgepedia.org/api/v1/topics/physical.math.analysis.numerical_analysis_and_computation"
  }
 ],
 "geo": [
  {
   "id": "geo.nongeo.t1946.physical.math.analysis.numerical_analysis_and_computation",
   "label": "Non-geographic · 1946 to 2000: Numerical analysis and computation",
   "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946.physical.math.analysis.numerical_analysis_and_computation",
   "path": [
    {
     "id": "geo.nongeo",
     "label": "Non-geographic",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo"
    },
    {
     "id": "geo.nongeo.t1946",
     "label": "Non-geographic · 1946 to 2000",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946"
    },
    {
     "id": "geo.nongeo.t1946.physical",
     "label": "Physical world and mathematics",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946.physical"
    },
    {
     "id": "geo.nongeo.t1946.physical.math",
     "label": "Mathematics and statistics",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946.physical.math"
    },
    {
     "id": "geo.nongeo.t1946.physical.math.analysis",
     "label": "Analysis and mathematical models",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946.physical.math.analysis"
    },
    {
     "id": "geo.nongeo.t1946.physical.math.analysis.numerical_analysis_and_computation",
     "label": "Numerical analysis and computation",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t1946.physical.math.analysis.numerical_analysis_and_computation"
    }
   ]
  }
 ],
 "excerpt": "The method of lines is a numerical technique for solving time-dependent partial differential equations: space is discretized, time is left continuous, yielding a system of ODEs.",
 "snippet": "The method of lines is a numerical technique for solving time-dependent partial differential equations: space is discretized, time is left continuous, yielding a system of ODEs.",
 "node": "physical.math.analysis.numerical_analysis_and_computation",
 "markdown": "# Method of lines\n\nThe method of lines is a numerical technique for solving time-dependent partial differential equations in which the spatial derivatives are discretized while time is left continuous, converting the PDE into a system of ordinary differential equations (ODEs) that is then integrated with a time-stepping method. The result is a semi-discrete system, not a fully discrete solution: space is discretized, time is not. This separation is the method's central advantage. It is not a single algorithm but a framework, because both a spatial discretization and a time integrator must be chosen before a concrete computation exists; once the semi-discrete system is formed, any initial-value-problem (IVP) solver can drive it.\n\n| Key fact | Statement |\n|---|---|\n| Output | A semi-discrete system of ODEs or differential-algebraic equations (DAEs), integrated by general-purpose ODE/DAE software\\[5\\]\\[1\\] |\n| Spatial operators | Finite differences (most common), finite elements, finite volumes, collocation, or spectral methods\\[2\\]\\[3\\]\\[5\\] |\n| Advection stability limit | For the model advection problem with the specified explicit scheme, the CFL number \\( v \\cdot \\Delta t/\\Delta x \\) must remain below unity; admissible limits are method-dependent\\[6\\] |\n| Parabolic stability limit | Explicit Euler requires \\( D \\cdot \\Delta t/\\Delta x^{2} \\) below a constant\\[6\\] |\n| Stiffness | The semi-discrete parabolic system is stiff, favoring implicit integrators\\[7\\] |\n| Implicit remedy | Implicit Euler is unconditionally stable but needs Newton solves on large sparse Jacobians\\[6\\] |\n| Standing | Described as probably the most widely used approach to evolutionary PDEs\\[8\\] |\n\n## How it works\n\nThe principle is semi-discretization. Consider the model advection equation on a grid of \\( M \\) points with spacing \\( \\Delta x \\). Replacing \\( u_{x} \\) by a first-order upwind difference leaves each grid value with its own evolution equation,\n\na system of \\( M \\) ODEs in time.\\[6\\] For a diffusion problem the same idea gives a semi-discrete system in which a differentiation matrix multiplying the vector of grid values acts on \\( \\mathbf{u}(t) \\); the resulting ODE initial-value problem can be handed to any IVP solver.\\[1\\] In a finite-element (Galerkin) formulation the semi-discrete system takes the mass-matrix form, and the matrices may equally be generated by finite differences, finite volumes, or collocation.\\[7\\] For a linear autonomous evolution equation, the method produces the ODE system \\( v_{t} = L_{k} v \\) of dimension \\( N_{k} \\), and stability is analyzed through the matrix or operator \\( L_{k} \\) produced by the spatial discretization.\\[9\\]\n\nBoundary conditions enter as algebraic constraints on grid values or ghost points, which is why the semi-discrete problem may be a DAE rather than a pure ODE system.\\[5\\]\n\nConvergence of the fully discrete method requires two properties: consistency, meaning the truncation error obtained by inserting the exact solution vanishes as the timestep \\( \\tau \\to 0 \\), and stability, meaning boundedness of the numerical solution as \\( \\tau \\to 0 \\).\\[10\\] The total error is treated as the sum of the spatial and [temporal discretization](https://www.edgepedia.org/temporal-discretization) errors, with the temporal term entering at order \\( O(\\tau) \\) in the basic relation. The split has a practical consequence: when the spatial error dominates, further reduction of the timestep is useless, and when the temporal error dominates, refining the spatial mesh does not reduce the total error.\\[7\\]\n\n## How it is done\n\nThe practitioner's workflow has four decisions.\n\n**1. Grid and spatial discretization.** Choose the grid spacing \\( \\Delta x \\) and a discretization scheme. Fourth-order differences typically balance truncation error against roundoff error at machine precision, but second-order differences are preferable when fourth-order formulas produce excessive oscillation (Gibbs phenomena); even-order difference formulas are centered and have smaller error coefficients.\\[5\\]\n\n**2. Boundary and initial conditions.** These fix the semi-discrete system's initial vector and its algebraic constraints.\\[5\\]\n\n**3. Stiffness assessment.** The semi-discrete parabolic problem is stiff, meaning stability imposes much tighter timestep limits on explicit methods than accuracy requires.\\[7\\]\n\n**4. Time integrator.** For explicit stepping of the advection problem, the Courant–Friedricks–Lewy (CFL) number \\( v\\Delta t/\\Delta x \\) must remain below unity, so refining \\( \\Delta x \\) to improve accuracy forces a smaller \\( \\Delta t \\), a direct conflict between accuracy and stability.\\[6\\] For parabolic problems integrated with explicit Euler, the constraint is a bound on \\( \\Delta t/\\Delta x^{2} \\).\\[6\\] Implicit Euler removes the stability limit entirely but requires solving simultaneous algebraic equations at each step, nonlinear ones if the semi-discrete system is nonlinear, typically by a Newton-type method; the Jacobian becomes very large and sparse as grid points increase, especially in two and three space dimensions.\\[6\\] Crank–Nicolson is the trapezoidal rule applied to the method-of-lines ODE; it coincides with the implicit midpoint method for linear autonomous systems, but the methods generally differ.\\[7\\] For stiff systems, backward differentiation formula (BDF) methods are the classical choice.\\[2\\] For hyperbolic PDEs, Runge–Kutta time integration is standard, with local stability conditions derived in the literature.\\[11\\]\n\n## Origin\n\nThe idea of connecting PDEs with ODE systems is old: Lagrange observed in 1759 that his model of sound propagation as a system of second-order ODEs relates to d'Alembert's vibrating-string equation.\\[2\\] The numerical use of a space-discretized approximation to solve initial-boundary value problems appears, in the account of Hairer and Wanner's historical review, to start with Rothe in 1930.\\[2\\] The [trapezoidal rule](https://www.edgepedia.org/trapezoidal-rule) and backward Euler applied to heat flow are known in the PDE literature as the Crank–Nicolson and Laasonen methods, fully discrete counterparts of the same semi-discrete starting point.\\[2\\]\n\nIn the computer era the method was used extensively in the Soviet Union, where nearly all the literature was in Russian, while it saw little use in the USA; a US Army Ballistic Research Laboratory report that tried the method judged it very useful.\\[12\\] Early ACM papers presented it as a grid technique whose convergence and stability, for a wide class of boundary value problems, could be established from matrix theory, and described how the approach enables very general-purpose software for broad classes of PDE problems.\\[13\\]\\[14\\] The modern convergence framework separates space discretization from time integration and treats the latter with C-stability concepts linked to Lax–Richtmyer and Kreiss stability.\\[3\\]\n\n## Variants\n\nThe named variants correspond to the choice of spatial operator.\n\n**Finite-difference MOL** is the most common form. In Mathematica's NDSolve it is the \"TensorProductGrid\" spatial method, with the alternative \"FiniteElement\" method working on arbitrarily shaped regions; the method of lines there discretizes in all but one dimension and integrates the result as an ODE or DAE system.\\[5\\] A Matlab-based MOL toolbox implements linear spatial approximations through differentiation matrices and nonlinear approximations such as flux limiters, with explicit and linearly implicit time integrators.\\[8\\]\n\n**Finite-element (Galerkin) MOL** produces the mass-matrix semi-discrete form.\\[7\\]\n\n**Upwind and WENO advection schemes** handle first-derivative (advection) terms. In MethodOfLines.jl, the `advection_scheme` option defaults to `UpwindScheme()`, with `WENOScheme()` available and described as more stable and accurate at the cost of complexity.\\[15\\]\n\nCollocation and spectral spatial operators are also admissible within the same framework.\\[3\\]\\[9\\]\n\n## Applications\n\nMany PDEs requiring numerical solution are parabolic systems, for which the method of lines is described as ideally suited.\\[16\\] Documented applications include chemical engineering models, specifically [Burgers' equation](https://www.edgepedia.org/burgers-equation) in one and two space dimensions and a dynamic three-zone tubular fixed-bed reactor model for benzene hydrogenation;\\[8\\] biomedical problems including VEGF angiogenesis, blood–tissue transport, and glioblastoma tumor cell density, worked in R with source code on a companion website;\\[17\\] and general-purpose PDE software built on the approach.\\[14\\] In numerical relativity, the Cactus toolkit's Method of Lines thorn performs time integration with Iterative Crank–Nicholson as the default method.\\[18\\] In the Julia SciML ecosystem, MethodOfLines.jl performs automated finite difference discretization of symbolically defined PDEs in N dimensions, returning an `ODEProblem` or `NonlinearProblem` after simplification with `ModelingToolkit.structural_simplify`; the SciML Benchmarks include work-precision diagrams for the Burgers equation comparing MethodOfLines.jl discretizations, including WENO-based schemes.\\[20\\]\\[15\\]\\[21\\]\n\n## Limitations and alternatives\n\nThe method's failure modes come from the spatial discretization, not the time-stepping framework. A centered-in-space, forward-Euler-in-time scheme for the model advection problem is unconditionally unstable by von Neumann stability analysis, a result showing that higher-order spatial approximations do not guarantee stable, or even accurate, solutions.\\[6\\] First-order upwind space combined with first-order time limits the overall accuracy of the finite-difference approximation; higher-order difference formulas are one remedy.\\[6\\] High-order differences can produce Gibbs oscillations near sharp features, in which case second-order differences are preferable,\\[5\\] and for genuine discontinuities, essentially nonoscillatory (ENO) schemes, which hold full order away from discontinuities while limiting order and oscillation near them, are the standard tool; NDSolve does not implement them.\\[5\\]\n\n\n## References\n\n---\n*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Analysis and mathematical models › Numerical analysis and computation*\n\n*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*\n\n*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*\n\nLicense: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license\n",
 "same_as": [],
 "url": "https://www.edgepedia.org/method-of-lines",
 "markdown_url": "https://www.edgepedia.org/method-of-lines.md",
 "license": {
  "name": "Edgepedia Community License 1.0",
  "url": "https://www.edgepedia.org/edgepedia/license",
  "summary": "Free with credit, commercial use included. AI training is open to everyone. For other uses, organizations over USD 100M in revenue or 100M monthly users license separately.",
  "spdx": "LicenseRef-Edgepedia-Community-1.0"
 },
 "credit": "\"Method of lines\", Edgepedia (EdgeChat), https://www.edgepedia.org/method-of-lines. Edgepedia Community License 1.0.",
 "credit_md": "\"[Method of lines](https://www.edgepedia.org/method-of-lines)\", Edgepedia (EdgeChat), [https://www.edgepedia.org/method-of-lines](https://www.edgepedia.org/method-of-lines). [Edgepedia Community License 1.0](https://www.edgepedia.org/edgepedia/license).",
 "credit_html": "\"<a href=\"https://www.edgepedia.org/method-of-lines\">Method of lines</a>\", Edgepedia (EdgeChat), <a href=\"https://www.edgepedia.org/method-of-lines\">https://www.edgepedia.org/method-of-lines</a>. <a href=\"https://www.edgepedia.org/edgepedia/license\">Edgepedia Community License 1.0</a>.",
 "speakable": "The method of lines is a numerical technique for solving time-dependent partial differential equations: space is discretized, time is left continuous, yielding a system of ODEs."
}
