Latest revision |
Your text |
Line 17: |
Line 17: |
| | | |
| <tt><pre><nowiki> | | <tt><pre><nowiki> |
− | from scipy.special import hyp2f1 # hypergeometric function 2F1 is in integral solution | + | from scipy.integrate import quad |
| from numpy import format_float_positional | | from numpy import format_float_positional |
| | | |
| # Cosmological parameters from the Fortran params.f90 header | | # Cosmological parameters from the Fortran params.f90 header |
− | #H0 = 67.15 # Hubble constant in km/s/Mpc (or, 73.5: the "crisis in cosmology") | + | #H0 = 67.15 # Hubble parameter in km/s/Mpc (or, 73.5: the "crisis in cosmology") |
| H0 = 69.32 # from Explainxkcd for 2853: Redshift; seems a consensus compromise | | H0 = 69.32 # from Explainxkcd for 2853: Redshift; seems a consensus compromise |
− | #OL = 0.683 # Cosmological constant for dark energy density, Omega_Lambda or _vac
| + | OL = 0.683 # Density parameter for dark energy |
− | #Om = 0.317 # Density parameter for matter, Omega_mass
| + | Om = 0.317 # Density parameter for matter |
− | Om = 0.286 # From https://arxiv.org/pdf/1406.1718.pdf page 8
| |
− | OL = 1.0 - Om - 0.4165/(H0**2) # flat curvature, from https://www.astro.ucla.edu/~wright/CC.python
| |
− | # (on https://www.astro.ucla.edu/~wright/CosmoCalc.html which see)
| |
− | #print(f"{OL=:.3F}") # 0.714
| |
| | | |
− | # Age of universe at redshift z as a closed-form solution to its integral definition, | + | # Define the integrand function |
− | def age_at_z(z): # ...which is 27 times faster than the original numeric integration | + | def agef(z): |
− | hypergeom = hyp2f1(0.5, 0.5, 1.5, -OL / (Om * (z + 1)**3)) | + | return 1 / ((1 + z) * ((OL + Om * (1 + z)**3)**0.5)) |
− | return (2/3) * hypergeom / (Om**0.5 * (z + 1)**1.5) * (977.8 / H0) # 977.8 for Gyr
| + | |
| + | # Function to calculate the age of the universe at redshift z in Gyr |
| + | def age_z(z): |
| + | integral, _ = quad(agef, z, 1000) |
| + | return integral * 977.8 / H0 |
| | | |
| # Current age of the universe at redshift 0 in Gyr | | # Current age of the universe at redshift 0 in Gyr |
− | age0 = age_at_z(0) # 13.78 | + | age0 = age_z(0) |
| | | |
| # Function to calculate the look-back time at redshift z in Gyr | | # Function to calculate the look-back time at redshift z in Gyr |
− | def zt(z): # from the function name in the Fortran cosmonom.f90 code | + | def zt(z): |
− | return age0 - age_at_z(z) | + | return age0 - age_z(z) |
| | | |
| # For z = 0.00000000038 | | # For z = 0.00000000038 |
Line 62: |
Line 62: |
| </nowiki></pre></tt> | | </nowiki></pre></tt> |
| | | |
− | And should you wish to make [https://i.ibb.co/LpdYXNx/time-by-redshift.png this quick reference chart for interpreting observations in the JWST era:] | + | And should you wish to make [https://i.ibb.co/MnSGrc7/time-by-redshift-new.png this quick reference chart for interpreting observations in the JWST era:] |
| | | |
− | {{cot|Supplemental code for Look-back Time by Redshift chart}}
| |
| <tt><pre><nowiki> | | <tt><pre><nowiki> |
| import matplotlib.pyplot as plt | | import matplotlib.pyplot as plt |
− | import matplotlib.ticker as ticker
| |
| | | |
− | rs = [z * 20 / 299 for z in range(300)] # redshifts 0 to 20 in 300 steps
| + | redshifts = [z * 20 / 299 for z in range(300)] # 300 steps, 0 to 20 |
− | lb = [zt(z) for z in rs] # look_back_times
| + | look_back_times = [zt(z) for z in redshifts] |
− | | |
− | fo = 13.2 # furthest observation at present
| |
− | #print(age_at_z(fo)) # 0.3285
| |
− | plt.plot([x for x in rs if x<fo], [y for x,y in zip(rs,lb) if x<fo], color='red')
| |
− | plt.plot([x for x in rs if x>fo], [y for x,y in zip(rs,lb) if x>fo], color='darkred')
| |
− | plt.text(13.2, 9.5, 'Furthest observation as of 2023:\n' +
| |
− | 'the metal-poor JADES-GS-z13-0 galaxy\nat z=13.2: 13.4 Gyr ago', ha='center')
| |
| | | |
| + | plt.plot(redshifts, look_back_times) |
| plt.title('Look-back Time by Redshift') | | plt.title('Look-back Time by Redshift') |
− | plt.xlabel('z: (observed λ - expected λ) / expected λ') | + | plt.xlabel('z') |
| plt.ylabel('Billion Years Ago') | | plt.ylabel('Billion Years Ago') |
| plt.xticks(range(21)) | | plt.xticks(range(21)) |
− | plt.yticks(list(range(14)) + [age0]) | + | plt.yticks(range(15)) |
− | plt.text(-0.5, 13.78, "Big Bang", va='center')
| |
− | plt.gca().yaxis.set_major_formatter(ticker.FormatStrFormatter('%.1f'))
| |
| plt.grid(True, color='lightgray') | | plt.grid(True, color='lightgray') |
− | plt.gca().spines['right'].set_visible(False)
| |
− | plt.gca().spines['top'].set_visible(False)
| |
| | | |
− | for t in range(0, 13): | + | for t in range(0,13): |
− | z = rs[min(range(len(lb)), key=lambda i: abs(lb[i]-t))] | + | z = redshifts[min(range(len(look_back_times)), |
− | plt.text(z, t, f" z = {z:.2f}", ha='left', va='center', fontsize='small') | + | key=lambda i: abs(look_back_times[i]-t))] |
| + | plt.text(z, t, f" z = {z:.2f}", ha='left', va='center') |
| | | |
− | for z in range(7, 20, 2): | + | for z in range(6,21,2): |
| t = zt(z) | | t = zt(z) |
− | plt.text(z, t - 0.2, f"{t:.2f}", ha='center', va='top', fontsize='small') | + | plt.text(z, t, f"{t:.2f}", ha='center', va='bottom') |
| | | |
− | for z in range(6, 21, 2):
| + | plt.savefig('time_by_redshift_new.png', bbox_inches='tight') |
− | t = zt(z)
| |
− | plt.text(z, t + 0.1, f"{t:.2f}", ha='center', va='bottom', fontsize='small')
| |
− | | |
− | plt.savefig('time_by_redshift.png', bbox_inches='tight') | |
− | #plt.show() # https://i.ibb.co/LpdYXNx/time-by-redshift.png
| |
| </nowiki></pre></tt> | | </nowiki></pre></tt> |
− | {{cob}}
| |
− |
| |
− | Or [https://i.ibb.co/C537rxJ/age-by-redshift.png this one showing the age of the universe from redshift:]
| |
− |
| |
− | {{cot|Supplemental code for Age of Universe by Redshift chart}}
| |
− | <tt><pre><nowiki>
| |
− | plt.clf() # Reset plot
| |
− |
| |
− | rs = [z * 15 / 299 + 5 for z in range(300)] # redshifts 5 to 20 in 300 steps
| |
− | ages = [age_at_z(z) * 1000 for z in rs] # Gyr to million years
| |
− |
| |
− | plt.plot([x for x in rs if x<fo], [y for x,y in zip(rs,ages) if x<fo], color='red')
| |
− | plt.plot([x for x in rs if x>fo], [y for x,y in zip(rs,ages) if x>fo], color='darkred')
| |
− | plt.text(13.2, 650, 'Furthest observation as of 2023:\n' +
| |
− | 'the metal-poor JADES-GS-z13-0 galaxy\nat z=13.2: age 329 Myr', ha='center')
| |
− |
| |
− | plt.title('Age of Universe by Redshift')
| |
− | plt.xlabel('z: (observed λ - expected λ) / expected λ')
| |
− | plt.ylabel('Million Years')
| |
− | plt.xticks(range(5, 21))
| |
− | plt.yticks(range(0, 1300, 100))
| |
− | plt.grid(True, color='lightgray')
| |
− | plt.gca().spines['right'].set_visible(False)
| |
− | plt.gca().spines['top'].set_visible(False)
| |
− |
| |
− | plt.savefig('age_by_redshift.png', bbox_inches='tight')
| |
− | #plt.show() # https://i.ibb.co/C537rxJ/age-by-redshift.png
| |
− | </nowiki></pre></tt>
| |
− | {{cob}}
| |
− |
| |
− | P.S. Some commentary from ChatGPT-4 about the special Gaussian {{w|hypergeometric function}} <tt>hyp2f1</tt> in the [[:File:LookBackFromRedshiftEqns.png|closed-form solution of the integral:]]
| |
− |
| |
− | <blockquote>
| |
− | The appearance of the hypergeometric function 2F1 in the solution for the age of the universe as a function of redshift is a profound example of the interconnectedness of mathematical functions and physical phenomena. The hypergeometric function, which encompasses a vast family of functions, can describe a wide range of behaviors and has properties that make it particularly suited to representing solutions to differential equations that arise in physics.
| |
− |
| |
− | In the context of cosmology, the use of 2F1 in calculating the age of the universe from redshift is not just a mathematical convenience but rather a reflection of the underlying physics. The Friedman equations, which govern the expansion of the universe, are derived from General Relativity and lead to solutions involving integrals that can express the evolution of the universe's scale factor over time. When these integrals are solved, they often involve special functions like 2F1, which encode information about the geometry of the universe and the relative contributions of matter, radiation, and dark energy.
| |
− |
| |
− | The presence of 2F1 in this solution indicates that the relationship between the age of the universe and redshift is non-linear and depends on the integral of a function that encapsulates the dynamics of cosmic expansion. It's also worth noting that special functions like 2F1 often have interesting properties, such as symmetry and recurrence relations, which sometimes allow physicists to gain insights into the behavior of the universe under different conditions or scales.
| |
− |
| |
− | Furthermore, solutions involving 2F1 are not merely academic exercises; they can be compared with observational data, such as measurements of the cosmic microwave background radiation, distributions of galaxies, or supernovae light curves. These comparisons can test the validity of our cosmological models and potentially offer new insights into the nature of dark energy and dark matter, the curvature of the universe, and other fundamental questions in cosmology.
| |
− |
| |
− | In summary, the use of 2F1 in the closed-form solution for the age of the universe from redshift is a powerful reminder that mathematics provides us with the tools to decode the cosmos, offering deeper understanding and raising new questions about the fundamental structure and evolution of the universe.
| |
− | </blockquote>
| |
− | [[User:Liv2splain|Liv2splain]] ([[User talk:Liv2splain|talk]]) 19:25, 14 November 2023 (UTC)
| |
| | | |
− | A further simplification: hyp2f1(0.5, 0.5, 1.5, z**2) = arcsin(z) / z
| + | [[Special:Contributions/172.69.22.12|172.69.22.12]] 08:50, 12 November 2023 (UTC) |