Skip to content

Instantly share code, notes, and snippets.

@jacqueline-homan
Forked from Telltak/rossmo.py
Created March 5, 2016 02:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacqueline-homan/09f654cabe501839df31 to your computer and use it in GitHub Desktop.
Save jacqueline-homan/09f654cabe501839df31 to your computer and use it in GitHub Desktop.
Based on Rossmo's formula (http://en.wikipedia.org/wiki/Rossmo's_formula)
#!/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