Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

DOC: LQ and LQMarkov docstrings state E[w_t' w_t] = I instead of E[w_t w_t'] = I

Open Beginner friendly
#988 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
92/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
documentation

Research direction

The wrong statement sits in the class docstrings of LQ (quantecon/_lqcontrol.py, around lines 46-49) and LQMarkov (around lines 364-367). docs/source/tools/lqcontrol.rst pulls both through autoclass, so the rendered docs show the same text. Correct the prime placement in both docstrings so they read E[w_t w_t'] = I. Done when both docstrings match and quantecon/tests/test_lqcontrol.py still passes.

Written by the indexing model from the issue text.

Description

documentation

Summary

The LQ and LQMarkov class docstrings say the shocks satisfy E[w_t' w_t] = I, "the j x j identity". docs/source/tools/lqcontrol.rst pulls both docstrings into the API docs via autoclass. Because w_t is j x 1, w_t' w_t is a scalar, so for j > 1 it cannot equal the j x j identity. The intended statement is the outer product E[w_t w_t'] = I, and that is what the code assumes: d is computed from trace(P C C') (LQ, LQMarkov), and compute_sequence draws each w_t as j independent standard normals (LQ, LQMarkov).

What the code does

LQ, lines 46-49 and LQMarkov, lines 364-367 have the same text:

    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.

Suggested fix

Move the prime in both docstrings:

-    :math:`\mathbb{E} [ w_t' w_t ] = I`, the j x j identity.
+    :math:`\mathbb{E} [ w_t w_t' ] = I`, the j x j identity.

This changes only the docstrings, so no numerical output changes. With the change applied to main, quantecon/tests/test_lqcontrol.py passes unchanged. _lqcontrol.py has no docstring examples, so test_docstring_examples.py does not run these docstrings.

Context

Found while verifying #984, the fix for #982.

🤖 Generated with Claude Code

Dominant language
Python
Stars
2.4k
Forks
2.3k
Avg merge
7d 58m
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantEcon/QuantEcon.py

All issues in QuantEcon/QuantEcon.py

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.