{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 2018-06-20 Slouching Towards Utopia Chapter 1" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
PopulationGDP_per_CapitaYearIdeas
Date
-48000.00.51000.0-48000.00.544331
-8000.04.0750.0-8000.01.000000
-4000.07.0750.0-4000.01.322876
-2000.027.0750.0-2000.02.598077
-1000.050.0750.0-1000.03.535534
-500.0100.0750.0-500.05.000001
-200.0150.0750.0-200.06.123725
0.0170.0750.00.06.519203
200.0190.0750.0200.06.892025
400.0190.0750.0400.06.892025
600.0200.0750.0600.07.071069
800.0230.0750.0800.07.582877
1000.0265.0750.01000.08.139412
1200.0360.0750.01200.09.486834
1400.0350.0750.01400.09.354145
1500.0425.0750.01500.010.307766
1600.0545.0800.01600.012.859125
1700.0610.0875.01700.015.561633
1750.0720.0930.01750.018.525454
1800.0900.01000.01800.023.094014
1870.01300.01400.01870.045.977135
1900.01625.02000.01900.087.770759
1925.01875.02600.01925.0139.745823
1950.02516.03500.01950.0252.834051
1975.04000.05000.01975.0544.331139
2000.06200.07700.02000.01295.120298
2018.07500.010600.02018.02300.740339
\n", "
" ], "text/plain": [ " Population GDP_per_Capita Year Ideas\n", "Date \n", "-48000.0 0.5 1000.0 -48000.0 0.544331\n", "-8000.0 4.0 750.0 -8000.0 1.000000\n", "-4000.0 7.0 750.0 -4000.0 1.322876\n", "-2000.0 27.0 750.0 -2000.0 2.598077\n", "-1000.0 50.0 750.0 -1000.0 3.535534\n", "-500.0 100.0 750.0 -500.0 5.000001\n", "-200.0 150.0 750.0 -200.0 6.123725\n", " 0.0 170.0 750.0 0.0 6.519203\n", " 200.0 190.0 750.0 200.0 6.892025\n", " 400.0 190.0 750.0 400.0 6.892025\n", " 600.0 200.0 750.0 600.0 7.071069\n", " 800.0 230.0 750.0 800.0 7.582877\n", " 1000.0 265.0 750.0 1000.0 8.139412\n", " 1200.0 360.0 750.0 1200.0 9.486834\n", " 1400.0 350.0 750.0 1400.0 9.354145\n", " 1500.0 425.0 750.0 1500.0 10.307766\n", " 1600.0 545.0 800.0 1600.0 12.859125\n", " 1700.0 610.0 875.0 1700.0 15.561633\n", " 1750.0 720.0 930.0 1750.0 18.525454\n", " 1800.0 900.0 1000.0 1800.0 23.094014\n", " 1870.0 1300.0 1400.0 1870.0 45.977135\n", " 1900.0 1625.0 2000.0 1900.0 87.770759\n", " 1925.0 1875.0 2600.0 1925.0 139.745823\n", " 1950.0 2516.0 3500.0 1950.0 252.834051\n", " 1975.0 4000.0 5000.0 1975.0 544.331139\n", " 2000.0 6200.0 7700.0 2000.0 1295.120298\n", " 2018.0 7500.0 10600.0 2018.0 2300.740339" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# HUMAN POPULATION OVER THE LAST 10000 YEARS\n", "#\n", "# make sure the standard libraries are active\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "from IPython.display import Image\n", "\n", "Population = (\n", " [-48000, 0.5, 1000],\n", " [-8000, 4, 750],\n", " [-4000, 7, 750],\n", " [-2000, 27, 750],\n", " [-1000, 50, 750],\n", " [-500, 100, 750],\n", " [-200, 150, 750],\n", " [0, 170, 750],\n", " [200, 190, 750],\n", " [400, 190, 750],\n", " [600, 200, 750],\n", " [800, 230, 750],\n", " [1000, 265, 750],\n", " [1200, 360, 750],\n", " [1400, 350, 750],\n", " [1500, 425, 750],\n", " [1600, 545, 800],\n", " [1700, 610, 875],\n", " [1750, 720, 930],\n", " [1800, 900, 1000],\n", " [1870, 1300, 1400],\n", " [1900, 1625, 2000],\n", " [1925, 1875, 2600],\n", " [1950, 2516, 3500],\n", " [1975, 4000, 5000],\n", " [2000, 6200, 7700],\n", " [2018, 7500, 10600])\n", "\n", "Population = np.array(Population)\n", "Pop_df = pd.DataFrame(Population)\n", "Pop_df.columns = ['Date', 'Population', 'GDP_per_Capita']\n", "Pop_df['Year'] = 0.0\n", "Pop_df['Ideas'] = 0.0\n", "phi = 2\n", "\n", "for i in range(27):\n", " Pop_df.Year[i] = Pop_df.Date[i]\n", " Pop_df.Ideas[i] = (Pop_df.GDP_per_Capita[i]**((1+phi)/phi) * \n", " Pop_df.Population[i]**(1/phi))/22360.68/1.837117\n", " \n", "Pop_df = Pop_df.set_index('Date')\n", "\n", "Pop_df" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.6329931618554521" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# rate of population growth, -48000 to -8000\n", "\n", "PopCh_m48Ktom8K = (np.log(Pop_df.Population[-8000]/Pop_df.Population[-48000]))\n", "Yrs_m48Ktom8K = Pop_df.Year[-8000] - Pop_df.Year[-48000]\n", "\n", "PopGr_m48Ktom8K = PopCh_m48Ktom8K/Yrs_m48Ktom8K\n", "\n", "IdGr_m48Ktom8K = PopGr_m48Ktom8K/2\n", "\n", "Idm8K=np.exp(IdGr_m48Ktom8K*(Yrs_m48Ktom8K))\n", "\n", "Idm8K" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10.645812948447542" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# rate of population growth, -8000 to 0\n", "\n", "PopCh_m8Kto0 = (np.log(Pop_df.Population[0]/Pop_df.Population[-8000]))\n", "Yrs_m8Kto0 = Pop_df.Year[0] - Pop_df.Year[-8000]\n", "\n", "PopGr_m8Kto0 = PopCh_m8Kto0/Yrs_m8Kto0\n", "\n", "IdGr_m8Kto0 = PopGr_m8Kto0/2\n", "\n", "Id0=np.exp(IdGr_m8Kto0*(Yrs_m8Kto0)) * Idm8K\n", "\n", "Id0" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "16.832508230603466" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# rate of population growth, 0 to 1500\n", "\n", "PopCh_0to1500 = (np.log(Pop_df.Population[1500]/Pop_df.Population[0]))\n", "Yrs_0to1500 = Pop_df.Year[1500] - Pop_df.Year[0]\n", "\n", "PopGr_0to1500 = PopCh_0to1500/Yrs_0to1500\n", "\n", "IdGr_0to1500 = PopGr_0to1500/2\n", "\n", "Id1500=np.exp(IdGr_0to1500*(Yrs_0to1500)) * Id0\n", "\n", "Id1500" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# rate of population growth, 0 to 1500\n", "\n", "PopCh_0to1500 = (np.log(Pop_df.Population[1500]/Pop_df.Population[0]))\n", "Yrs_0to1500 = Pop_df.Year[1500] - Pop_df.Year[0]\n", "\n", "PopGr_0to1500 = PopCh_0to1500/Yrs_0to1500\n", "\n", "IdGr_0to1500 = PopGr_0to1500/2\n", "\n", "Id1500=np.exp(IdGr_0to1500*(Yrs_0to1500)) * Id0\n", "\n", "Id1500" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$ Y = \\omega(EL) $\n", "\n", "$ \\frac{Y}{L} = {\\omega}\\left(H^{\\frac{\\phi}{1+\\phi}}L^{\\frac{-1}{1+\\phi}}\\right) $\n", "\n", "$ ln(Y) - ln(L) = ln(\\omega) + \\left(\\frac{\\phi}{1+\\phi}\\right)ln(H) - \\left(\\frac{1}{1+\\phi}\\right)ln(L) $\n", "\n", "$ ln(H) = \\frac{(1+\\phi)(ln(Y) - ln(L) - ln(\\omega)) + ln(L)}{\\phi} $" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "phi = 2\n", "\n", "\n", "\n", "H = (Pop_df.GDP_per_Capita[-48000]**((1+phi)/phi * \n", " Pop_df.Population[-48000]**(1/phi)))/324602.54554904939\n", "\n", "H" ] }, { "cell_type": "code", "execution_count": 75, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.00022632531962869185" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.log(11.25/1.84)/8000" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.00034586252894344504" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.log(18.9/11.25)/1500" ] }, { "cell_type": "code", "execution_count": 78, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.00984012541373353" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.log(46/23.1)/70" ] }, { "cell_type": "code", "execution_count": 79, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.026432587874514499" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.log(2300/46)/148" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }