如何使用天体计算宇宙的年龄?
How to calculate the of the age of the universe using astropy?
我想将哈勃常数H0的值换算成Gyr单位,还想通过python计算宇宙年龄t0。我使用的代码如下所示。 H0 的转换看起来不错,但 t0 的值应显示为 13.78,但显示为 0.013。但是如果我对 t0 进行分析计算,那么我很容易找到 13.7。为什么会这样?期待您的帮助。
import numpy as np
Om=0.3
Ol=0.7
H0 = 72 #km/s/Mpc
from astropy.cosmology import WMAP9 as cosmo
from astropy import units
H0 = cosmo.H(0)
H0.value, H0.unit
print H0.to('Gyr**-1')
H0 = H0.value
# inverse sinh (Ol/Om)^0.5 = 1.2099
t0 = (2./(3.*H0*np.sqrt(Ol))) * 1.2099
print t0
下面给出了宇宙的天真年龄(忽略加速度):
from astropy.cosmology import WMAP9 as cosmo
import astropy.units as u
H0 = cosmo.H(0)
t0 = 1.0/H0
t0_Gyr = t0.decompose().to(u.Gyr)
print (t0_Gyr)
<Quantity 14.10548502 Gyr>
我想将哈勃常数H0的值换算成Gyr单位,还想通过python计算宇宙年龄t0。我使用的代码如下所示。 H0 的转换看起来不错,但 t0 的值应显示为 13.78,但显示为 0.013。但是如果我对 t0 进行分析计算,那么我很容易找到 13.7。为什么会这样?期待您的帮助。
import numpy as np
Om=0.3
Ol=0.7
H0 = 72 #km/s/Mpc
from astropy.cosmology import WMAP9 as cosmo
from astropy import units
H0 = cosmo.H(0)
H0.value, H0.unit
print H0.to('Gyr**-1')
H0 = H0.value
# inverse sinh (Ol/Om)^0.5 = 1.2099
t0 = (2./(3.*H0*np.sqrt(Ol))) * 1.2099
print t0
下面给出了宇宙的天真年龄(忽略加速度):
from astropy.cosmology import WMAP9 as cosmo
import astropy.units as u
H0 = cosmo.H(0)
t0 = 1.0/H0
t0_Gyr = t0.decompose().to(u.Gyr)
print (t0_Gyr)
<Quantity 14.10548502 Gyr>