#NEWLINE# def _quad_weight( func , a , b , args , full_output , epsabs , epsrel , limlst , limit , maxp1 , weight , wvar , wopts ) : #NEWLINE# #INDENT# if ( weight not in [ 'cos' , 'sin' , 'alg' , 'alg-loga' , 'alg-logb' , 'alg-log' , 'cauchy' ] ) : #NEWLINE# #INDENT# raise ValueError ( ( '%s not a recognized weighting function.' % weight ) ) #NEWLINE# #UNINDENT# strdict = { #NEWLINE# #INDENT# 'cos' : 1 , #NEWLINE# 'sin' : 2 , #NEWLINE# 'alg' : 1 , #NEWLINE# 'alg-loga' : 2 , #NEWLINE# 'alg-logb' : 3 , #NEWLINE# 'alg-log' : 4 , #NEWLINE# #UNINDENT# } #NEWLINE# if ( weight in [ 'cos' , 'sin' ] ) : #NEWLINE# #INDENT# integr = strdict [ weight ] #NEWLINE# if ( ( b != Inf ) and ( a != ( - Inf ) ) ) : #NEWLINE# #INDENT# if ( wopts is None ) : #NEWLINE# #INDENT# return _quadpack . _qawoe ( func , a , b , wvar , integr , args , full_output , epsabs , epsrel , limit , maxp1 , 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# momcom = wopts [ 0 ] #NEWLINE# chebcom = wopts [ 1 ] #NEWLINE# return _quadpack . _qawoe ( func , a , b , wvar , integr , args , full_output , epsabs , epsrel , limit , maxp1 , 2 , momcom , chebcom ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( b == Inf ) and ( a != ( - Inf ) ) ) : #NEWLINE# #INDENT# return _quadpack . _qawfe ( func , a , wvar , integr , args , full_output , epsabs , limlst , limit , maxp1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( b != Inf ) and ( a == ( - Inf ) ) ) : #NEWLINE# #INDENT# if ( weight == 'cos' ) : #NEWLINE# #INDENT# def thefunc( x , * myargs ) : #NEWLINE# #INDENT# y = ( - x ) #NEWLINE# func = myargs [ 0 ] #NEWLINE# myargs = ( ( y , ) + myargs [ 1 : ] ) #NEWLINE# return func ( * myargs ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# def thefunc( x , * myargs ) : #NEWLINE# #INDENT# y = ( - x ) #NEWLINE# func = myargs [ 0 ] #NEWLINE# myargs = ( ( y , ) + myargs [ 1 : ] ) #NEWLINE# return ( - func ( * myargs ) ) #NEWLINE# #UNINDENT# #UNINDENT# args = ( ( func , ) + args ) #NEWLINE# return _quadpack . _qawfe ( thefunc , ( - b ) , wvar , integr , args , full_output , epsabs , limlst , limit , maxp1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Cannot integrate with this weight from -Inf to +Inf.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( a in [ ( - Inf ) , Inf ] ) or ( b in [ ( - Inf ) , Inf ] ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Cannot integrate with this weight over an infinite interval.' ) #NEWLINE# #UNINDENT# if ( weight [ : 3 ] == 'alg' ) : #NEWLINE# #INDENT# integr = strdict [ weight ] #NEWLINE# return _quadpack . _qawse ( weight , a , b , wvar , integr , args , full_output , epsabs , epsrel , limit ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return _quadpack . _qawce ( func , a , b , wvar , args , full_output , epsabs , epsrel , limit )