/* ---------------------------------------------------------------------------- intcomvol ------------------------------------------------------------------------------- This function calculates the all-sky comoving volume V as a function of z, Omega_M and Omega_L in a matter-dominated universe by integrating dcomvoldz(). It was written to test comvol(). ---------------------------------------------------------------------------- */ double Cosmo::intcomvol(double z) { int nsteps; double dz, zz, V; nsteps = ((int) (z / MINSTEP)) + 1; dz = z / ((double) nsteps); V = 0.0; for(zz = 0.5 * dz; zz < z; zz += dz) V += dz * dcomvoldz(zz); return 4.0 * M_PI * V; }
void Zbin::assign_dist (double c, double H0, double Omega_M, double Omega_L) { //! Calculate the angular diameter distance and the differential comoving //! volume element for a Zbin instance. dvdz = dcomvoldz(z, Omega_M, Omega_L); da = ((c / H0) * angdidis(z, Omega_M, Omega_L)); }