SYNC: update lagrangian_lqdp.md from lecture-python.myst#6
Merged
Conversation
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>
There was a problem hiding this comment.
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 theLQobject. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings
lectures/lagrangian_lqdp.mdup to date with its primary sourcelecture-python.myst(see #7 for the source mapping). The PR now contains two SYNC commits that together re-sync the lecture to upstream's currentmain:3415cbb— Original sync: switched thenp.linalg.pinvtonp.linalg.inv, matching the upstream version at the time.c9f0c02— Re-sync to upstream commit78030a3a(lecture-python.myst PR #859, 2026-04-28). Larger upstream rewrite:scipy.linalg.schur'sstable_dim+ a tolerance check.np.linalg.solve(V11.T, V21.T).T(no explicit inverse).Net effect at the formerly
pinv/invline: nownp.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
mainto pick up the un_insure execution fix from #17.🤖 Generated with Claude Code