Solution (source code)

= Solution

The <cosmological continuity equation> and $P_i=w_i\rho_i$ give
$$
\frac{d\rho_i}{da}+\frac{3(1+w_i)}a\rho_i=0,
\qquad
\rho_i(a)=\rho_{i,0}a^{-3(1+w_i)}.
$$
With $a_0=1$, $1+z=a^{-1}$ and
$$
\Omega_{i,0}=\frac{\rho_{i,0}}{\rho_{\rm crit,0}},
\qquad
\rho_{\rm crit,0}=\frac{3H_0^2}{8\pi G},
$$
the <Friedmann equation> becomes
$$
H(z)=H_0E(z),
\qquad
E(z)=\left[\sum_i\Omega_{i,0}(1+z)^{3(1+w_i)}\right]^{1/2}.
$$
Spatial curvature may be included as an effective component with $w=-1/3$ and $\Omega_{k,0}=-k/H_0^2$.