Skip to content

SYNC: update lagrangian_lqdp.md from lecture-python.myst#6

Merged
mmcky merged 3 commits into
mainfrom
sync-lagrangian-lqdp-from-source
May 28, 2026
Merged

SYNC: update lagrangian_lqdp.md from lecture-python.myst#6
mmcky merged 3 commits into
mainfrom
sync-lagrangian-lqdp-from-source

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented Mar 23, 2026

Summary

Brings lectures/lagrangian_lqdp.md up to date with its primary source lecture-python.myst (see #7 for the source mapping). The PR now contains two SYNC commits that together re-sync the lecture to upstream's current main:

  1. 3415cbb — Original sync: switched the $V_{21}V_{11}^{-1}$ computation from np.linalg.pinv to np.linalg.inv, matching the upstream version at the time.
  2. c9f0c02 — Re-sync to upstream commit 78030a3a (lecture-python.myst PR #859, 2026-04-28). Larger upstream rewrite:
    • Switches the example to the deterministic permanent-income model.
    • Applies the invariant-subspace method to the equivalent undiscounted system, using transformed matrices $\hat A = \beta^{1/2} A$, $\hat B = \beta^{1/2} B$.
    • Replaces ad-hoc stable-eigenvalue sorting with scipy.linalg.schur's stable_dim + a tolerance check.
    • Refactors the $V_{21}V_{11}^{-1}$ computation to np.linalg.solve(V11.T, V21.T).T (no explicit inverse).

Net effect at the formerly pinv / inv line: now np.linalg.solve(...) (matches upstream).

Intersphinx

The intentional lecture-dp-specific prefix intermediate:re_with_feedback (documented in #7) is preserved.

CI

Branch updated to latest main to pick up the un_insure execution fix from #17.

🤖 Generated with Claude Code

mmcky and others added 2 commits March 24, 2026 09:45
Sync code change from source repo (lecture-python.myst):
- Use np.linalg.inv instead of np.linalg.pinv for V21 V11^{-1} computation
Re-sync to upstream commit 78030a3a (PR #859): switches the example to
the deterministic permanent-income model and applies the invariant-subspace
method to the equivalent undiscounted system (transformed matrices
 = β^{1/2}A, B̂ = β^{1/2}B), using schur's stable_dim with a tolerance.
Intersphinx prefix (intermediate:re_with_feedback) preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 27, 2026 23:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR syncs lectures/lagrangian_lqdp.md with the upstream lecture source by updating the discounted LQ example and its invariant-subspace computation.

Changes:

  • Introduces discounting earlier via beta=β when constructing the LQ object.
  • Applies the Schur/invariant-subspace method to transformed undiscounted matrices.
  • Updates stable-eigenvalue sorting and computes V21 V11^{-1} via a linear solve.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +607 to +608
# compute V21 V11^{-1} without forming the inverse explicitly
P = np.linalg.solve(V[:n, :n].T, V[n:, :n].T).T
Pulls in un_insure.md execution fix (#17) so CI passes.
@mmcky mmcky merged commit 025a79b into main May 28, 2026
1 check passed
@mmcky mmcky deleted the sync-lagrangian-lqdp-from-source branch May 28, 2026 03:36
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.

2 participants