Skip to content

SYNC: update un_insure.md from lecture-python-advanced.myst#18

Merged
mmcky merged 1 commit into
mainfrom
sync-un-insure-from-source
May 28, 2026
Merged

SYNC: update un_insure.md from lecture-python-advanced.myst#18
mmcky merged 1 commit into
mainfrom
sync-un-insure-from-source

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented May 28, 2026

Brings lectures/un_insure.md back 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:

  1. Tuple correctnessargs=(r)args=(r,) on both fsolve calls.
  2. max(0, …) clamp inside Vu_error — search effort is now clamped to non-negative, matching what calc_a already did. This eliminates the RuntimeWarning: iteration not making good progress that fsolve was emitting during the inner Bellman solve.
  3. PEP8 sweep across the whole file (spaces around operators, no spaces around = in kwargs, two blank lines between top-level defs, comment spacing, long-line wrapping) and two spelling fixes (utiliyutility, consumptonconsumption).

After this PR, un_insure.md is byte-identical to upstream's current main.

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):

  • ✅ Completes end-to-end with no warnings.
  • ✅ Calibrated r = 0.00034314093941788904 — matches the live page to ~10 significant figures.
  • ✅ All iteration error values match to 10+ significant figures.
  • ✅ Rendered figure is byte-identical to the live page (same PNG SHA256, 07de52ef…6578e16).

Intersphinx

No intersphinx-prefix preservation needed; un_insure.md is not in the issue #7 exception list.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 28, 2026 05:31
@mmcky
Copy link
Copy Markdown
Contributor Author

mmcky commented May 28, 2026

thanks for the upstream fix and updates @HumphreyYang

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/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 fsolve usage 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.

@mmcky mmcky merged commit ef965d8 into main May 28, 2026
2 checks passed
@mmcky mmcky deleted the sync-un-insure-from-source branch May 28, 2026 07:10
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