  A simple and very accurate method to approximate a function with a finite
number of discontinuities is presented. This method relies on hyperbolic
tangent functions of rational arguments as connecting functions at the
discontinuities, each argument being the reciprocal of Newton binomials that
depend on the abscissae that define the domain of the discontinuous function
and upon the abscissae of discontinuities. Our approximants take the form of
linear combinations of such hyperbolic tangent functions with coefficients that
are obtained by solving a linear system of inhomogeneous equations whose
righthand sides are the partition functions that define the given discontinuous
function. These approximants are analytic, and being free from the Gibbs
phenomenon certainly converge at the discontinuity points much better than
other known approximants to discontinuous functions, typical relative errors
being of the order of 10-14 even when as close as 10-12 to the discontinuity
points. Moreover, they can be readily scaled to larger intervals. Our method is
here illustrated with a representative set of discontinuous mathematical
physics functions, and by studying the dynamics of an oscillator subjected to a
discontinuous force, but it can be applied to important cases of discontinuous
functions in physics, mathematics, engineering and physical chemistry.
