QuantEcon / QuantEcon/lecture-python.myst
style: prefer `$$ \begin{aligned} … $$` over a bare `align` block in divergence_measures.md
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 123
- Forks
- 57
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 11
Description
Summary
In lectures/divergence_measures.md (lines ~134–140) the KL-divergence derivation uses a bare top-level \begin{align} block:
\begin{align}
D_{KL}(f \parallel g) &= \sum_{i} f_i \log\left[\frac{f_i}{g_i}\right] \\
&= \sum_{i} f_i \left[\log f_i - \log g_i\right] \\
&= \sum_{i} f_i \log f_i - \sum_{i} f_i \log g_i \\
&= -H(f) + H(f,g) \\
&= H(f,g) - H(f)
\end{align}
This is not a build error — the amsmath MyST extension renders bare amsmath environments and the book builds fine. It's a minor style/consistency note: this is the only lecture in the series using a bare top-level align. The QuantEcon convention is to wrap multi-line display math in $$ with aligned (see math.md), which is also the more robust form for PDF/LaTeX output.
Suggested change
$$
\begin{aligned}
D_{KL}(f \parallel g) &= \sum_{i} f_i \log\left[\frac{f_i}{g_i}\right] \\
&= \sum_{i} f_i \left[\log f_i - \log g_i\right] \\
&= \sum_{i} f_i \log f_i - \sum_{i} f_i \log g_i \\
&= -H(f) + H(f,g) \\
&= H(f,g) - H(f)
\end{aligned}
$$
Context
Low-priority finding from the May 2026 style audit of the QuantEcon lecture series — report: https://quantecon.github.io/audit.2026-05.style-guide/ (see the divergence_measures page). Consistency only; no rush.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open lectures/divergence_measures.md around lines 134–140 and compare the KL-divergence block with the convention in the linked math style guide. Check the rendered lecture or run the usual book build after updating the block; done means the derivation uses the project’s preferred display-math form without changing its content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, markdown
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100