ArticleslgStudy

mathematics

Nine-point stencil

Nine-point stencil is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Nine-point stencil rather than just read about it. In short: In numerical analysis, given a square grid in two dimensions, the nine-point stencil of a point in the grid is a stencil made up of the point itself together with its eight "neighbors". It is used to write finite difference approximations to derivatives at grid points.

Nine-point stencil — main illustration
Nine-point stencil — illustration

Key takeaways

  • Nine-point stencil belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Nine-point stencil to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Nine-point stencil from memory before moving on to harder problems.

Reference excerpt

In numerical analysis, given a square grid in two dimensions, the nine-point stencil of a point in the grid is a stencil made up of the point itself together with its eight "neighbors". It is used to write finite difference approximations to derivatives at grid points. It is an example for numerical differentiation. This stencil is often used to approximate the Laplacian of a function of two variables.

Motivation If we discretize the 2D Laplacian by using central-difference methods, we obtain the commonly used five-point stencil, represented by the following convolution kernel: DCD=[0101−41010]

Even though it is simple to obtain and computationally lighter, the central difference kernel possess an undesired intrinsic anisotropic property, since it doesn't take into account the diagonal neighbours. This intrinsic anisotropy poses a problem when applied on certain numerical simulations or when more accuracy is required, by propagating the Laplacian effect faster in the coordinate axes directions and slower in the other directions, thus distorting the final result. This drawback calls for finding better methods for discretizing the Laplacian, reducing or eliminating the anisotropy.

Implementation The two most commonly used isotropic nine-point stencils are displayed below, in their convolution kernel forms. They can be obtained by the following formula: D=(1−γ)[0101−41010]+γ[1/201/20−201/201/2] The first one is known by Oono-Puri, and it is obtained when γ=1/2. DOP=[1/42/41/42/4−12/42/41/42/41/4]=[0.250.50.250.5−30.50.250.50.25] The second one is known by Patra-Karttunen or Mehrstellen, and it is obtained when γ=1/3. DPK=[1/64/61/64/6−20/64/61/64/61/6]=[0.160.660.160.66−3.330.660.160.660.16] Both are isotropic forms of discrete Laplacian, and in the limit of small Δx, they all become equivalent, as Oono-Puri being described as the optimally isotropic form of discretization, displaying reduced overall error, and Patra-Karttunen having been systematically derived by imposing conditions of rotational invariance, displaying smallest error around the origin.

Desired anisotropy On the other hand, if controlled anisotropic effects are a desired feature, when solving anisotropic diffusion problems for example, it is also possible to use the 9-point stencil combined with tensors to generate them. Consider the laplacian in the following form: c∇2A=cDOP∗A Where c is just a constant coefficient. Now if we replace c by the 2nd rank tensor C: C=[c100c2] Where c1 is the constant coefficient for the principal direction in x axis, and c2 is the constant coefficient for the secondary direction in y axis. In order to generate anisotropic effects, c1 and c2 must be different. By multiplying it by the rotation matrix Q, we obtain C', allowing anisotropic propagations in arbitrary directions other than the coordinate axes. Q=[cos⁡θsin⁡θ−sin⁡θcos⁡θ] C′=QCQT C′=[cxxcxycxycyy]=[c1cos2θ+c2sin2θ(c2−c1)cos⁡θsin⁡θ(c2−c1)cos⁡θsin⁡θc2cos2θ+c1sin2θ] Which is very similar to the Cauchy stress tensor in 2 dimensions. The angle θ can be obtained by generating a vector field 𝐕=Vx𝐢+Vy𝐣 in order to orientate the pattern as desired. Then: θ=arctan⁡(Vy/Vx) Or, for different anisotropic effects using the same vector field θ=arctan⁡(Vy/−Vx) Regardless of the values of θ, the anisotropic propagation will occur parallel to the secondary direction c2 and perpendicular to the principal direction c1:. The resulting convolution kernel is as follows DAniso=[−cxy2cyycxy2cxx−2(cxx+cyy)cxxcxy2cyy−cxy2] If, for example, c1=c2=1, the cxy component will vanish, resulting in the simple five-point stencil, rendering no controlled anisotropy. If c2>c1 and θ=0, the anisotropic effects will be more pronounced in the vertical axis. If c2>c1 and θ=45 degrees, the anisotropic effects will be more pronounced in the upper-right / lower-left diagonal.

References

Illustrations

Nine-point stencil: An illustration of the nine-point stencil in two dimensions.
An illustration of the nine-point stencil in two dimensions.
Nine-point stencil: Starting from homogeneous initial conditions with only one point-like perturbation, the correct growth process would yield a circle (left). If growth is faster along the coordinate axes, which is caused by the anisotropic effect of central difference discretization, the circle would turn into star-shaped structure, as the errors propagate (right):.[1]
Starting from homogeneous initial conditions with only one point-like perturbation, the correct growth process would yield a circle (left). If growth is faster along the coordinate axes, which is caused by the anisotropic effect of central difference discretization, the circle would turn into star-shaped structure, as the errors propagate (right):.[1]

Worked examples

Example 1 — a first encounter with Nine-point stencil

Start with the simplest possible case. Write down what Nine-point stencil claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Nine-point stencil before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Nine-point stencil ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Nine-point stencil

In research
Nine-point stencil appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Nine-point stencil in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Nine-point stencil is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational science, Finite differences, Linear operators in calculus, so understanding it makes those chapters shorter.
In everyday life
Look for Nine-point stencil outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Nine-point stencil” →

How to study Nine-point stencil in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Nine-point stencil means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Nine-point stencil out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Nine-point stencil in simple terms?

In numerical analysis, given a square grid in two dimensions, the nine-point stencil of a point in the grid is a stencil made up of the point itself together with its eight "neighbors". It is used to write finite difference approximations to derivatives at grid points.

Why does Nine-point stencil matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Nine-point stencil?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Nine-point stencil.

Tags

  • Computational science
  • Finite differences
  • Linear operators in calculus
  • Mathematical analysis
  • Mathematical physics
  • Numerical analysis
  • Numerical differential equations

Keep exploring