$$\require{cancel}$$

# 7: Finite-Difference Equations


One of the most common tasks in scientific computing is finding solutions to differential equations, because most physical theories are formulated using differential equations. In classical mechanics, for example, a mechanical system is described by a second-order differential equation in time (Newton's second law); and in classical electromagnetism, the electromagnetic fields are described by first-order partial differential equations in space and time (Maxwell's equations).

In order to describe continuous functions (and the differential equations that act on them), computational schemes usually adopt the strategy of discretization. Consider a general mathematical function of one real variable, $$\psi(x)$$, where the domain of the input is $$\mathbb{R}$$, or some finite interval. In principle, in order to fully specify the function, we have to enumerate its values for all possible inputs $$x$$; but since $$x$$ can vary continuously, the set is uncountably infinite, so such an enumeration is impossible on a digital computer with finite discrete memory. What we can do, instead, is to enumerate the function's values at a finite and discrete set of points,

$\{x_n \;|\; n = 0, 1, 2, \dots, N-1\}.$

We define the values at these points as

$\psi_n \equiv \psi(x_n).$

If $$x_{n}$$ is appropriately chosen, the set of values $$\{\psi_n\}$$ ought to describe $$\psi(x)$$ quite accurately. One reason for this is that physical theories typically involve differential equations of low order (e.g., first, second, or third order, rather than, say, order $$1,000,000$$). Hence, if the discretization points are sufficiently finely-spaced, the value of the function, and all its higher-order derivatives, will vary only slightly between discretization points.

As we shall see, discretization converts differential equations into discrete systems of equations, called finite-difference equations. These can then be solved using the standard methods of numerical linear algebra.

7: Finite-Difference Equations is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Y. D. Chong via source content that was edited to conform to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.