Click Distance_funct_2.pdf link to view the file.