On the trapezoid quadrature formula and applications