Study Music. Click to play or pause. After it starts, press the Space Bar to play or pause. If enabled, it will resume across pages.

Building Examples in Numerical Analysis: A Practical Recipe

Numerical analysis is full of theorems that promise what happens “as $h\to 0$” or “as $N\to\infty$.” That asymptotic language is valuable, but it is easy to lose the practical and conceptual center of the subject: you understand a numerical method when you can build examples that reveal its strengths and its failure modes.

This article gives a practical recipe for constructing examples on purpose. The point is not to produce a zoo of special cases. The point is to create test problems that isolate a phenomenon so clearly that both the computation and the analysis have nowhere to hide.

Smart TV Pick
55-inch 4K Fire TV

INSIGNIA 55-inch Class F50 Series LED 4K UHD Smart Fire TV

INSIGNIA • F50 Series 55-inch • Smart Television
INSIGNIA 55-inch Class F50 Series LED 4K UHD Smart Fire TV
A broader mainstream TV recommendation for home entertainment and streaming-focused pages

A general-audience television pick for entertainment pages, living-room guides, streaming roundups, and practical smart-TV recommendations.

  • 55-inch 4K UHD display
  • HDR10 support
  • Built-in Fire TV platform
  • Alexa voice remote
  • HDMI eARC and DTS Virtual:X support
View TV on Amazon
Check Amazon for the live price, stock status, app support, and current television bundle details.

Why it stands out

  • General-audience television recommendation
  • Easy fit for streaming and living-room pages
  • Combines 4K TV and smart platform in one pick

Things to know

  • TV pricing and stock can change often
  • Platform preferences vary by buyer
See Amazon for current availability
As an Amazon Associate I earn from qualifying purchases.

Why constructing examples is a skill, not an afterthought

A good example does at least one of the following.

  • It tests a hypothesis under the sharpest regime where it might fail.
  • It separates two effects that are usually entangled, such as discretization error and conditioning.
  • It produces a ground truth so error can be measured without guessing.
  • It forces the method to confront the exact structure it claims to respect: symmetry, conservation, monotonicity, positivity, or smoothness.

A weak example does the opposite: it is so generic that any method looks fine, or so chaotic that you cannot explain why a method fails.

The recipe: build from the phenomenon backward

A reliable workflow is to start with the phenomenon you want to see, then engineer the data so that the phenomenon is unavoidable.

Step one: name the phenomenon precisely

Examples become useful when you can describe the target stress in a single sentence.

  • strong sensitivity to small perturbations of the data
  • slow convergence of an iterative method due to spectrum clustering
  • loss of accuracy near a boundary because the solution has a sharp transition
  • cancellation in floating point because two large terms nearly subtract
  • loss of order because the target function is not smooth enough for the method’s assumptions

If you cannot state the phenomenon, you cannot design the example.

Step two: choose whether you want a truth model or a stress model

A truth model is built to support measurement: you can evaluate the exact answer or a reference solution to high precision.

A stress model is built to push a method into a regime where it might break. You might not have a closed-form truth, but you can still diagnose behavior with invariants and consistency checks.

Both are legitimate. A mature numerical study usually includes both.

Step three: control the scale parameter explicitly

Most numerical behavior is revealed by scaling. Decide what you refine and what you hold fixed.

  • mesh spacing $h$
  • timestep $\Delta t$
  • polynomial degree $p$
  • iteration count $k$
  • noise amplitude $\sigma$
  • condition number target $\kappa$

Then decide how the other quantities should scale with that parameter. Many confusing experiments are confusing because they refine $h$ while silently changing something else that matters just as much.

Manufactured solutions: the cleanest way to get ground truth

For differential equations, the “method of manufactured solutions” is the most reliable way to build a truth model.

You choose a smooth function $u(x,t)$ that you want to be the solution, then compute the forcing term that makes it a solution.

For example, pick

$$ u(x,t) = \sin(\pi x)\,e^{-t},\qquad x\in(0,1),\ t\ge 0. $$

Then compute

$$ u_t = -\sin(\pi x)e^{-t},\qquad u_{xx} = -\pi^2\sin(\pi x)e^{-t}. $$

If you want a heat equation with diffusivity $\nu$,

$$ u_t – \nu u_{xx} = f(x,t), $$

then the forcing must be

$$ f(x,t) = -\sin(\pi x)e^{-t} + \nu\pi^2\sin(\pi x)e^{-t}. $$

Boundary and initial data are taken from $u$. Now you have a test problem where the exact solution is known and smooth, so you can verify the predicted convergence rate of your spatial and temporal discretization.

You can also manufacture non-smooth solutions on purpose to test order reduction. Choose a function that is continuous but has a kink, then build the forcing accordingly. This is one of the cleanest ways to check whether your error analysis is truly using the regularity assumptions it claims to use.

Building linear algebra examples with a chosen spectrum

Many algorithms, especially iterative solvers, are controlled by spectral properties. A practical way to build examples is to pick eigenvalues first, then build a matrix that has them.

If you want a symmetric positive definite matrix with eigenvalues $\lambda_1,\dots,\lambda_n$, choose an orthogonal matrix $Q$ and set

$$ A = Q\,\mathrm{diag}(\lambda_1,\dots,\lambda_n)\,Q^T. $$

Then $A$ has the chosen spectrum. You can design examples that:

  • have a specified condition number $\kappa = \lambda_{\max}/\lambda_{\min}$,
  • have clustered eigenvalues that favor conjugate gradient,
  • have a few outliers that slow down basic iterations,
  • have eigenvalues spanning multiple scales to stress preconditioning.

A related construction controls singular values for non-symmetric or rectangular problems by using an SVD-like build:

$$ A = U\,\mathrm{diag}(\sigma_1,\dots,\sigma_r)\,V^T, $$

with orthogonal $U$, $V$.

These constructions let you test a solver’s dependence on conditioning without mixing in unrelated complications such as geometry or boundary effects.

Examples for time stepping: separate stability from accuracy

For time stepping methods, it is easy to confuse stability limitations with truncation error. Build examples that separate them.

A simple approach is to use scalar test equations.

  • For non-stiff behavior: $y’ = -y$ has a benign decay.
  • For stiff behavior: $y’ = -\alpha y$ with $\alpha\gg 1$ forces explicit methods to take tiny steps for stability.

You can then check two regimes explicitly.

  • Fix a stable $\Delta t$ and refine it to observe the convergence rate.
  • Fix a target accuracy and increase $\alpha$ \to see how the stability restriction interacts with cost.

If you only refine $\Delta t$ in a regime where the scheme is unstable, you will not learn anything about accuracy because the method is not producing meaningful approximations in that regime.

Examples for quadrature: smooth, oscillatory, nearly singular

Quadrature error is driven by structure.

  • Smooth integrands with bounded derivatives tend to follow classical rate predictions.
  • Highly oscillatory integrands can defeat naive sampling.
  • Nearly singular integrands reveal whether a method is handling endpoint behavior correctly.

A practical trio of examples uses integrals on $[0,1]$.

  • Smooth: $\int_0^1 e^{-x^2}\,dx$.
  • Oscillatory: $\int_0^1 \cos(\omega x)\,dx$ with $\omega$ large.
  • Nearly singular: $\int_0^1 x^{-1/2}\,dx$, which is integrable but not smooth at the endpoint.

Each example has a known exact value or a high-precision reference. Together they reveal whether a quadrature scheme is relying on smoothness, whether it needs special handling for oscillations, and whether it is robust to endpoint singularity.

Examples for interpolation and approximation: force the pathology

Interpolation and approximation are notorious for producing good pictures that hide bad mathematics. To test methods honestly, use examples that are designed to display worst-case behavior.

A classic smooth but challenging target on $[-1,1]$ is

$$ f(x) = \frac{1}{1+25x^2}. $$

With equispaced nodes and high-degree polynomial interpolation, one often sees large oscillations near endpoints. With nodes clustered near the endpoints, the behavior improves dramatically. This is not a matter of taste. It is a structural fact about how polynomial interpolation distributes error.

For piecewise approximations, build examples with limited regularity.

  • A function with a kink tests whether you can get high order without smoothness.
  • A function with a narrow spike tests resolution and adaptive refinement.

Iterative methods: examples that reveal contraction constants

For fixed point iterations and nonlinear solvers, the contraction constant matters. Build examples where you can compute or bound it.

A clean fixed point example is

$$ x = \cos(x). $$

The iteration $x_{k+1} = \cos(x_k)$ converges because $|\sin(x)|\le 1$ and, near the fixed point, the derivative is less than one in magnitude. You can then build a variant with a derivative close to one to force slow convergence, making the role of the contraction constant visible rather than abstract.

For Newton’s method, multiple roots provide a classic slow-down example. If

$$ f(x) = (x-1)^m, $$

then the root at $x=1$ has multiplicity $m$, and Newton’s method loses its usual quadratic convergence. This kind of example is essential when evaluating stopping criteria, because residual-based stopping can be misleading near multiple roots.

How to document an example so it teaches

A good numerical example is reproducible in concept even if the reader never runs your code. That means your writeup should include information that allows the reader to reason about the result.

  • the exact definition of the problem, including boundary and initial data
  • the refinement parameter and how it is varied
  • the norm or metric used to measure error
  • the reference solution strategy if an exact truth is not available
  • the stopping criteria for iterative components
  • a brief explanation of what phenomenon the example is designed to isolate

When you include these elements, your examples become part of your argument rather than decoration.

A final principle: examples should be legible to theory

The best examples in numerical analysis have a dual personality.

  • They are simple enough that you can explain the behavior with a short theoretical narrative.
  • They are sharp enough that the method’s limitations become visible.

If you can do both, your examples will not just confirm a method. They will reveal the structure that the method is actually using. That is the point of constructing examples on purpose.

Books by Drew Higgins

Explore this field
Numerical Analysis
Library Numerical Analysis
Mathematics
Algebra
Analysis and Partial Differential Equations
Category Theory
Combinatorics
Dynamical Systems
Geometry
Logic and Foundations
Mathematical Physics
Number Theory

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *