density func(not finished yet)