Numerical calculation of incomplete gamma functions by the trapezoidal rule