generalized Newton - Cotes algorithm for numerical integration