python - Using nquad for a double integral -


having problem here. here's code far:

from scipy import integrate import math import numpy np  = 0.250 s02 = 214.0 a_s = 0.0163  def integrand(r, r, s02, a_s, a):         return 2.0 * r * (r/a)**(-0.1) * (1.0 + (r**2/a**2))**(-2.45)\\ *(math.sqrt(r**2 - r**2))**(-1.0) * (a_s/(1 + (r-0.0283)**2/a_s**2 ))  def bounds_r(s02, a_s, a):         return [0, np.inf] def bounds_r(r, s02, a_s, a):         return [r, np.inf]  result = integrate.nquad(integrand, [bounds_r(r, s02, a_s, a), bounds_r(s02, a_s, a)]) 

a, s02 , a_s constants. need perform first integral on r, , second integral on r. problem think fact r appears in limits first integral (something called abel transform). tried few things , every time getting error there either few arguments in boundary functions or little.

please help!

if write integrate.nquad(integrand, [bounds_r(r, s02, a_s, a), bounds_r(s02, a_s, a)]), python expecting affect value r. didn't because integration carried out on r.

this syntax should work :

result = integrate.nquad(integrand, [bounds_r, bounds_r], args=(s02,a_s,a)) 

take second example in documentation of integrate.nquad.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -