g(y) -> g in compute_density

g was already in terms of y