# Comoving Volume Calculation

Suppose I have data from an astronomical survey at redshifts in the range $$z = [2,3]$$. Suppose that, on average in this range, the data covers an area on the sky of $$A=1$$ $$\mathrm{Mpc}^2$$. How would I calculate the comoving volume covered by the survey? Is it as simple as calculating the comoving distance from $$z=2$$ to $$z=3$$ and multiplying by the average area? That is: $$V_C = A(D_C(3)-D_C(2))$$?

The reason is that the angle $$\theta$$ spanned by a length $$L = 1\,\mathrm{Mpc}$$ depends on the distance $$d$$ of that length — in comoving coordinates, $$\theta$$ keeps decreasing with $$d$$, just like a normal item, say a bicycle, looks smaller the farther away it is (curiously, in physical coordinates, this is not the case. Due to the finite speed of light and the expansion of the Universe, galaxies only look smaller out a certain distance, after which they start to look larger).

An $$(L = 1\,\mathrm{Mpc})^2$$ square spans $$\theta_2 = 39''$$ at a redshift of $$z=2$$, and $$\theta_3 = 32''$$ at $$z=3$$. The comoving distances are $$d_2 = 5.3\,\mathrm{Gpc}$$ and $$d_3 = 6.5\,\mathrm{Gpc}$$, respectively.

So yes, roughly you can say that the comoving volume of an $$A = 1\,\mathrm{Mpc}^2$$ square between $$z=2$$ and $$z=3$$ is $$V = A(d_3-d_2)$$. But read on.

### The calculation

You mention a survey, so I assume you're not actually given an area, but a field of view (FOV). The problem is the same, just the other way; your FOV doesn't cover the same area at different redshifts.

So, here's the rigorous way to calculate it:

Let's say your FOV spans a solid angle $$\Omega=\theta_\mathrm{RA}\times\theta_\mathrm{dec}$$, which measured in radians comprises a fraction $$\Omega/4\pi$$ of the whole sphere. The total, comoving volume to a comoving distance $$d$$ is just $$V = 4\pi d^3/3$$, so the volume of the shell between $$z=2$$ and $$z=3$$ is $$V_\mathrm{2\rightarrow3} = V_3 - V_2 = \frac{4\pi}{3} \big(d_3^3 - d_2^3\big).$$

The comoving volume spanned by your FOV is thus $$V = \frac{\Omega}{4\pi} V_\mathrm{2\rightarrow3},$$ or $$V = \frac{\Omega}{3} \big(d_3^3 - d_2^3\big).$$

### The error

The difference between the two approaches increases with the difference between the two redshifts. With a FOV of, say, $$\Omega = (\theta=32'')^2 = 1024\,\mathrm{arcsec}^2=2.4\times10^{-8}\,\mathrm{sr}$$, if you say that it spans an area of $$A = 1\,\mathrm{Mpc}^2$$ (which is only correct at $$z=3$$), you'll get $$V_\mathrm{approx.} = 1\,\mathrm{Mpc}^2 \times (6508 - 5312)\,\mathrm{Mpc} = 1198\,\mathrm{Mpc}^3,$$ whereas with the correct formula you get $$V_\mathrm{true} = \frac{2.4\times10^{-8}}{3} \left( 6508^3 - 5312^3\right)\,\mathrm{Mpc}^3 = 1011\,\mathrm{Mpc}^3,$$ that is, 16% percent lower.

If, on the other hand, your FOV is $$\Omega = (\mathbf{39}'')^2$$, and if you say that it spans an area of $$A = 1\,\mathrm{Mpc}^2$$ (which is only correct at $$z=\mathbf{2}$$), then the true volume would be 1500 Mpc, i.e. 25% larger than your ~1200 Mpc.

Since the correct calculation isn't much harder than the approximation, I suggest you stick to the correct one.

### The Python way

With the astropy module, just type

from astropy.cosmology import Planck15
from astropy import units as u
theta_RA  = 32 * u.arcsec
theta_dec = 32 * u.arcsec
Omega     = (theta_RA * theta_dec).to(u.steradian).value # get rid of unit
d2        = Planck15.comoving_distance(2)
d3        = Planck15.comoving_distance(3)
V         = Omega/3 * (d3**3 - d2**3)
print(V)

1011.0148201494444 Mpc3

or

V23  = Planck15.comoving_volume(3) - Planck15.comoving_volume(2)
V    = Omega/(4*pi) * V23

which gives the same result.

• +1 for great explanation and showing the coding option! Jun 16 at 14:09
• Thanks for the detailed explanation! Jun 16 at 15:42
• @Framazu You're welcome :)
– pela
Jun 16 at 19:33