#NEWLINE# def integrate( self , * args , **kwargs ) : #NEWLINE# #INDENT# depth = kwargs . pop ( 'depth' , 0 ) #NEWLINE# if kwargs : #NEWLINE# #INDENT# raise ValueError ( 'unexpected kwargs' ) #NEWLINE# #UNINDENT# ind = ( - ( depth + 1 ) ) #NEWLINE# fn_range = self . ranges [ ind ] #NEWLINE# ( low , high ) = fn_range ( * args ) #NEWLINE# fn_opt = self . opts [ ind ] #NEWLINE# opt = dict ( fn_opt ( * args ) ) #NEWLINE# if ( 'points' in opt ) : #NEWLINE# #INDENT# opt [ 'points' ] = [ x for x in opt [ 'points' ] if ( low <= x <= high ) ] #NEWLINE# #UNINDENT# if ( ( depth + 1 ) == self . maxdepth ) : #NEWLINE# #INDENT# f = self . func #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# f = partial ( self . integrate , depth = ( depth + 1 ) ) #NEWLINE# #UNINDENT# ( value , abserr ) = quad ( f , low , high , args = args , ** opt ) #NEWLINE# self . abserr = max ( self . abserr , abserr ) #NEWLINE# if ( depth > 0 ) : #NEWLINE# #INDENT# return value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( value , self . abserr )