complex refactoring
sympson: integrating also in inverse direction