def quadrect(f, n, a, b, kind='lege', *args, **kwargs):
 if (kind.lower() == 'lege'):
  (nodes, weights) = qnwlege(n, a, b)
 elif (kind.lower() == 'cheb'):
  (nodes, weights) = qnwcheb(n, a, b)
 elif (kind.lower() == 'trap'):
  (nodes, weights) = qnwtrap(n, a, b)
 elif (kind.lower() == 'simp'):
  (nodes, weights) = qnwsimp(n, a, b)
 else:
  (nodes, weights) = qnwequi(n, a, b, kind)
 out = weights.dot(f(nodes, *args, **kwargs))
 return out

def quadrect ( f , n , a , b , kind = 'lege' , * args , ** kwargs ) : if ( kind . lower ( ) == 'lege' ) : ( nodes , weights ) = qnwlege ( n , a , b ) elif ( kind . lower ( ) == 'cheb' ) : ( nodes , weights ) = qnwcheb ( n , a , b ) elif ( kind . lower ( ) == 'trap' ) : ( nodes , weights ) = qnwtrap ( n , a , b ) elif ( kind . lower ( ) == 'simp' ) : ( nodes , weights ) = qnwsimp ( n , a , b ) else : ( nodes , weights ) = qnwequi ( n , a , b , kind ) out = weights . dot ( f ( nodes , * args , ** kwargs ) ) return out
integrate the d-dimensional function f on a rectangle with lower and upper bound for dimension i defined by a[i] and b[i] .