Created
January 2, 2011 16:45
-
-
Save stucchio/762637 to your computer and use it in GitHub Desktop.
Inanity of Overeating - graphs
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/local/bin/python | |
from pylab import * | |
def bmr(height, weight, age): | |
"""Height in inches, weight in pounds, age in years. | |
Computes base metabolic rate for Harris Benedict Equation. | |
""" | |
return 66 + 6.23*weight + 12.7*height - 6.8 *age | |
#Activity levels | |
## If you are sedentary (little or no exercise) : Calorie-Calculation = BMR x 1.2 | |
## If you are lightly active (light exercise/sports 1-3 days/week) : Calorie-Calculation = BMR x 1.375 | |
## If you are moderatetely active (moderate exercise/sports 3-5 days/week) : Calorie-Calculation = BMR x 1.55 | |
## If you are very active (hard exercise/sports 6-7 days a week) : Calorie-Calculation = BMR x 1.725 | |
## If you are extra active (very hard exercise/sports & physical job or 2x training) : Calorie-Calculation = BMR x 1.9 | |
def calories(height, weight, age): | |
"""This is the calories necessary for a person to maintain their weight.""" | |
return 1.375*bmr(height, weight, age) | |
t = arange(0,20,0.1) #Time | |
HEIGHT=72 | |
WEIGHT=165 #The "ideal weight" of a 6' tall person. | |
ax = subplot(111) | |
plot(t, calories(HEIGHT, WEIGHT,30+t), label="Maintainer") | |
plot(t, calories(HEIGHT, WEIGHT+2*t,30+t)+20, label="Gainer") | |
plot(t, calories(HEIGHT, WEIGHT+2*t,30+t), label="Rest rate of Gainer") | |
print calories(HEIGHT, WEIGHT+40, 50) - calories(HEIGHT, WEIGHT, 50) | |
xlabel("Years past age 30") | |
ylabel("Calories/day") | |
legend(loc=3) | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment