Piecewise linear approximation of nonlinear functions