getDensity is now the function to obtain the normalized density