implemented the cubature method.