Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from pylab import *
hiv_infections = 29418
gun_homicides = 11078
gun_suicides = 19392
gun_deaths = gun_homicides + gun_suicides
hiv_qualys = array([22.9, 31.9])
hiv_qualys_discounted = array([9.34, 13.18])
gun_qualys = array([49, 59])
gun_qualys_discounted = array([sum(pow(0.97, arange(0,49))), sum(pow(0.97, arange(0,49)))])
print "Gun qualy cost: " + str(gun_deaths * gun_qualys)
print "Gun qualy cost (discounted): " + str(gun_deaths * gun_qualys_discounted)
print "HIV qualy cost: " + str(hiv_infections * hiv_qualys)
print "HIV qualy cost (discounted): " + str(hiv_infections * hiv_qualys_discounted)
guns_in_existence = 300e6
guns_per_year = 11e6*array([0.25, 1.0])
print "Yearly cost per gun: " + str((gun_deaths * gun_qualys) / guns_in_existence)
print "Yearly cost per gun (discounted): " + str((gun_deaths * gun_qualys_discounted) / guns_in_existence)
print "Yearly cost per gun purchase: " + str([(gun_deaths * gun_qualys[0]) / guns_per_year[1], (gun_deaths * gun_qualys[1]) / guns_per_year[0]])
print "Yearly cost per gun purchase (discounted): " + str([(gun_deaths * gun_qualys_discounted[0]) / guns_per_year[1], (gun_deaths * gun_qualys_discounted[1]) / guns_per_year[0]])
num_gays = array([3.84e6, 7.68e6])
num_celibate = array([0.25, 1.0])
num_gays_having_sex = num_gays * num_celibate
print "Cost per year of gay sex: " + str([(hiv_infections * hiv_qualys[0]) / num_gays_having_sex[1], (hiv_infections * hiv_qualys[1]) / num_gays_having_sex[0]])
print "Cost per year of gay sex (discounted): " + str([(hiv_infections * hiv_qualys_discounted[0]) / num_gays_having_sex[1], (hiv_infections * hiv_qualys_discounted[1]) / num_gays_having_sex[0]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment