Piecewise linear implementation of nonlinear dynamical systems: from theory to practice