SYNC: update un_insure.md from lecture-python-advanced.myst#18
Merged
Conversation
Brings lecture-dp's un_insure.md back into byte-identical alignment with its primary source (see #7) after upstream PR #327 merged. The minimal [0] index fix that landed earlier in lecture-dp #17 was a first-aid measure to unblock CI. This SYNC pulls in the full upstream version, which adds: * the same [0] index on fsolve(...) so r_error returns a scalar (the original CI fix from #17); * args=(r,) tuple correctness on both fsolve calls; * max(0, invp_prime(...)) inside Vu_error so search effort is clamped to non-negative, matching what calc_a already did. This eliminates a "RuntimeWarning: iteration not making good progress" from fsolve; * PEP8 sweep across the file (spaces around operators, no spaces around = in kwargs, two blank lines between top-level defs, comment spacing, long-line wrapping); * two spelling fixes (utiliy -> utility, consumpton -> consumption). Verified in ghcr.io/quantecon/quantecon-build:latest (numpy 2.4.4 / scipy 1.17.1): runs clean with no warnings, calibration r matches the published live page to ~10 significant figures, and the rendered figure is byte-identical (same PNG SHA256). Mirrors upstream change in QuantEcon/lecture-python-advanced.myst#327 (authored by @HumphreyYang). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
thanks for the upstream fix and updates @HumphreyYang |
There was a problem hiding this comment.
Pull request overview
This PR syncs lectures/un_insure.md with its upstream source from lecture-python-advanced.myst, incorporating the complete upstream fix and style cleanup for the unemployment insurance lecture.
Changes:
- Fixes
fsolveusage by passing tuple arguments and extracting scalar results. - Clamps search effort to be non-negative in
Vu_error. - Applies formatting cleanup and spelling/comment corrections throughout the lecture code.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Brings
lectures/un_insure.mdback into byte-identical alignment with its primary source (see #7) after upstream QuantEcon/lecture-python-advanced.myst#327 merged.Background
The minimal
[0]index fix that landed earlier in #17 was a first-aid measure to unblock CI. This SYNC pulls in the full upstream version (authored by @HumphreyYang), which adds three things on top of the bare[0]fix:args=(r)→args=(r,)on bothfsolvecalls.max(0, …)clamp insideVu_error— search effort is now clamped to non-negative, matching whatcalc_aalready did. This eliminates theRuntimeWarning: iteration not making good progressthatfsolvewas emitting during the inner Bellman solve.=in kwargs, two blank lines between top-level defs, comment spacing, long-line wrapping) and two spelling fixes (utiliy→utility,consumpton→consumption).After this PR,
un_insure.mdis byte-identical to upstream's currentmain.Verification
Already verified during the upstream review (see #327's review comment) — ran the full notebook inside
ghcr.io/quantecon/quantecon-build:latest(numpy 2.4.4 / scipy 1.17.1):r = 0.00034314093941788904— matches the live page to ~10 significant figures.07de52ef…6578e16).Intersphinx
No intersphinx-prefix preservation needed;
un_insure.mdis not in the issue #7 exception list.🤖 Generated with Claude Code