def density(temp):
    """
    Calculating density of water due to given temperature (Eq. 3.11)

    :param temp: temperature prediction Y[d, t] at depth d and time t
    :return: corresponding density prediction
    """
    return 1000 * (1 - ((temp + 288.9414) * (temp - 3.9863) ** 2) / (508929.2 * (temp + 68.12963)))