【发布时间】:2016-05-16 15:39:28
【问题描述】:
这里有问题。到目前为止,这是我的代码:
from scipy import integrate
import math
import numpy as np
a = 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 是常量。我需要对 r 执行第一个积分,然后对 R 执行第二个积分。我认为的问题是 R 出现在第一个积分的限制中(称为 Abel 变换)。尝试了一些东西,每次都得到一个错误,即边界函数中的参数太少或太少。
请帮忙!
【问题讨论】:
-
我需要计算 Abel 变换,您可以使用 github.com/PyAbel/PyAbel 中已经实现的算法之一,这将比使用
quad计算效率更高。
标签: python numpy scipy integration