Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
jstac committed Mar 1, 2015
1 parent e625d8e commit 2a155aa
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 1 deletion.
17 changes: 17 additions & 0 deletions examples/consumer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Consumer:

def __init__(self, w):
"Initialize consumer with w dollars of wealth"
self.wealth = w

def earn(self, y):
"The consumer earns y dollars"
self.wealth += y

def spend(self, x):
"The consumer spends x dollars if feasible"
new_wealth = self.wealth - x
if new_wealth < 0:
print("Insufficent funds")
else:
self.wealth = new_wealth
55 changes: 55 additions & 0 deletions examples/solow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from __future__ import division # Omit for Python 3.x
import numpy as np

class Solow:
"""
Implements the Solow growth model with update rule
.. math::
k_{t+1} = \frac{s z k^{\alpha}_t}{1 + n} + k_t \frac{1 + d}{1 + n}
"""

def __init__(self, n, s, d, alpha, z, k):
""" Solow growth model with Cobb Douglas production function.
Parameters
----------
n : scalar
population growth rate
s : scalar
savings rate
d : scalar
depreciation rate
alpha : scalar
capital's share of income
z : scalar
productivity parameter
k : scalar
current capital stock
"""
self.n, self.s, self.d, self.alpha, self.z = n, s, d, alpha, z
self.k = k


def h(self,x):
"Evaluate the h function"
temp = self.s * self.z * self.k**self.alpha + self.k * (1 - self.d)
return temp / (1 + self.n)

def update(self):
"Update the current state (i.e., the capital stock)."
self.k = self.h(self.k)

def steady_state(self):
"Compute the steady state value of capital."
return ((self.s * self.z) / (self.n + self.d))**(1 / (1 - self.alpha))

def generate_sequence(self, t):
"Generate and return a time series of length t"
path = []
for i in range(t):
path.append(self.k)
self.update()
return path

62 changes: 62 additions & 0 deletions quantecon.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Metadata-Version: 1.1
Name: quantecon
Version: 0.1.7-2
Summary: QuantEcon is a package to support all forms of quantitative economic modelling.
Home-page: https://github.com/QuantEcon/QuantEcon.py
Author: Thomas J. Sargent and John Stachurski (Project coordinators)
Author-email: john.stachurski@gmail.com
License: BSD
Description:
**QuantEcon** is an organization run by economists for economists with the aim of coordinating
distributed development of high quality open source code for all forms of quantitative economic modelling.

The project website is located at `http://quantecon.org/ <http://quantecon.org/>`_. This website provides
more information with regards to the **quantecon** library, documentation, in addition to some resources
in regards to how you can use and/or contribute to the package.

The **quantecon** Package
-------------------------

The `repository <https://github.com/QuantEcon/QuantEcon.py>`_ includes the Python package ``quantecon``

Assuming you have `pip <https://pypi.python.org/pypi/pip>`_ on your computer --- as will be the case if you've `installed Anaconda <http://quant-econ.net/getting_started.html#installing-anaconda>`_ --- you can install the latest stable release of ``quantecon`` by typing

pip install quantecon

at a terminal prompt

Repository
----------

The main repository is hosted on Github `QuantEcon.py <https://github.com/QuantEcon/QuantEcon.py>`_

**Note:** There is also a Julia version available for Julia users `QuantEcon.jl <https://github.com/QuantEcon/QuantEcon.jl>`_

Current Build and Coverage Status
---------------------------------

|Build Status| |Coverage Status|

.. |Build Status| image:: https://travis-ci.org/QuantEcon/QuantEcon.py.svg?branch=master
:target: https://travis-ci.org/QuantEcon/QuantEcon.py
.. |Coverage Status| image:: https://coveralls.io/repos/QuantEcon/QuantEcon.py/badge.png
:target: https://coveralls.io/r/QuantEcon/QuantEcon.py

Additional Links
----------------

1. `QuantEcon Course Website <http://quant-econ.net>`_


Keywords: quantitative,economics
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Scientific/Engineering
65 changes: 65 additions & 0 deletions quantecon.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
setup.cfg
quantecon/__init__.py
quantecon/arma.py
quantecon/cartesian.py
quantecon/ce_util.py
quantecon/compute_fp.py
quantecon/discrete_rv.py
quantecon/distributions.py
quantecon/ecdf.py
quantecon/estspec.py
quantecon/graph_tools.py
quantecon/gth_solve.py
quantecon/ivp.py
quantecon/kalman.py
quantecon/lae.py
quantecon/lqcontrol.py
quantecon/lqnash.py
quantecon/lss.py
quantecon/matrix_eqn.py
quantecon/mc_tools.py
quantecon/quad.py
quantecon/quadsums.py
quantecon/rank_nullspace.py
quantecon/robustlq.py
quantecon/tauchen.py
quantecon/timing.py
quantecon/version.py
quantecon.egg-info/PKG-INFO
quantecon.egg-info/SOURCES.txt
quantecon.egg-info/dependency_links.txt
quantecon.egg-info/top_level.txt
quantecon/models/__init__.py
quantecon/models/asset_pricing.py
quantecon/models/career.py
quantecon/models/ifp.py
quantecon/models/jv.py
quantecon/models/lucastree.py
quantecon/models/odu.py
quantecon/models/optgrowth.py
quantecon/tests/__init__.py
quantecon/tests/test_arma.py
quantecon/tests/test_cartesian.py
quantecon/tests/test_compute_fp.py
quantecon/tests/test_discrete_rv.py
quantecon/tests/test_ecdf.py
quantecon/tests/test_estspec.py
quantecon/tests/test_graph_tools.py
quantecon/tests/test_gth_solve.py
quantecon/tests/test_ivp.py
quantecon/tests/test_kalman.py
quantecon/tests/test_lae.py
quantecon/tests/test_lqcontrol.py
quantecon/tests/test_lqnash.py
quantecon/tests/test_lss.py
quantecon/tests/test_lyapunov.py
quantecon/tests/test_matrix_eqn.py
quantecon/tests/test_mc_tools.py
quantecon/tests/test_quad.py
quantecon/tests/test_quadsum.py
quantecon/tests/test_rank_nullspace.py
quantecon/tests/test_ricatti.py
quantecon/tests/test_robustlq.py
quantecon/tests/test_tauchen.py
quantecon/tests/test_timing.py
quantecon/tests/util.py
1 change: 1 addition & 0 deletions quantecon.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions quantecon.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
quantecon
2 changes: 1 addition & 1 deletion quantecon/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"JvWorker", "LucasTree", "SearchProblem", "GrowthModel",
"solow"]

#from . import solow as solow
from . import solow as solow
from .asset_pricing import AssetPrices
from .career import CareerWorkerProblem
from .ifp import ConsumerProblem
Expand Down

0 comments on commit 2a155aa

Please sign in to comment.