When is it allowed to approximate a (real) function as piecewise constant? Is it enough that it is continuous and differentiable?
Edit: I was downvoted for not providing an example, so here is one: I want to solve an ordinary differential equation (differentiated in $x$) with respect to a function $f(x)$, but the equations include terms $g(x)$ (that are not differentiated). If I assume that $g(x)$ is piecewise constant (i.e. on a discrete lattice), then the solution to the equation simplifies tremendously, and I can even find an analytic solution (where I have to apply boundary conditions at the boundaries in each cell where $g(x)$ is constant). My question is if this approach is generally valid, i.e. when it is reasonable to assume that I can approximate $g(x)$ as piecewise constant.