compute_density function

Approximate density based on another vector