Python program used to simulate the nonrenewable resource sector  usrbinenv python  import math from dynamo import    levels nr  nr Nonrenewable resources ic  ic Industrial Captial nrtd  nrtd Nonrenewable resource technology initiated nrufl  nrufl Nonrenewable resource usage rate delay level nrufl  nrufl Nonrenewable resource usage rate delay level nrufl  nrufl Nonrenewable resource usage rate delay level   rates nrur  nrur Nonrenewabel resource usage rate icir  icir Industrial capital investment rate icdr  icdr Industrial capital depreciation rate nrufr  nrufr Nonrenewable resource usage rate delay rate nrufr  nrufr Nonrenewable resource usage rate delay rate nrufr  nrufr Nonrenewable resource usage rate delay rate nrate  nrate Nonrenewable resource technology improvement rate    axillaries nruf  nruf Nonrenewable resource usage factor pcrum  pcrum Per capita resource use multiplier nrfr  nrfr Nonrenewable resource fraction remaining fcaor fcaor Fraction of capital allocated to obtaining resources fcaor  fcaor Normal fcaor fcaor  fcaor Alternative fcaor pop  pop Population pop  pop Exponentially growing pop io  io Industrial output iopc  iopc Industrial output percapita nruf  nruf Nonrenewable resource usage factor after recycle year nrcm  nrcm Resource technological change multiplier icor  icor Industrial capital output ratio   constants nri  e Nonrenewable resources initial nruf   Nonrenewable resource usage factor  popi  e Initial population in  gc   Population growth constant zpgt   Zero population growth time pop  popimathexpgczpgt population at zpgt ici  e Industrial capital initial fioaa   Fraction of industrial output allocated to agriculture fioas   Fraction of industrial output allocated to services fioac   Fraction of industrial output allocated to consumption alic   Average life of industrial capital pyear   Year to switch nruf tdd Technological development and implementation delay dnrure Desired nonrenewable resource usage rate  parameters dt   initialtime    initial data i    Initial levels inr  nri iic  ici inrtd smoothinitinrufinrtd  def calcauxiliariesandratesntime     first the auxiliaries     nnruf  smoothcurvaluennruf     nnruf  clipnnrufnruftimepyear     nnrfr  nnrnri          nfcaor  tablelookupnnrfr               nfcaor  tablelookupnnrfr               nfcaor  clipnfcaornfcaortimepyear      npop  popimathexpgctime     npop  clippopnpoptimezpgt      nicor  tablelookupnnrtd     nio  nic  nfcaornicor     niopc  nionpop          npcrum  tablelookupniopc               then the rates     nnrur  npopnpcrumnnruf     nicir  niofioaafioasfioac     nicdr  nicalic     nnrcm  tablelookupnnrurdnrur     nnrate  clipnnrtdnnrcmtimepyear      smoothnextratesn nruf nnrtd tdd           calcauxiliariesandratesiinitialtime  def getnexttimestepjtime     n       nextize levels     nnr  jnrdtjnrur     nic  jicdtjicirjicdr     nnrtd  jnrtddtjnrate      smoothnextlevelsnjnrufdt          calcauxiliariesandratesntime     return n  runtimesinitialtimedtigetnexttimestep   Dynamo include  import math  def printsortedkeysdictwidth     keys  dictkeys     keyssort     f  strwidths     for key in keys         print f  key     print f  keys  def printsortedvaluesdictwidth     keys  dictkeys