Added density func

Added density function
Added density test

Added density test