calculate integral