Five-point stencil

Last updated
An illustration of the five-point stencil in one and two dimensions (top, and bottom, respectively). Five point stencil illustration.png
An illustration of the five-point stencil in one and two dimensions (top, and bottom, respectively).

In numerical analysis, given a square grid in one or two dimensions, the five-point stencil of a point in the grid is a stencil made up of the point itself together with its four "neighbors". It is used to write finite difference approximations to derivatives at grid points. It is an example for numerical differentiation.

Contents

In one dimension

In one dimension, if the spacing between points in the grid is h, then the five-point stencil of a point x in the grid is

1D first derivative

The first derivative of a function f of a real variable at a point x can be approximated using a five-point stencil as: [1]

The center point f(x) itself is not involved, only the four neighboring points.

Derivation

This formula can be obtained by writing out the four Taylor series of f(x ± h) and f(x ± 2h) up to terms of h3 (or up to terms of h5 to get an error estimation as well) and solving this system of four equations to get f(x). Actually, we have at points x + h and x  h:

Evaluating gives us

The residual term O1(h4) should be of the order of h5 instead of h4 because if the terms of h4 had been written out in (E1+) and (E1), it can be seen that they would have canceled each other out by f(x + h) − f(xh). But for this calculation, it is left like that since the order of error estimation is not treated here (cf below).

Similarly, we have

and gives us

In order to eliminate the terms of ƒ(3)(x), calculate 8 × (E1)  (E2)

thus giving the formula as above. Note: the coefficients of f in this formula, (8, -8,-1,1), represent a specific example of the more general Savitzky–Golay filter.

Error estimate

The error in this approximation is of order h 4. That can be seen from the expansion [2]

which can be obtained by expanding the left-hand side in a Taylor series. Alternatively, apply Richardson extrapolation to the central difference approximation to on grids with spacing 2h and h.

1D higher-order derivatives

The centered difference formulas for five-point stencils approximating second, third, and fourth derivatives are

The errors in these approximations are O(h4), O(h2) and O(h2) respectively. [2]

Relationship to Lagrange interpolating polynomials

As an alternative to deriving the finite difference weights from the Taylor series, they may be obtained by differentiating the Lagrange polynomials

where the interpolation points are

Then, the quartic polynomial interpolating f(x) at these five points is

and its derivative is

So, the finite difference approximation of f(x) at the middle point x = x2 is

Evaluating the derivatives of the five Lagrange polynomials at x = x2 gives the same weights as above. This method can be more flexible as the extension to a non-uniform grid is quite straightforward.

In two dimensions

In two dimensions, if for example the size of the squares in the grid is h by h, the five point stencil of a point (x, y) in the grid is

forming a pattern that is also called a quincunx. This stencil is often used to approximate the Laplacian of a function of two variables:

The error in this approximation is O(h 2), [3] which may be explained as follows:

From the 3 point stencils for the second derivative of a function with respect to x and y:

If we assume :

See also

Related Research Articles

In calculus, the chain rule is a formula that expresses the derivative of the composition of two differentiable functions f and g in terms of the derivatives of f and g. More precisely, if is the function such that for every x, then the chain rule is, in Lagrange's notation,

<span class="mw-page-title-main">Dirac delta function</span> Generalized function whose value is zero everywhere except at zero

In mathematical physics, the Dirac delta distribution, also known as the unit impulse, is a generalized function or distribution over the real numbers, whose value is zero everywhere except at zero, and whose integral over the entire real line is equal to one.

A finite difference is a mathematical expression of the form f (x + b) − f (x + a). If a finite difference is divided by ba, one gets a difference quotient. The approximation of derivatives by finite differences plays a central role in finite difference methods for the numerical solution of differential equations, especially boundary value problems.

<span class="mw-page-title-main">Riemann sum</span> Approximation technique in integral calculus

In mathematics, a Riemann sum is a certain kind of approximation of an integral by a finite sum. It is named after nineteenth century German mathematician Bernhard Riemann. One very common application is in numerical integration, i.e., approximating the area of functions or lines on a graph, where it is also known as the rectangle rule. It can also be applied for approximating the length of curves and other approximations.

<span class="mw-page-title-main">Spherical harmonics</span> Special mathematical functions defined on the surface of a sphere

In mathematics and physical science, spherical harmonics are special functions defined on the surface of a sphere. They are often employed in solving partial differential equations in many scientific fields.

<span class="mw-page-title-main">Product rule</span> Formula for the derivative of a product

In calculus, the product rule is a formula used to find the derivatives of products of two or more functions. For two functions, it may be stated in Lagrange's notation as

In mathematical physics, the WKB approximation or WKB method is a method for finding approximate solutions to linear differential equations with spatially varying coefficients. It is typically used for a semiclassical calculation in quantum mechanics in which the wavefunction is recast as an exponential function, semiclassically expanded, and then either the amplitude or the phase is taken to be changing slowly.

<span class="mw-page-title-main">Numerical differentiation</span> Use of numerical analysis to estimate derivatives of functions

In numerical analysis, numerical differentiation algorithms estimate the derivative of a mathematical function or function subroutine using values of the function and perhaps other knowledge about the function.

In mathematics, the discrete Laplace operator is an analog of the continuous Laplace operator, defined so that it has meaning on a graph or a discrete grid. For the case of a finite-dimensional graph, the discrete Laplace operator is more commonly called the Laplacian matrix.

<span class="mw-page-title-main">Duffing equation</span> Non-linear second order differential equation and its attractor

The Duffing equation, named after Georg Duffing (1861–1944), is a non-linear second-order differential equation used to model certain damped and driven oscillators. The equation is given by

In theoretical physics, a source field is a background field coupled to the original field as

In physics and fluid mechanics, a Blasius boundary layer describes the steady two-dimensional laminar boundary layer that forms on a semi-infinite plate which is held parallel to a constant unidirectional flow. Falkner and Skan later generalized Blasius' solution to wedge flow, i.e. flows in which the plate is not parallel to the flow.

In condensed matter physics and crystallography, the static structure factor is a mathematical description of how a material scatters incident radiation. The structure factor is a critical tool in the interpretation of scattering patterns obtained in X-ray, electron and neutron diffraction experiments.

In numerical analysis, finite-difference methods (FDM) are a class of numerical techniques for solving differential equations by approximating derivatives with finite differences. Both the spatial domain and time interval are discretized, or broken into a finite number of steps, and the value of the solution at these discrete points is approximated by solving algebraic equations containing finite differences and values from nearby points.

In applied mathematics, discontinuous Galerkin methods (DG methods) form a class of numerical methods for solving differential equations. They combine features of the finite element and the finite volume framework and have been successfully applied to hyperbolic, elliptic, parabolic and mixed form problems arising from a wide range of applications. DG methods have in particular received considerable interest for problems with a dominant first-order part, e.g. in electrodynamics, fluid mechanics and plasma physics.

<span class="mw-page-title-main">Critical state soil mechanics</span>

Critical state soil mechanics is the area of soil mechanics that encompasses the conceptual models that represent the mechanical behavior of saturated remolded soils based on the Critical State concept.

In mathematics, vector spherical harmonics (VSH) are an extension of the scalar spherical harmonics for use with vector fields. The components of the VSH are complex-valued functions expressed in the spherical coordinate basis vectors.

In mathematics, to approximate a derivative to an arbitrary order of accuracy, it is possible to use the finite difference. A finite difference can be central, forward or backward.

In pure and applied mathematics, quantum mechanics and computer graphics, a tensor operator generalizes the notion of operators which are scalars and vectors. A special class of these are spherical tensor operators which apply the notion of the spherical basis and spherical harmonics. The spherical basis closely relates to the description of angular momentum in quantum mechanics and spherical harmonic functions. The coordinate-free generalization of a tensor operator is known as a representation operator.

<span class="mw-page-title-main">Stokes problem</span>

In fluid dynamics, Stokes problem also known as Stokes second problem or sometimes referred to as Stokes boundary layer or Oscillating boundary layer is a problem of determining the flow created by an oscillating solid surface, named after Sir George Stokes. This is considered one of the simplest unsteady problems that has an exact solution for the Navier-Stokes equations. In turbulent flow, this is still named a Stokes boundary layer, but now one has to rely on experiments, numerical simulations or approximate methods in order to obtain useful information on the flow.

References

  1. Sauer, Timothy (2012). Numerical Analysis. Pearson. p. 250. ISBN   978-0-321-78367-7.
  2. 1 2 Abramowitz & Stegun, Table 25.2
  3. Abramowitz & Stegun, 25.3.30