Feb-08-2019, 07:49 PM
Here is the entire program:
import math h = float(input("What is the value of H0 (in km/s/Mpc)?")) j = float(input("what is the value of the matter density parameter?")) cs = input("Do you want a flat or open cosmology (1 = flat, 0 = open)?") ran = input("Do you want a range of readshifts (min, max, increment), or a list (type range, list, o$ if ran == "range": i = float(input("What is the minimum z value?")) k = float(input("What is the maximum z value?")) u = float(input("By what increment?")) z = i data = [z] while i < k: data.append(i) z += u def eta(a, omega): s = ((1- omega)/omega)**(1/3) return 2*math.sqrt(s**3 + 1)*(1/(a**4) - 0.01540*s/(a**3) + 0.4304*(s**2)/(a**2)\ + 0.19097*(s**3)/a +0.066942*s**4)**(-1/8) c = 3e8 q = (j/2) d1 = (1/(1 + z))*(c/h)*(eta(1, j) - eta(1/(1 +z), j)) d1 = d1*(math.pi/180)*(1/3600) d2 = (c/(h*q**2))*(((z*q) +(q - 1)*(math.sqrt(2*z*q + 1) - 1))/((1 + z)**2)) d2 = d2*(math.pi/180)*(1/3600) if cs == "1": print(d1) else: print(d2)