Definite integrals of piecewise functions