Skip to content

[organization_capital.md] Update np.random → Generator API - #1014

Merged
kp992 merged 1 commit into
mainfrom
update-rng-organization-capital
Jul 31, 2026
Merged

[organization_capital.md] Update np.random → Generator API#1014
kp992 merged 1 commit into
mainfrom
update-rng-organization-capital

Conversation

@Chihiro2000GitHub

@Chihiro2000GitHub Chihiro2000GitHub commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR migrates legacy NumPy random API usage in organization_capital.md as part of QuantEcon/meta#299.

The lecture already builds a seeded generator in its four simulation functions. This PR brings the one remaining cell, which still used np.random.seed(...) and np.random.randn(...), into line with them.

Related PRs and issues

I checked for open PRs and issues related to this lecture. No open PR modifies organization_capital.md, and no open issue concerns this migration.

While checking the rebuilt figure I did notice that the posterior-mean panel does not show the convergence the text describes. That is pre-existing, and I have filed it separately as #1015.

Details

  • In the cell that plots the posterior evolution, np.random.seed(0)rng = np.random.default_rng(0) and np.random.randn(T)rng.standard_normal(T).
  • The existing seed (0) is kept, and no new seed was introduced.
  • The four existing rng = np.random.default_rng(seed) calls elsewhere in the lecture are unchanged.
  • No prose changes were needed. The text describes the figure qualitatively: the posterior mean converges to the true value and the posterior uncertainty shrinks at rate 1/sqrt(n).
  • The lecture contains no Numba (@jit, @njit, @jitclass, parallel=True, prange) code.
  • A full local build completed successfully and organization_capital.md executed without errors.

Note for reviewers

Only the left panel of the posterior figure changes: the posterior standard deviation plotted on the right does not depend on the draws.

Hi @mmcky and @HumphreyYang, I'd be grateful if you could take a look when you have time.

@github-actions

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-1014--sunny-cactus-210e3e.netlify.app

Commit: 7af1ae4

📚 Changed Lectures


Build Info

@kp992
kp992 merged commit 59f9637 into main Jul 31, 2026
1 check passed
@kp992
kp992 deleted the update-rng-organization-capital branch July 31, 2026 23:17
@mmcky

mmcky commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

✅ Translation sync completed (zh-cn)

Target repo: QuantEcon/lecture-python.zh-cn
Translation PR: QuantEcon/lecture-python.zh-cn#213
Files synced (1):

  • lectures/organization_capital.md

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.

3 participants