【发布时间】:2014-11-03 22:08:26
【问题描述】:
我尝试整合黑体光谱(函数 BBS)以获得太阳的辐射光度(Lbol in main),它应该约为 3.85*10**26 瓦。但我只得到了其中的 1/3。
import numpy as np
from scipy.integrate import quad
global h, c, k # ISU
h = 6.62607e-34
c = 2.998e8
k = 1.38065e-23
global mu_min, mu_max
mu_min, mu_max = 3e10, 3e18
# hertz, corresponds to 1 ångström to 1e8 ångström
# while the sun's spectrum peak at 5000 ångström
global Rsun
Rsun = 6.955e8 # meter
def BBS(mu, tempe):
i = 2.*h/(c**2.) * (mu**3.) / (np.exp(h/k*mu/tempe)-1.)
return i
def Teff2Lbol(Teff):
I = quad(BBS, mu_min, mu_max, args=(Teff,))[0]
return I
def main():
T = 5800 # Kelvin
Lbol = Teff2Lbol(T) * (4*np.pi*Rsun**2.)
【问题讨论】:
-
如果你做
h = 6.62607e-34这样的事情可能会更干净 -
@BrianFunt 就像你说的那样。
-
这是我在 Stack Overflow 中见过的最好的标题
-
您能告诉我们您使用过哪些模块吗?顺便说一句,6.2607e-34 等中的 34 之后不应有任何小数点。此外,在 Python 中为变量赋值之前,无需声明变量。