Created
April 26, 2011 16:10
-
-
Save Telltak/942555 to your computer and use it in GitHub Desktop.
Based on Rossmo's formula (http://en.wikipedia.org/wiki/Rossmo's_formula)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import math | |
crimes=[(5,4), (6,3), (5,3), (7,3)] | |
phi=5 | |
f, g= 2, 2 | |
b=3 | |
a=0 | |
for j in range(10): | |
for i in range(10): | |
for crime in crimes: | |
equation= 0 | |
distance= (i-crime[0])+(j-crime[1]) | |
equation+= (phi/math.pow(distance, f)) | |
numerator= (1-phi)*math.pow(b, 8-f) | |
denominator= math.pow(2*b-distance, g) | |
equation+= (numerator/denominator) | |
a+=equation | |
print(i,',', j,': ', a) | |
a=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created a more elaborated analysis over here