Skip to content

[action-translation] resync: samuelson.md#150

Merged
mmcky merged 3 commits into
mainfrom
resync/samuelson
Jul 19, 2026
Merged

[action-translation] resync: samuelson.md#150
mmcky merged 3 commits into
mainfrom
resync/samuelson

Conversation

@mmcky

@mmcky mmcky commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Forward Resync: samuelson.md

Source: QuantEcon/lecture-python.mystlectures/samuelson.md
Source commit: 089e35c
This PR resyncs the translation to match the current source document.

Reason: The Chinese translation uses an older, significantly different code structure (separate functions like categorize_solution printing directly, y_stochastic_g with inline transition logic, Samuelson class without simulate_samuelson helper) rather than the refactored unified functions (analyze_roots, simulate_samuelson) present in the English source. This means substantial code content differs on both sides: TARGET contains code/logic not in SOURCE (e.g., old-style categorize_solution printing strings, _transition method, old y_stochastic_g implementation, LSS class without μ_0/Σ_0 property aliases), while SOURCE contains newer unified functions and docstrings not reflected in TARGET. Additionally TARGET adds font-setup code (mpl.font_manager, FONTPATH) and grid() calls not in SOURCE. These are substantive code differences beyond mere translation, so TARGET_HAS_ADDITIONS applies alongside content changes.

Changes

Whole-file resync applied. The entire document was resynced in a single pass.


Created by action-translation forward resync

Copilot AI review requested due to automatic review settings July 18, 2026 08:50
@mmcky mmcky added action-translation-sync Auto-created by action-translation resync Forward resync labels Jul 18, 2026
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit a717630
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a5c1305d8b2420008d1adb3
😎 Deploy Preview https://deploy-preview-150--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

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 forward-resyncs the Chinese lecture lectures/samuelson.md to match the current upstream English source, including updated/refactored example code (unified root analysis + simulation helpers) and refreshed narrative/formatting. It also records the sync state in .translate/state/samuelson.md.yml.

Changes:

  • Resynced samuelson.md content and code cells to the upstream structure (e.g., added analyze_roots / simulate_samuelson, refactored stochastic/government-spending examples, updated class implementations).
  • Updated MyST/JupyterBook cell metadata formatting (ipython3, :tags: blocks) and refreshed various text/math expressions.
  • Added translation sync state metadata file for traceability.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
lectures/samuelson.md Whole-document resync: substantial narrative + code refactor to align with upstream lecture structure.
.translate/state/samuelson.md.yml Records the upstream source SHA, sync date, and tool metadata for the resync.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lectures/samuelson.md
Comment on lines +537 to +546
# 确定根的性质
is_complex = all(isinstance(root, complex) for root in roots)
is_stable = all(abs(root) < 1 for root in roots)

if verbose:
print(f"ρ1 = {ρ1:.2f}, ρ2 = {ρ2:.2f}")
print(f"根为: {[f'{root:.2f}' for root in roots]}")
print(f"根的类型: {'复数' if is_complex else '实数'}")
print(f"稳定性: {'稳定' if is_stable else '不稳定'}")
print(f"解的类型: {solution_type}")
Comment thread lectures/samuelson.md
Comment on lines +848 to +850
print(f"解的类型: {analysis['solution_type']}")
print(f"根为 {[f'{root:.2f}' for root in analysis['roots']]}")
print(f"根的类型: {'复数' if analysis['is_complex'] else '实数'}")
Comment thread lectures/samuelson.md
Comment on lines 933 to 936
.. math::

Y_t = + (α + β) Y_{t-1} - β Y_{t-2}
Y_t = \alpha (1 + \beta) Y_{t-1} - \alpha \beta Y_{t-2}

Comment thread lectures/samuelson.md
Comment on lines +1051 to +1062
# 在图例中显示特征值
for i, root in enumerate(self.roots):
if isinstance(root, complex):
# 需要为正数填充运算符,因为字符串被分开
operator = ['+', '']
label = rf'$\lambda_{i+1} = {sam.roots[i].real:.2f} {operator[i]} {sam.roots[i].imag:.2f}i$'
else:
label = rf'$\lambda_{i+1} = {sam.roots[i].real:.2f}$'
ax.scatter(0, 0, 0, label=label) # 虚拟点以添加到图例

# 在图中添加ρ对
ax.scatter(self.ρ1, self.ρ2, 100, 'red', '+',
label=r'$(\ \rho_1, \ \rho_2 \ )$', zorder=5)
# 处理复数显示的符号格式
operator = ["+", ""]
root_real = self.roots[i].real
root_imag = self.roots[i].imag
label = (
rf"$\lambda_{i+1} = {root_real:.2f}"
rf"{operator[i]} {root_imag:.2f}i$"
)
Comment thread lectures/samuelson.md
Comment on lines 1260 to +1265
for ax, series, title, color in zip(axes, y, titles, colors):
ax.plot(series, color=color)
ax.set(title=title, xlim=(0, n))
ax.grid()

axes[-1].set_xlabel('迭代次数')
axes[-1].set_xlabel("迭代次数")
plt.show()
Comment thread lectures/samuelson.md
Comment on lines 1285 to +1288

return fig
axes[0].set_title("脉冲响应函数")
axes[-1].set_xlabel("迭代次数")
plt.show()
Re-applies Chinese code comments / print strings / plot labels that the
resync reverted to English while the surrounding code is unchanged
(action-translation#107 field validation, Track B wave).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmcky mmcky added the action-translation PRs created by QuantEcon/action-translation label Jul 18, 2026
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 18, 2026 10:29 Inactive
Four print statements were carried over from the old class-based
Samuelson lecture and reference names (self, module-level roots) that
do not exist in the refactored upstream code, raising NameError at
runtime. Restored upstream's print lines; also dropped-format-spec
repair inside analyze_roots. Adds the missing trailing newline
(engine issue tracked in QuantEcon/action-translation#116).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-18


📝 Translation Quality

Criterion Score
Accuracy 9/10
Fluency 9/10
Terminology 9/10
Formatting 9/10
Overall 9/10

Summary: This is a high-quality, comprehensive resync translation that accurately preserves the mathematical content, code, and structure of the original document while maintaining natural, fluent Chinese academic prose and consistent terminology per the glossary. Minor issues include a few added inline code comments not present in the source and slightly imprecise wording for 'variance' in one code comment, but these do not affect overall comprehension or accuracy significantly. Mathematical notation, LaTeX equations, and code blocks are preserved accurately throughout the resynced document Technical terminology (特征多项式, 特征值, 稳态, 边际消费倾向, 加速系数, etc.) is applied consistently and matches the glossary The translation reads fluently and naturally in academic Simplified Chinese, with appropriate register for a technical economics lecture Section headings and structure align well with the English source, and the added YAML translation metadata block is correctly formatted per the sync system's requirements

Suggestions:

  • Code comment 'C[1] = σ # 随机项' translates 'Shock variance' as '随机项' (random term) rather than something closer to '冲击方差' or '冲击的方差' - consider using a term that reflects 'variance' more precisely, e.g., '# 冲击方差'
  • In the f function docstring/code comments, added inline comments like '# 生成两个复根', '# 隐含的 ρ1, ρ2', '# 反向推导验证这些的 α 和 β' were inserted that don't exist in the English source code comments - these are extra additions not present in the original, though they don't harm understanding they deviate from a strict resync
  • In 'period = 10 # 时间单位中的周期长度' the comment duplicates the preceding markdown text '时间单位中的周期长度' redundantly with an extra line 'Cycle period in time units' - minor redundancy introduced but not an accuracy issue

🔍 Diff Quality

Check Status
Scope Correct
Position Correct
Structure Preserved
Heading-map Correct
Overall 10/10

Summary: The target document was correctly resynced to match the current source structure, content, and code cells, with an accurate translation metadata block added.


This review was generated automatically by action-translation review mode.

@github-actions
github-actions Bot temporarily deployed to pull request July 19, 2026 00:14 Inactive
@mmcky
mmcky merged commit fe42fb9 into main Jul 19, 2026
7 checks passed
@mmcky
mmcky deleted the resync/samuelson branch July 19, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action-translation PRs created by QuantEcon/action-translation action-translation-sync Auto-created by action-translation resync Forward resync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants