add subroutines to do numerical integration