added quadrature sum function