density.py
more code
math behind the code.