Skip to content

DiscreteDP: further fix in docstring #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions quantecon/markov/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
\Delta(S)`, where :math:`q(s'|s, a)` is the probability that the state
in the next period is :math:`s'` when the current state is :math:`s`
and the action chosen is :math:`a`; and
* discount factor :math:`\beta \in [0, 1)`.
* discount factor :math:`0 \leq \beta < 1`.

For a policy function :math:`\sigma`, let :math:`r_{\sigma}` and
:math:`Q_{\sigma}` be the reward vector and the transition probability
matrix for :math:`\sigma`, which are defined by :math:`r_{\sigma}(s) =
r(s, \sigma(s))` and :math:`Q_{\sigma}(s, s') = q(s'|s, \sigma(s))`,
respectively. The policy value function :math:`v_{\sigma}` for
:math`\sigma` is defined by
:math:`\sigma` is defined by

..math::
.. math::

v_{\sigma}(s) = \sum_{t=0}^{\infty}
\beta^t (Q_{\sigma}^t r_{\sigma})(s)
Expand All @@ -45,23 +45,23 @@

The *Bellman equation* is written as

..math::
.. math::

v(s) = \max_{a \in A(s)} r(s, a)
+ \beta \sum_{s' \in S} q(s'|s, a) v(s') \quad (s \in S).

The *Bellman operator* :math:`T` is defined by the right hand side of
the Bellman equation:

..math::
.. math::

(T v)(s) = \max_{a \in A(s)} r(s, a)
+ \beta \sum_{s' \in S} q(s'|s, a) v(s') \quad (s \in S).

For a policy function :math:`\sigma`, the operator :math:`T_{\sigma}` is
defined by

..math::
.. math::

(T_{\sigma} v)(s) = r(s, \sigma(s))
+ \beta \sum_{s' \in S} q(s'|s, \sigma(s)) v(s')
Expand Down Expand Up @@ -117,7 +117,7 @@


class DiscreteDP(object):
"""
r"""
Class for dealing with a discrete dynamic program.

There are two ways to represent the data for instantiating a
Expand Down Expand Up @@ -165,7 +165,7 @@ class DiscreteDP(object):
Transition probability array.

beta : scalar(float)
Discount factor. Must be in [0, 1).
Discount factor. Must be 0 <= beta < 1.

s_indices : array_like(int, ndim=1), optional(default=None)
Array containing the indices of the states.
Expand Down Expand Up @@ -297,7 +297,7 @@ def __init__(self, R, Q, beta, s_indices=None, a_indices=None):
raise ValueError('R must be 1- or 2-dimensional')

msg_dimension = 'dimensions of R and Q must be either 1 and 2, ' \
'of 2 and 3'
'or 2 and 3'
msg_shape = 'shapes of R and Q must be either (n, m) and (n, m, n), ' \
'or (L,) and (L, n)'

Expand Down