def maximal_age(z):
z = np.double(z)
#Cosmological Constants
O_m = 0.266
O_r = 0.
O_k= 0.
O_L = 1. - O_m
H_0 = 74.3 #km/s/Mpc
H_sec = H_0 / 3.0857e19
secondsinyear = 31556926
ageoftheuniverse = 13.798e9
# Equation for the time elapsed since z and now
a = 1/(1+z)
E = O_m * (1+z)**3 + O_r *(1+z)**4 + O_k *(1+z) + O_L
integrand = lambda z : 1 / (1+z) / sqrt( O_m * (1+z)**3 + O_r *(1+z)**4 + O_k *(1+z) + O_L )
#Integration
z_obs = z
z_cmb = 1089 #As Beta (not cmb). But 1089 (cmb) would be the exagerated maximun possible redshift for the birth
z_now = 0
integral, error = quad( integrand , z_obs, z_cmb) #
#t = ageoftheuniverse - (integral * (1 / H_sec) / secondsinyear)
t = (integral * (1 / H_sec)) / secondsinyear
return t
评论列表
文章目录