pv#

  • Series: lecture-python-intro

  • File: lectures/pv.md

  • Audit date: 2026-08-26

  • Corpus snapshot: a12d17c0ef

  • Categories audited: writing, math, code, figures, links, admonitions (JAX out of scope)

  • Overall score: 8.3 / 10

  • Priority: LOW

Score breakdown#

Category

Score

One-line note

Writing

4.5/10

qe-writing-005 ×4; qe-writing-003 ×3; qe-writing-002 ×4, +4 more.

Math

10/10

no mechanical violations detected.

Code

8.5/10

qe-code-001 ×2.

JAX

out of scope

JAX rules target lecture-jax.

Figures

7/10

qe-fig-005 ×6; qe-fig-008 ×4.

References

N/A

no citations in this lecture.

Links

10/10

no mechanical violations detected.

Admonitions

10/10

no mechanical violations detected.

Issues#

Critical#

None found.

High severity#

  • [qe-fig-005] — Descriptive figure names for cross-referencing. Count: 6. Lines: 234, 278, 297, 328, 618, 673. Example: code-cell figure without mystnb figure metadata.

  • [qe-writing-008] — Remove excessive whitespace between words. Count: 39. Lines: 18, 33, 37, 39, 42, 55, 59, 73, 75, 77, …. Example: 2 spaces.

Medium severity#

  • [qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 2. Lines: 267, 347. Example: the Python here is otherwise PEP8-clean - flake8 over every code cell reports nothing besides two blank lines left at the end of a cell body, at 267-268 and 347-348, both of which render as an empty final line in the notebook. Naming is consistent and the capitals are the mathematically justified kind the rule allows (A for the matrix, p, d, b for the vectors, p_star, p_star_perp, p_matrix, p_formula), and δ is spelled as the Greek letter throughout as qe-code-002 asks.

  • [qe-fig-008] — Use lw=2 for line charts. Count: 4. Lines: 306, 343, 637, 693. Example: plot() without lw=.

  • [qe-writing-001] — Use one sentence per paragraph. Count: 1. Lines: 524. Example: 2 sentences in one paragraph.

  • [qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 4. Lines: 21, 35, 82, 524. Example: 21-26 opens with a four-item list of “economic decisions” that asset pricing bears on - consumption, labor supply, education choice, demand for money - and not one of the four is mentioned again in the lecture, so the list costs the reader four lines and returns nothing. 82-83 is a 32-word digression on methods the lecture does not use (“There are powerful mathematical methods available for solving such systems and they are well worth studying in their own right, being the foundation for the analysis of many interesting economic models”), followed at 85 by a bare cross-book pointer with no closing punctuation. 35 restates 33 (“we’ll represent a sequence as a vector” / “So our analysis will typically boil down to studying relationships among vectors”). And 524 packs the standing assumptions and the task into one paragraph block, “Assume that \(g >1\) and that \(\delta g \in (0,1)\). Give analytical expressions for an asset price \(p_t\) under the following settings” - the qe-writing-001 hit, and here the two sentences are doing different jobs and should be separated on content grounds as well.

  • [qe-writing-003] (reviewer) — Maintain logical flow. Count: 3. Lines: 276, 480, 530. Example: the lecture is built around matrix inversion - 40 lists it as one of two main tools, 87 repeats it, {eq}`eq:apdb_sol` at 221-223 gives \(p = A^{-1}(d + b)\), the analytical section displays \(A^{-1}\) in full (364-372) and an exercise verifies it (389-409) - and no code cell ever inverts a matrix. 276 says “Now let’s solve for prices using {eq}`eq:apdb_sol`” directly above a cell whose one substantive line is p = np.linalg.solve(A, d + b) (281), which by construction does not form \(A^{-1}\); the same substitution happens at 175, 341, 583, 634 and 689. Either the prose should say that solve is the numerically preferable way to apply {eq}`eq:apdb_sol`, or one cell should show np.linalg.inv(A) @ (d + b) so the reader sees the equation they were given. Second, 480-482 says that with \(p_{T+1}^* = 0\) “a price vector \(p\) of all entries zero solves this equation and only the fundamental component of our pricing formula {eq}`eq:ptpveq` is present” - but this is the no-dividend case set up at 450-459, so the fundamental component is itself zero; what is present is nothing, and a reader tracking {eq}`eq:ptpveq` term by term is left to work out that a component of value zero is being called present. Third, the bubble thread is the only claim in the lecture that is never checked. Everything else gets a numerical or graphical confirmation - the matrix multiplication (158-179), the inverse (389-409), the pricing formula (570-594), the perpetuity (618-645), monotonicity in \(\delta\) (673-697) - but \(p_t = c\delta^{-t}\) (497) and \(R_t = \delta^{-1}\) (513), which are given two sections of their own, appear afterwards only as item 4 of pv_ex_a (530) and a one-line answer at 545, with no cell and no figure.

  • [qe-writing-004] — Avoid unnecessary capitalization in narrative text. Count: 1. Lines: 540. Example: mid-sentence ‘Equation’.

  • [qe-writing-005] (reviewer) — Use bold for definitions, italic for emphasis. Count: 4. Lines: 29, 70, 481, 484. Example: 70 bolds a single letter inside a word for typographic effect: “We say equations, plural, because there are \(T+1\) equations” - not a definition, not emphasis, and it renders as a bolded s. 29 bolds time series as a passing use, two lines before 31 bolds it again as the actual definition (“A time series is a sequence indexed by time”), so the definition marker fires twice with the emphatic use first. 481 and 484 re-bold truncated forms of terms already defined and bolded at 424 and 426 - “only the fundamental component”, “let’s activate the bubble component” - which is bold used for emphasis. The four genuine definitions are correct: present value model (18), difference equation (80), fundamental component / discounted present value (424) and bubble component (426).

  • [qe-writing-007] (reviewer) — Use visual elements to enhance understanding. Count: 2. Lines: 282, 496. Example: the lecture’s subject is the map from a dividend sequence to a price sequence, and it never puts the two on one set of axes. The dividend stream is drawn in its own figure (234-247) and the price in a second (278-287), each a bare ax.plot(..., 'o') with set_xlabel('time'), no title and no shared axis, so the reader has to hold one plot in memory to read the other; the same split repeats for the cyclical example (297-310 and 328-348), where the payoff sentence - “The weighted averaging associated with the present value calculation largely eliminates the cycles” (350-351) - is a claim about two series that are never shown together. Second, the exploding bubble path {eq}`eq:bubble` at 496-498 is the most vivid object in the lecture and is never plotted, although a three-line cell reusing the existing machinery would draw \(p_t = c\delta^{-t}\) against a flat fundamental value and make the constant gross return \(R_t = \delta^{-1}\) of 513 visible as a slope.

Low severity#

None found.

Strengths#

  • The system is introduced three times in three representations that are explicitly identified with each other - the \(T+1\) scalar equations {eq}`eq:Euler1` (66-68), the stacked list {eq}`eq:Euler_stack` (104-112), and the single matrix equation {eq}`eq:pvpieq` (116-131) - and 114 states the move plainly (“Write the system … as the single matrix equation”) rather than leaving the reader to notice it.

  • Exercise pv_ex_1 (135-183) asks the reader to do the matrix multiplication by hand and then hands them a cell that checks the residual A @ p - (d + b) numerically (178-179), so a first-course reader can confirm their own algebra rather than trust the display.

  • The decomposition at 421-432 names both halves of {eq}`eq:ptpveq` and then explains each in its own sentence - the fundamental component “pinned down by the discount factor \(\delta\) and the payout”, the bubble component as “the part of the price that is not pinned down by fundamentals” - which is exactly the sentence an introductory reader needs to see before the bubble section.

  • Every code cell rebuilds the objects it needs from scratch (the T, δ, p_star and A triples at 159-172, 235-266, 329-340, 390-404, 571-582, 619-632 and 674-688), so a reader who runs one cell out of order still gets a correct answer - a real virtue in a lecture that switches between \(T = 6\) and \(T = 100\) four times.

  • The four exercises added after the main text each close a loop with a printed check rather than a plausible-looking plot: Is identity: at 409, a side-by-side matrix-versus-formula table at 590-594, Max deviation from d/(1 - δ) at 645, and a monotonicity plot backed by the term-by-term reason at 700-702.

  • pv_ex_a (520-548) is well designed as a single exercise: four settings of \((p_{T+1}^*, d_t)\) that between them produce the Gordon growth formula, its truncated cousin, the worthless stock and the pure bubble, all answered by substitution into one formula {eq}`eq:ptpveq` (540).

  • The perpetuity exercise (600-653) verifies the same result twice, numerically to 1e-2 precision in the printout at 645 and analytically in two lines of algebra at 650-653, which is the pattern the rest of the lecture would benefit from.