import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
#For Seaborn plots
import seaborn as sns; sns.set(style='white')
#To ignore warning
import warnings
warnings.filterwarnings('ignore')
# More sharp and legible graphics
%config InlineBackend.figure_format = 'retina'
def f(m):
return m**0.75
def q(m):
return 2*m+1
xlist = np.linspace(2, 100, 50 )
ylist = f(xlist)
llist = q(xlist)
df = pd.DataFrame(list(zip(xlist, ylist, llist)),
columns = ['mass', 'f(x)=m^3/4: sublinear', 'f(x)=2m+1: linear'])
df.head()
plt.figure(figsize=(4, 3))
plt.plot(xlist, ylist, 'r', label='f(x)=m^3/4: sublinear')
plt.plot(xlist, llist, 'g', label='f(x)=2m+1: linear')
plt.legend(loc="best")
#plt.figure(figsize=(1, 1))
plt.xlabel('Body mass')
plt.ylabel('Metabolic rate')
plt.title('Dummy kleiber law data plot')
#plt.grid(True)
plt.show()
xlist = [1, 10, 50, 100]
ylist = [100, 80, 50, 45.273]
df = pd.DataFrame(list(zip(xlist, ylist)),
columns = ['Number of goat', 'Cost per one goat'])
df
plt.figure(figsize=(4, 3))
plt.plot(xlist, ylist)
plt.scatter(xlist, ylist, c='b')
plt.legend(loc="best")
#plt.figure(figsize=(1, 1))
plt.xlabel('Number of goat')
plt.ylabel('Cost per one goat')
plt.title('Economics of Scale for our Goat Farm')
#plt.grid(True)
plt.show()
def g(t):
return 1/((t+1)**-0.2)
def h(t):
return 1/((t+1)**1)
xlist = np.linspace(0, 100, 50 )
ylist = g(xlist)
llist = h(xlist)
plt.figure(figsize=(4, 3))
plt.plot(xlist, ylist, label="diminishing return function")
plt.plot(xlist, llist, label="subsistence line")
plt.legend(loc="best")
plt.xlabel('Labor number')
plt.ylabel('Productivity')
plt.title('Malthus')
plt.show()