# Method of lines

The 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.

| Key fact | Statement |
|---|---|
| Output | A semi-discrete system of ODEs or differential-algebraic equations (DAEs), integrated by general-purpose ODE/DAE software\[5\]\[1\] |
| Spatial operators | Finite differences (most common), finite elements, finite volumes, collocation, or spectral methods\[2\]\[3\]\[5\] |
| 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\] |
| Parabolic stability limit | Explicit Euler requires \( D \cdot \Delta t/\Delta x^{2} \) below a constant\[6\] |
| Stiffness | The semi-discrete parabolic system is stiff, favoring implicit integrators\[7\] |
| Implicit remedy | Implicit Euler is unconditionally stable but needs Newton solves on large sparse Jacobians\[6\] |
| Standing | Described as probably the most widely used approach to evolutionary PDEs\[8\] |

## How it works

The 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,

a 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\]

Boundary 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\]

Convergence 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\]

## How it is done

The practitioner's workflow has four decisions.

**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\]

**2. Boundary and initial conditions.** These fix the semi-discrete system's initial vector and its algebraic constraints.\[5\]

**3. Stiffness assessment.** The semi-discrete parabolic problem is stiff, meaning stability imposes much tighter timestep limits on explicit methods than accuracy requires.\[7\]

**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\]

## Origin

The 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\]

In 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\]

## Variants

The named variants correspond to the choice of spatial operator.

**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\]

**Finite-element (Galerkin) MOL** produces the mass-matrix semi-discrete form.\[7\]

**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\]

Collocation and spectral spatial operators are also admissible within the same framework.\[3\]\[9\]

## Applications

Many 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\]

## Limitations and alternatives

The 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\]


## References

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: Physical world and mathematics › Mathematics and statistics › Analysis and mathematical models › Numerical analysis and computation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/method-of-lines
