Grid adaptation in two-point boundary value problems is usually based on mapping a uniform auxiliary grid to the desired nonuniform grid. Here we combine this approach with a new control system for constructing a grid density function φ(x). The local mesh width ∆xj+1/2 = xj+1 − xj with 0 = x0 < x1 < · · · < xN = 1 is computed as ∆xj+1/2 = ǫN /ϕj+1/2, where {ϕj+1/2}N−1 0 is a discrete approximation to the continuous density function φ(x), representing mesh width variation. The parameter ǫN = 1/N controls accuracy via the choice of N. For any given grid, a solver provides an error estimate. Taking this as its input, the feedback control law then adjusts the grid, and the interaction continues until the error has been equidistributed. Digital filters may be employed to process the error estimate as well as the density to ensure the regularity of the grid. Once φ(x) is determined, another control law determines N based on the prescribed tolerance tol. The paper...