Skip to content
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

Fix math rendering in docstrings #315

Merged
merged 17 commits into from
Jul 4, 2017
Merged

Fix math rendering in docstrings #315

merged 17 commits into from
Jul 4, 2017

Conversation

natashawatkins
Copy link
Member

@natashawatkins natashawatkins commented Jul 4, 2017

Sorry about such a large commit (did not expect to fix this much)

A lot of math renderings weren't working either due to:

  • no use of .. math::
  • not using raw string
  • not using '\' for symbols
  • matrices formatted incorrectly

Also

  • ivp.py's class docstring was placed incorrectly
  • I deleted some whitespaces and cleaned up some code/comments
  • there were a couple of errors(?) related to matrix conformability
  • fixed a compilation warning message from approximation.py

Best way to review is probably to make html in quantecon/docs

@natashawatkins natashawatkins changed the title Math rendering Fix math rendering Jul 4, 2017
@natashawatkins natashawatkins changed the title Fix math rendering Fix math rendering in docstrings Jul 4, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.124% when pulling b4c167f on math-rendering into c60251d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.124% when pulling 9a07268 on math-rendering into c60251d on master.

@mmcky
Copy link
Contributor

mmcky commented Jul 4, 2017

I have added this branch to rtd for review: http://quanteconpy.readthedocs.io/en/math-rendering/

@natashawatkins
Copy link
Member Author

natashawatkins commented Jul 4, 2017 via email

Copy link
Contributor

@mmcky mmcky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natashawatkins this is really nice work! I had a few comments for you from my brief review. rtd is also setup for review of this branch now.

@@ -210,15 +234,15 @@ def update(self, y):

def stationary_values(self):
"""
Computes the limit of Sigma_t as t goes to infinity by
solving the associated Riccati equation. Computation is via the
Computes the limit of :math:`\Sigma_t` as t goes to infinity by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should t be inline math?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this - it could be? But maybe unnecessary?


Returns
-------
P : array_like(float)
P is part of the value function representation of
V(x) = xPx + d
:math:`V(x) = x'Px + d`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch with x'

quantecon/lss.py Outdated

given :math:`x_0` = x0

Here :math:`x_t` and :math:`v_t` are both n x 1 and A is n x n.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should A be inline math?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks

y_t = \bar{y} + \rho y_{t-1} + \varepsilon_t
where \varepsilon_t is i.i.d. normal of mean 0, std dev of sigma
:math:`y_t = \bar{y} + \rho y_{t-1} + \varepsilon_t`
where :math:`\varepsilon_t` is i.i.d. normal of mean 0, std dev of sigma
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between \varepsilon and \epsilon?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently they look slightly different but represent the same symbol - https://tex.stackexchange.com/questions/304534/what-does-the-var-prefix-stand-for-in-varphi-and-varepsilon-etc


using Tauchen's method. Here {u_t} is an iid Gaussian process with zero
mean.
using Tauchen's method. Here :math:`{u_t}`` is an iid Gaussian process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this have two end ticks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks


X = A'XA - (N + B'XA)'(B'XB + R)^{-1}(N + B'XA) + Q

via a modified structured doubling algorithm. An explanation of the
algorithm can be found in the reference below.

Note that SciPy also has a discrete riccati equation solver. However it
cannot handle the case where R is not invertible, or when N is nonzero.
Both of these cases can be handled in the algorithm implemented below.
cannot handle the case where :math:`R` is not invertible, or when N is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should N be inline math?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks

@jstac
Copy link
Contributor

jstac commented Jul 4, 2017

@natashawatkins Thanks! Great work. I have checked all details but it's a big step forward even if some errors remain.

@mmcky Is the maintainer of the package so I'll leave the merge up to him.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.124% when pulling 90a77a8 on math-rendering into c60251d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.124% when pulling 90a77a8 on math-rendering into c60251d on master.

@mmcky
Copy link
Contributor

mmcky commented Jul 4, 2017

Thanks @natashawatkins.

@mmcky mmcky merged commit a82ba69 into master Jul 4, 2017
@mmcky mmcky deleted the math-rendering branch July 4, 2017 23:25
Here :math:`x` is n x 1, :math:`u` is k x 1, :math:`w` is j x 1 and the
matrices are conformable for these dimensions. The sequence :math:`{w_t}`
is assumed to be white noise, with zero mean and
:math:`\mathbb{E} [ w_t' w_t ] = I`, the j x j identity.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmcky I think w_t w_t is also not conformable? Could you check please? Thanks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot to click submit review

@oyamad oyamad mentioned this pull request Jul 5, 2017
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants