🌐 [translation-sync] [inventory_dynamics] Update code to JAX and latest style guide#198
Conversation
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-23 📝 Translation Quality
Summary: This is a high-quality translation of the modified sections. Mathematics, code, and MyST directives are fully intact, and the technical content (JAX-related explanations, simulation logic, statistical concepts) is rendered accurately and fluently. Minor issues include a terminology inconsistency with the glossary ('边际分布' vs '边缘分布') and small stylistic deviations that do not affect comprehension. No syntax errors were found in the changed sections. Mathematical notation and code blocks are preserved accurately and completely across all changed sections Technical explanations (e.g., the note on JAX functional updates and XLA compilation) are translated clearly and accurately, preserving nuanced technical meaning Consistent and natural rendering of exercise and solution blocks, maintaining academic register throughout Suggestions:
🔍 Diff Quality
Summary: The translation sync correctly mirrors all source changes (JAX rewrite, font setup, heading case changes, code reordering) in the same relative positions with proper heading-map key updates. This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
This automated translation-sync PR updates the Chinese inventory_dynamics lecture to match upstream changes that migrate the computational examples from NumPy/Numba to JAX and align formatting with the latest style guide, along with updating the translation state metadata.
Changes:
- Update translation metadata headings to match upstream casing (“Sample paths”, “Marginal distributions”).
- Replace NumPy/Numba simulation code with JAX (
jit,vmap,lax.fori_loop) and related refactors in code cells. - Refresh translation sync state (
source-sha,synced-at,mode,tool-version).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lectures/inventory_dynamics.md | Sync lecture content to upstream JAX-based implementation and style updates. |
| .translate/state/inventory_dynamics.md.yml | Update translation-sync bookkeeping metadata to the new upstream source SHA/date/tooling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sample_dates = 0, 10, 50, 250, 500, 750 | ||
|
|
||
| first_diffs = np.diff(sample_dates) | ||
| first_diffs = jnp.diff(jnp.array(sample_dates)) |
The AI review on #198 flagged this and the PR merged before it was fixed, so the term is currently on main. The glossary is explicit and context-aware: "Marginal distribution" maps to 边缘分布 tagged `"context": "probability"`, while every economics sense correctly keeps 边际 — 边际产量, 边际消费倾向, 边际收入, 边际效用. This lecture uses the probability sense throughout: ψ_T is the distribution of X_T at a fixed time T, and the later reference is to the sequence {ψ_t} converging to a limiting distribution. 边缘分布 is the standard mathematical term for that; 边际 is "marginal" as in marginal cost. Four occurrences: the H2 heading, its heading-map value, and two body references. The heading-map value is updated alongside the heading deliberately — leaving them out of step would make the next sync mis-map the section.
#149) (#150) `forward` and `init` resolved glossary candidates only against `process.cwd()`. The built-in glossaries ship inside this package and no edition repository carries one, so a resync launched from the target repo — or a bench root, or anywhere a globally installed CLI is naturally invoked — translated with no glossary at all. Nothing was logged either way and a bare `catch {}` swallowed parse errors, so a run that dropped terminology enforcement was indistinguishable from one that applied it. That unobservability is the worst of it: it made the difference unauditable after the fact. The production signature matches exactly. In lecture-python.zh-cn the `init`-seeded lectures all use the glossary's 边缘分布 for "Marginal distribution", while the 2026-07-19 `forward` wave took prob_matrix.md from 12 wrong / 28 correct to 25 wrong / 35 correct — newly generated text ignoring a glossary entry that exists. See QuantEcon/lecture-python.zh-cn#198 for the review finding. Resolution now lives in one testable module shared by both commands, with the packaged directory resolved relative to the installed CLI and threaded in as an option — `import.meta.url` cannot be loaded by the Jest CJS module registry, so the entry point resolves it and the logic stays unit testable. - precedence: --glossary → repo-local glossary/<lang>.json → built-in - every outcome reported: the origin, term count and path on success; a warning naming every path tried when a language has no glossary anywhere - loud on failure: a missing or malformed --glossary is a hard error, not a silent fallback to different terminology, and any candidate that exists but does not parse is an error rather than a fall-through - bulk resolves once before the first file, so a bad glossary stops the wave instead of surfacing after N files have been resynced against nothing - `forward --glossary <path>` added, matching `init` — the resync path previously had no override at all 21 new tests: CWD-independence, precedence, the throw paths, and what the translator actually receives on the resync path from a working directory with no glossary. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python.myst.
Source PR
#623 - [inventory_dynamics] Update code to JAX and latest style guide
Files Updated
lectures/inventory_dynamics.md.translate/state/inventory_dynamics.md.ymlDetails
This PR was created automatically by the translation action.