#NEWLINE# def ei( z , _e1 = False ) : #NEWLINE# #INDENT# typez = type ( z ) #NEWLINE# if ( typez not in ( float , complex ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# z = float ( z ) #NEWLINE# typez = float #NEWLINE# #UNINDENT# except ( TypeError , ValueError ) : #NEWLINE# #INDENT# z = complex ( z ) #NEWLINE# typez = complex #NEWLINE# #UNINDENT# #UNINDENT# if ( not z ) : #NEWLINE# #INDENT# return ( - INF ) #NEWLINE# #UNINDENT# absz = abs ( z ) #NEWLINE# if ( absz > EI_ASYMP_CONVERGENCE_RADIUS ) : #NEWLINE# #INDENT# return ei_asymp ( z , _e1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( absz <= 2.0 ) or ( ( typez is float ) and ( z > 0.0 ) ) ) : #NEWLINE# #INDENT# return ei_taylor ( z , _e1 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( typez is complex ) and ( D . real > 0.0 ) ) : #NEWLINE# #INDENT# zref = ( z / absz ) #NEWLINE# ref = ei_taylor ( zref , _e1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# zref = ( ( EI_ASYMP_CONVERGENCE_RADIUS * z ) / absz ) #NEWLINE# ref = ei_asymp ( zref , _e1 ) #NEWLINE# #UNINDENT# C = ( ( zref - z ) * 0.5 ) #NEWLINE# D = ( ( zref + z ) * 0.5 ) #NEWLINE# s = 0.0 #NEWLINE# if ( type ( z ) is complex ) : #NEWLINE# #INDENT# _exp = cmath . exp #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _exp = math . exp #NEWLINE# #UNINDENT# for ( x , w ) in gauss42 : #NEWLINE# #INDENT# t = ( ( C * x ) + D ) #NEWLINE# s += ( ( w * _exp ( t ) ) / t ) #NEWLINE# #UNINDENT# ref -= ( C * s ) #NEWLINE# return ref