Discretization (source code)

= Discretization

Discretization replaces a <continuous> mathematical problem by equations for finitely many unknowns. A spatial grid samples a <function>; a <finite element method> instead chooses coefficients in a finite-dimensional trial space. A time <discretization> supplies update equations at selected times. These choices specify what is computed, before any <roundoff error> is introduced.

For the <heat equation> $u_t=u_{xx}$, a uniform spatial grid $x_j=jh$ gives
$$
\frac{dU_j}{dt}=\frac{U_{j-1}-2U_j+U_{j+1}}{h^2}.
$$
This is a <semidiscretization>: time remains continuous. Applying the <Forward Euler method> gives a fully discrete update
$$
U_j^{n+1}=U_j^n+\frac{k}{h^2}(U_{j-1}^n-2U_j^n+U_{j+1}^n).
$$
For a smooth exact solution, the <normalized local truncation error> is $O(k+h^2)$. Convergence additionally requires <stability of a numerical method>; for this one-dimensional update, $0\leq k/h^2\leq1/2$ makes each new value a <convex combination> of neighboring values. Spatial and temporal refinement therefore interact, rather than giving two independent accuracy knobs.