import math


def dcomdisdz(z, OmegaM, OmegaL):
    """
    This function calculates the differential line-of-sight comoving
    distance dD_c/dz as a function of z, Omega_M and Omega_L in a
    matter-dominated universe.  H0=c=1.
    """
    return (1.0 / math.sqrt((1.0 + z) * (1.0 + z) * (1.0 + OmegaM * z) - z * (2.0 + z) * OmegaL))