The Central Idea
A continuous model may involve every point in an interval, region, or time span. A computer must instead work with finitely many stored values.
The basic transition is
\[ \boxed{\text{continuous model}\longrightarrow \text{finite representation}\longrightarrow \text{numerical computation}}. \]The finite representation is called a discretization.
What Is Discretization?
Discretization is the process of replacing a continuous set, function, differential relationship, or geometric region with a finite collection of computational points, intervals, cells, elements, or states.
Discretization may be applied to:
- time;
- one-dimensional intervals;
- two-dimensional regions;
- three-dimensional volumes;
- continuous functions;
- differential equations;
- integrals;
- probability distributions;
- continuous physical fields.
Why Discretization Is Necessary
A continuous interval such as
\[ 0\le x\le 1 \]contains infinitely many real numbers. A computer cannot store a separate model value at every real number in the interval.
Instead, we may choose a finite set such as
\[ 0,\quad 0.25,\quad 0.50,\quad 0.75,\quad 1. \]The continuous domain has been replaced by five computational locations.
Grid Points
A common one-dimensional discretization uses equally spaced grid points.
If an interval \([a,b]\) is divided into \(N\) equal subintervals, the spacing is
\[ \boxed{\Delta x=\frac{b-a}{N}}. \]The grid points are then
\[ x_i=a+i\Delta x, \qquad i=0,1,\ldots,N. \]There are \(N+1\) grid points and \(N\) subintervals.
Example: A Uniform Grid
Discretize
\[ 0\le x\le 10 \]into five equal subintervals.
The spacing is
\[ \Delta x=\frac{10-0}{5}=2. \]Therefore, the grid points are
\[ \boxed{0,\ 2,\ 4,\ 6,\ 8,\ 10}. \]Nodes, Cells, and Intervals
Different numerical methods organize discretizations in different ways.
A node is a selected computational location. A cell is a finite region between nearby nodes or boundaries. In one dimension, a cell may simply be an interval.
For the grid
\[ 0,\ 2,\ 4,\ 6, \]the intervals
\[ [0,2],\qquad [2,4],\qquad [4,6] \]can be treated as three computational cells.
Resolution
The resolution of a discretization describes how finely the continuous domain has been divided.
A smaller spacing such as
\[ \Delta x=0.01 \]generally gives a finer representation than
\[ \Delta x=0.1. \]Finer resolution can capture more detail, but it also requires more memory and computation.
Coarse and Fine Grids
Suppose the interval \([0,1]\) is represented first with
\[ \Delta x=0.5. \]The grid points are
\[ 0,\ 0.5,\ 1. \]A finer grid with
\[ \Delta x=0.1 \]includes
\[ 0,\ 0.1,\ 0.2,\ldots,0.9,\ 1. \]The second discretization represents the interval with more computational detail.
The Accuracy-Cost Tradeoff
Finer discretization usually improves the ability to represent variation in the model, but it increases computational cost.
\[ \boxed{\text{finer resolution} \Rightarrow \text{more detail and greater cost}}. \]A useful discretization is therefore not simply the finest possible one. It is a resolution appropriate to the purpose, accuracy requirements, and available computational resources.
Sampling a Continuous Function
Suppose
\[ f(x)=x^2 \]is defined for every \(x\in[0,2]\).
If we choose grid points
\[ x=0,\ 0.5,\ 1,\ 1.5,\ 2, \]then the sampled values are
\[ 0,\ 0.25,\ 1,\ 2.25,\ 4. \]The computer now stores selected values rather than the entire continuous function.
Discrete Approximations to Continuous Curves
When only sampled values are stored, behavior between grid points must be approximated or reconstructed when needed.
One simple approach is piecewise linear interpolation. Between points \((x_i,f_i)\) and \((x_{i+1},f_{i+1})\), the function is approximated by a straight-line segment.
The discretized model therefore replaces a continuously varying curve with a finite collection of values and local approximations.
Time Discretization
Time can also be discretized. Instead of treating time as every real number \(t\ge 0\), choose time levels
\[ t_n=t_0+n\Delta t, \]where \(\Delta t\) is the time-step size.
A simulation then tracks the system at times
\[ t_0,\ t_1,\ t_2,\ldots. \]The next lesson develops time-stepping systematically.
Example: Discretizing Time
Suppose a process is simulated from \(t=0\) seconds to \(t=5\) seconds with \(\Delta t=1\) second.
The time levels are
\[ \boxed{0,\ 1,\ 2,\ 3,\ 4,\ 5}. \]If instead \(\Delta t=0.5\) second, twice as many time intervals are used over the same duration.
Two-Dimensional Discretization
A two-dimensional region can be divided into a grid of cells. For a rectangular domain, one common choice is
\[ x_i=x_0+i\Delta x, \] \[ y_j=y_0+j\Delta y. \]The computational locations are then indexed by pairs \((i,j)\).
A quantity such as temperature may be stored as
\[ T_{i,j}. \]A Grid as a Matrix
Values on a rectangular two-dimensional grid can naturally be stored in a matrix:
\[ \begin{bmatrix} T_{1,1} & T_{1,2} & \cdots \\ T_{2,1} & T_{2,2} & \cdots \\ \vdots & \vdots & \ddots \end{bmatrix}. \]This connects geometric discretization with linear algebra and numerical computation.
Three-Dimensional Discretization
In three dimensions, a volume may be divided into small computational regions. On a regular Cartesian grid, points can be indexed by \((i,j,k)\).
A field such as density may be stored as
\[ \rho_{i,j,k}. \]Three-dimensional simulations can become computationally expensive because the number of cells grows rapidly as the grid is refined.
How Grid Size Grows
Suppose a square region uses \(N\) computational intervals in each coordinate direction. The number of cells scales approximately as
\[ N^2. \]In three dimensions, the number scales approximately as
\[ N^3. \]Doubling the resolution in each direction therefore has a much larger impact in higher dimensions.
Example: Resolution Growth
A two-dimensional grid with \(100\) cells in each direction contains
\[ 100^2=10{,}000 \]cells.
Doubling to \(200\) cells in each direction gives
\[ 200^2=40{,}000. \]The resolution doubled in each coordinate direction, but the total number of cells increased by a factor of four.
Uniform Discretization
A uniform discretization uses constant spacing. In one dimension,
\[ x_{i+1}-x_i=\Delta x \]for every adjacent pair of grid points.
Uniform grids are simple to construct, index, and analyze, which makes them common in introductory numerical models.
Nonuniform Discretization
A nonuniform discretization allows different spacings in different parts of the domain.
Instead of one constant \(\Delta x\), the spacing may depend on \(i\):
\[ \Delta x_i=x_{i+1}-x_i. \]A nonuniform grid can place more computational points where the model changes rapidly and fewer points where behavior is smooth.
Why Adaptive Resolution Can Be Useful
Some models contain localized features such as:
- sharp temperature gradients;
- boundary layers;
- moving fronts;
- shock-like transitions;
- small geometric features;
- regions of rapidly changing probability or density.
A uniform grid may waste computation in smooth regions. Adaptive or nonuniform discretization concentrates resolution where it is most useful.
Discretizing a Derivative
A derivative is defined through a limit:
\[ f'(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}. \]A numerical model cannot generally take an infinitely small \(h\). Instead, it uses a finite spacing such as \(\Delta x\):
\[ f'(x)\approx \frac{f(x+\Delta x)-f(x)}{\Delta x}. \]The derivative has been replaced by a discrete approximation.
Forward Difference Approximation
On a grid, let
\[ x_i=a+i\Delta x, \qquad f_i=f(x_i). \]A basic approximation to the derivative at \(x_i\) is
\[ \boxed{ f'(x_i)\approx \frac{f_{i+1}-f_i}{\Delta x} }. \]This is called a forward difference.
Backward Difference Approximation
Another discrete approximation uses the previous grid point:
\[ \boxed{ f'(x_i)\approx \frac{f_i-f_{i-1}}{\Delta x} }. \]This is called a backward difference.
Central Difference Approximation
A symmetric approximation uses points on both sides:
\[ \boxed{ f'(x_i)\approx \frac{f_{i+1}-f_{i-1}}{2\Delta x} }. \]This is called a central difference.
Different difference formulas have different error properties and are appropriate in different numerical settings.
Discretizing an Integral
A definite integral represents continuous accumulation:
\[ \int_a^b f(x)\,dx. \]Numerical integration replaces the continuous accumulation with a finite sum.
\[ \int_a^b f(x)\,dx \approx \sum_{i=0}^{N-1}f(x_i)\Delta x. \]The integral has been discretized into finitely many contributions.
From Differential Equations to Algebraic Updates
Consider the differential equation
\[ \frac{dy}{dt}=f(t,y). \]Replacing the derivative with a forward difference gives
\[ \frac{y_{n+1}-y_n}{\Delta t} \approx f(t_n,y_n). \]Solving for \(y_{n+1}\),
\[ y_{n+1} \approx y_n+\Delta t\,f(t_n,y_n). \]A continuous differential relationship has become a discrete update rule.
Spatial Discretization of a Field
Suppose temperature varies continuously as
\[ T=T(x). \]After discretization, the model stores values
\[ T_i=T(x_i). \]Instead of an entire continuous temperature field, the simulation operates on a finite collection
\[ T_0,T_1,\ldots,T_N. \]Discretizing Boundaries
Boundaries require special attention because neighboring points may exist on only one side.
For a one-dimensional interval
\[ a\le x\le b, \]the boundary grid points are \(x_0=a\) and \(x_N=b\).
Boundary conditions are imposed or approximated at these locations.
Boundary Conditions Become Computational Rules
Suppose a model requires
\[ T(0)=100. \]On a grid with \(x_0=0\), the computational condition becomes
\[ \boxed{T_0=100}. \]A continuous boundary condition has become a discrete assignment.
Irregular Geometries
Rectangular grids are convenient, but many real regions are not rectangles. Curved, branched, or irregular domains may require:
- nonuniform grids;
- triangular meshes;
- quadrilateral meshes;
- tetrahedral elements;
- other geometric partitions.
These ideas lead naturally to finite-element methods and other mesh-based techniques.
What Is a Mesh?
A mesh is a collection of connected computational elements used to partition a domain.
In two dimensions, a mesh may consist of triangles. In three dimensions, it may contain tetrahedra or other polyhedral elements.
Meshes make it possible to discretize complex shapes more flexibly than a regular rectangular grid.
Structured and Unstructured Discretizations
A structured grid follows a regular indexing pattern, often based on rows, columns, and layers.
An unstructured mesh allows a more flexible network of elements and connections.
Structured grids are often simpler computationally, while unstructured meshes are useful for complex geometry.
Discretization Error
Replacing a continuous model with a finite approximation introduces discretization error.
If a derivative is replaced by
\[ \frac{f(x+\Delta x)-f(x)}{\Delta x}, \]the result is generally not exactly equal to \(f'(x)\) when \(\Delta x\) is finite.
The difference between the continuous relationship and its discrete numerical representation contributes to numerical error.
Refinement
Grid refinement means reducing the spacing between computational points.
For example,
\[ \Delta x=0.2 \]may be refined to
\[ \Delta x=0.1, \]and then to
\[ \Delta x=0.05. \]Comparing results across these grids helps reveal how sensitive the computed solution is to resolution.
Convergence Under Refinement
A well-designed numerical method often approaches a stable result as the discretization becomes finer.
\[ \boxed{ \text{discrete solution} \longrightarrow \text{continuous-model solution} \quad\text{as}\quad \Delta x\to 0 }. \]The exact conditions for convergence depend on the problem and numerical method.
A Simple Refinement Comparison
Suppose a computed quantity is
\[ Q_{0.2}=3.41, \] \[ Q_{0.1}=3.47, \]and
\[ Q_{0.05}=3.485. \]The values are changing less as the grid is refined. This may indicate numerical convergence, although further analysis is needed before drawing a strong conclusion.
Discretization Is a Modeling Choice
Discretization is not merely a software setting. It affects what structures and scales the model can represent.
Choosing \(\Delta x\) or \(\Delta t\) requires consideration of:
- the smallest important physical or mathematical scale;
- the expected rate of variation;
- required accuracy;
- numerical stability;
- memory limits;
- runtime constraints;
- available data resolution.
Resolution Must Match the Question
A model should be resolved finely enough to answer its intended question.
If a simulation is designed to estimate broad regional averages, extremely fine local detail may be unnecessary. If the goal is to study a sharp boundary layer, a coarse grid may miss the feature entirely.
Numerical resolution should therefore be chosen with the modeling objective in mind.
Aliasing and Missed Structure
If the discretization is too coarse, rapid variation may be represented incorrectly or missed altogether.
A function that oscillates many times between two sampled points can appear much smoother than it really is.
This illustrates a general principle: a discrete representation cannot reliably capture structures much smaller than its resolution.
Discretization and Data
Real measurements are often already discrete. A sensor may report temperature once every minute, or a spatial measurement may be recorded every kilometer.
When a continuous model is compared with such data, the computational discretization and the measurement resolution should be considered together.
Discrete State Models
Not every discretization is based on space or time intervals. A continuous or complex system may also be approximated by a finite collection of states.
For example, a model may classify a quantity as:
- low;
- medium;
- high.
This replaces a continuous range with three discrete categories.
Continuous Versus Discrete Representations
A continuous quantity may take every value in an interval, while a discretized quantity takes values only at selected locations or levels.
For example,
\[ x\in[0,1] \]is continuous, while
\[ x\in\{0,\ 0.1,\ 0.2,\ldots,1\} \]is discrete.
Common Error: Confusing Points and Intervals
If an interval is divided into \(N\) equal subintervals, there are usually \(N+1\) endpoint grid points.
For example, four subintervals require five points:
\[ x_0,\ x_1,\ x_2,\ x_3,\ x_4. \]Mixing up the number of cells and number of nodes is a common indexing error.
Common Error: Using Inconsistent Spacing
If a formula assumes constant spacing \(\Delta x\), then the grid must actually use that spacing unless the formula is modified.
A uniform-grid approximation should not be applied blindly to a nonuniform grid. The numerical formula must match the geometry of the discretization.
Common Error: Refining Without Rechecking Cost
Halving the grid spacing does not merely add a few points. In higher dimensions, the number of computational elements can increase rapidly.
A refinement that is inexpensive in one dimension may be costly in three dimensions. Resolution choices should therefore be evaluated together with memory and runtime requirements.
Common Error: Assuming Finer Is Automatically Better
A finer grid may reduce discretization error, but it does not automatically make the entire model more accurate.
Other errors may dominate, including:
- incorrect equations;
- poor parameter estimates;
- unrealistic boundary conditions;
- measurement uncertainty;
- unstable numerical methods;
- rounding and floating-point effects.
Common Error: Ignoring Boundaries
Interior formulas often rely on neighboring points on both sides. At a boundary, one of those neighboring points may not exist.
Boundary nodes therefore often require special formulas, assigned values, or other boundary-condition treatments.
A Reliable Discretization Workflow
- Identify the continuous domain or quantity to be discretized.
- Determine the important spatial, temporal, or state scales.
- Choose grid points, cells, elements, or discrete states.
- Define spacing such as \(\Delta x\), \(\Delta y\), or \(\Delta t\).
- Translate continuous equations into discrete relationships.
- Represent initial and boundary conditions computationally.
- Check indexing and units.
- Run the model at an initial resolution.
- Refine the discretization and compare results.
- Balance accuracy requirements against computational cost.
Practice 1: Grid Spacing
Divide
\[ 0\le x\le 12 \]into six equal subintervals. Find \(\Delta x\).
Practice 2: List the Grid Points
Using the discretization from Practice 1, list all grid points.
Practice 3: Count Nodes and Cells
An interval is divided into \(20\) equal cells. How many endpoint grid points are present?
Practice 4: Time Discretization
A simulation runs from \(t=0\) to \(t=2\) seconds using \(\Delta t=0.5\) second. List the time levels.
Practice 5: Forward Difference
Let
\[ f(1)=3,\qquad f(1.1)=3.31. \]Use a forward difference with \(\Delta x=0.1\) to approximate \(f'(1)\).
Practice 6: Grid Refinement
A one-dimensional grid uses \(\Delta x=0.2\). If the spacing is halved, what is the new \(\Delta x\)?
Practice 7: Two-Dimensional Cost Growth
A square grid is refined from \(50\times50\) cells to \(100\times100\) cells. By what factor does the number of cells increase?
Practice 8: Identify the Modeling Issue
A rapidly oscillating function is sampled only at widely separated grid points. What problem can this create?
Practice Answers
Practice 1
\[ \Delta x=\frac{12-0}{6}=\boxed{2}. \]Practice 2
\[ \boxed{0,\ 2,\ 4,\ 6,\ 8,\ 10,\ 12}. \]Practice 3
Twenty cells require twenty-one endpoint nodes:
\[ \boxed{21}. \]Practice 4
\[ \boxed{0,\ 0.5,\ 1.0,\ 1.5,\ 2.0}. \]Practice 5
\[ f'(1)\approx \frac{3.31-3}{0.1} = \frac{0.31}{0.1} = \boxed{3.1}. \]Practice 6
\[ \boxed{\Delta x=0.1}. \]Practice 7
The original grid has
\[ 50^2=2500 \]cells, while the refined grid has
\[ 100^2=10{,}000. \]Therefore, the number of cells increases by a factor of
\[ \boxed{4}. \]Practice 8
The grid may miss or misrepresent the rapid variation. The resolution is too coarse to capture the important structure reliably.
What to Remember
Discretization converts continuous mathematical structure into a finite computational representation.
- continuous domains are replaced by finite grids, nodes, cells, or elements;
- uniform spacing often uses \(\Delta x=(b-a)/N\);
- finer resolution usually captures more detail but costs more;
- derivatives and integrals can be replaced by finite numerical approximations;
- boundaries require explicit computational treatment;
- grid refinement helps assess sensitivity to resolution;
- discretization introduces numerical error;
- the chosen resolution should match the purpose and scale of the model.
The central principle is: replace the infinite or continuous structure with a finite representation that preserves the behavior needed for the simulation.
Where We Go Next
Once time has been discretized into levels \(t_0,t_1,t_2,\ldots\), the simulation needs a rule for advancing the model from one time level to the next.
The next lesson, Time-Stepping, develops the numerical process of updating dynamic systems through discrete time increments and examines how step size affects accuracy, stability, and computational cost.