def quadgk_int(f, fmin=-np.inf, fmax=np.inf, difftol=<NUM_LIT:0.1>):
difftol = <NUM_LIT><EOL>def trans_func(r):<EOL><INDENT>r2 = np.square(r)<EOL>x = r / (<NUM_LIT:1>-r2)<EOL>dx_dr = (<NUM_LIT:1> + r2)/(<NUM_LIT:1>-r2)**<NUM_LIT:2><EOL>return f(x)*dx_dr<EOL><DEDENT>integrand = quadvgk(trans_func, -<NUM_LIT:1.>, <NUM_LIT:1.>, difftol, difftol)<EOL>return integrand<EOL>
Integrate f from fmin to fmax,
do integration by substitution
x = r / (1-r**2)
when r goes from -1 to 1 , x goes from -inf to inf.
the interval for quadgk function is from -1 to +1, so we transform the space from (-inf,inf) to (-1,1)
:param f:
:param fmin:
:param fmax:
:param difftol:
:return: