Skip to content

🌐 [translation-sync] Improve and simplify JAX lectures#109

Open
mmcky wants to merge 4 commits intomainfrom
translation-sync-2026-04-14T18-02-22-pr-532
Open

🌐 [translation-sync] Improve and simplify JAX lectures#109
mmcky wants to merge 4 commits intomainfrom
translation-sync-2026-04-14T18-02-22-pr-532

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented Apr 14, 2026

Automated Translation Sync

This PR contains automated translations from QuantEcon/lecture-python-programming.

Source PR

#532 - Improve and simplify JAX lectures

Files Updated

  • ✏️ lectures/jax_intro.md
  • ✏️ .translate/state/jax_intro.md.yml
  • ✏️ lectures/numpy_vs_numba_vs_jax.md
  • ✏️ .translate/state/numpy_vs_numba_vs_jax.md.yml

Details

  • Source Language: en
  • Target Language: fa
  • Model: claude-sonnet-4-6

This PR was created automatically by the translation action.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 14, 2026

Deploy Preview for majestic-griffin-10b166 ready!

Name Link
🔨 Latest commit ee89d91
🔍 Latest deploy log https://app.netlify.com/projects/majestic-griffin-10b166/deploys/69de81357268e900081e8991
😎 Deploy Preview https://deploy-preview-109--majestic-griffin-10b166.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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-04-14


📝 Translation Quality

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

Summary: The translation is of high quality across all modified and added sections. Technical accuracy is strong, terminology is mostly consistent (with minor inconsistency between 'غیرخالص' and 'ناخالص' for 'impure'), and the Persian reads naturally with appropriate academic register. The new sections (Benefits, NumPy/MATLAB Approach, JAX random numbers, First/Second Attempt) are well-integrated. Minor improvements could be made to better capture nuanced terms like 'explicitness' and 'patterns', and to ensure terminology consistency for 'impure functions' throughout the document. Technical terminology is consistently and accurately translated throughout all modified sections, including correct use of 'کامپایل JIT', 'برداری‌سازی', 'توابع خالص', and 'مولد اعداد تصادفی'. The YAML frontmatter translation metadata is correctly structured with proper hierarchical heading mappings using the double-colon notation for all new and modified sections. Mathematical notation and LaTeX expressions are fully preserved without modification across all changed sections. The added sections (### NumPy / MATLAB Approach, ### JAX, ### Benefits, #### First Attempt, #### Second Attempt) are well-translated with natural Persian phrasing that maintains the academic register of the source. Code comments and inline technical terms (like lax.fori_loop, lax.scan, block_until_ready) are appropriately left in English while surrounding explanatory text is fluently translated.

Suggestions:

  • Random numbers section - 'اعداد تصادفی در JAX نسبت به آنچه در NumPy یا MATLAB می‌یابید بسیار متفاوت هستند.' → The English says 'differs significantly from the patterns found in NumPy or MATLAB' which is better rendered as 'تولید اعداد تصادفی در JAX با الگوهای موجود در NumPy یا MATLAB تفاوت قابل توجهی دارد.' to preserve 'patterns' (الگوها) which is meaningful in context.

  • Benefits section - 'صریح بودن JAX مزایای قابل توجهی به همراه دارد' → The English 'The explicitness of JAX brings significant benefits' could be more precisely translated as 'صراحت/شفافیت JAX مزایای قابل توجهی به دنبال دارد' since 'explicitness' refers to the explicit state management design principle discussed throughout.

  • Compiling non-pure functions - 'در حالی که JAX معمولاً هنگام کامپایل توابع ناخالص خطا نمی‌دهد' → The English uses 'impure functions' but earlier the translation uses 'توابع غیرخالص' consistently. Here 'ناخالص' is used instead of 'غیرخالص'. Should be consistent: 'در حالی که JAX معمولاً هنگام کامپایل توابع غیرخالص خطا نمی‌دهد'.

  • First Attempt section - 'در اینجا یک راه‌حل با استفاده از سینتکس at[t].set ارائه می‌شود' → The English says 'Here's a workaround using the at[t].set syntax' — 'workaround' should be 'راه‌حل جایگزین' (as used in the earlier section heading) rather than just 'راه‌حل' for consistency.

  • NumPy / MATLAB Approach - 'تولید اعداد تصادفی با حفظ وضعیت سراسری پنهان کار می‌کند' → The English says 'generation works by maintaining hidden global state'. The word 'تولید اعداد تصادفی' (random number generation) should be added for clarity: 'در NumPy / MATLAB، تولید اعداد تصادفی با حفظ یک وضعیت سراسری پنهان انجام می‌شود.'


🔍 Diff Quality

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

Summary: Both files are correctly modified with changes in the right positions and the heading maps accurately reflect the restructured sections in both documents.


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

@github-actions
Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-04-14


📝 Translation Quality

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

Summary: The translation of the changed sections is of high quality, accurately conveying technical content about JAX random numbers, JIT compilation, and sequential operations. The newly added sections (NumPy/MATLAB Approach, JAX, Benefits, First/Second Attempt) are well-integrated and read naturally. Minor issues include a few omitted words ('still', 'همچنان'), a slightly unnatural noun phrase for 'explicitness', and minor fluency improvements possible in the Summary section. No syntax errors were found. Overall, the translation is reliable and suitable for publication. Technical terminology is consistently and correctly applied throughout the changed sections, including proper translation of JIT compilation concepts, random number generation, and vmap vectorization The newly added sections (### NumPy / MATLAB Approach, ### JAX, ### Benefits, #### First Attempt, #### Second Attempt) are well-translated with natural Persian phrasing and accurate content Mathematical and code formatting is fully preserved across all modified sections, with LaTeX equations and code blocks intact The translation of the 'Benefits' section correctly uses established glossary terms like 'تکرارپذیری' (Reproducibility) and 'موازی‌سازی' (Parallelization) The YAML frontmatter translation metadata is correctly structured with proper heading mappings for all new and modified sections

Suggestions:

  • Random numbers section - 'اعداد تصادفی در JAX نسبت به آنچه در NumPy یا MATLAB می‌یابید بسیار متفاوت هستند' → 'تولید اعداد تصادفی در JAX با الگوهای موجود در NumPy یا MATLAB تفاوت قابل توجهی دارد' — the source says 'differs significantly from the patterns found in NumPy or MATLAB' which is more precise than 'what you find'

  • Benefits section - 'صریح بودن JAX مزایای قابل توجهی به همراه دارد' → 'صراحت JAX مزایای قابل توجهی به همراه دارد' — 'explicitness' (صراحت/وضوح) better captures the noun form than the adjective phrase 'صریح بودن'

  • JAX Version intro - 'اما می‌توانیم این عملیات را پیاده‌سازی کنیم.' → 'اما همچنان می‌توانیم این عملیات را پیاده‌سازی کنیم.' — source says 'But we can still implement this operation', the word 'still' (همچنان) is missing

  • Second Attempt - 'این کد خواندن آسانی ندارد' → 'این کد به راحتی خوانده نمی‌شود' — slightly more natural phrasing for 'This code is not easy to read'

  • Summary (Sequential operations) - 'نسخه‌های JAX، از سوی دیگر، نیاز به استفاده از lax.fori_loop یا lax.scan دارند که هر دو کمتر شهودی از یک حلقه استاندارد Python هستند.' → 'نسخه‌های JAX، از سوی دیگر، به lax.fori_loop یا lax.scan نیاز دارند که هر دو کمتر شهودی‌تر از یک حلقه استاندارد Python هستند.' — removing redundant 'استفاده از' and fixing comparative form


🔍 Diff Quality

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

Summary: All translation sync changes are correctly applied: the same files are modified, restructured sections appear in the correct positions, document structure is preserved, and the heading map is properly updated with new/removed headings and their Persian translations.


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

Copy link
Copy Markdown
Contributor

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

Automated translation sync (en → fa) incorporating upstream improvements that simplify and restructure the JAX-related lecture content.

Changes:

  • Updated Persian lecture content in jax_intro.md (notably the random numbers section structure and explanations, plus some JIT/vmap narrative edits).
  • Updated Persian lecture content in numpy_vs_numba_vs_jax.md (vectorization and sequential-ops sections refined; added “First/Second Attempt” subsections for JAX sequential ops).
  • Refreshed translation sync state files with the new source SHA and sync timestamp.

Reviewed changes

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

File Description
lectures/numpy_vs_numba_vs_jax.md Syncs updated explanations and structure for NumPy/Numba/JAX comparisons; adds new subsections and refactors some code/narration.
lectures/jax_intro.md Syncs updated random-number-state explanation structure and related narrative adjustments in the JAX intro lecture.
.translate/state/numpy_vs_numba_vs_jax.md.yml Updates the stored source SHA and sync date for the translation state.
.translate/state/jax_intro.md.yml Updates the stored source SHA and sync date for the translation state.

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

در نسخه برداری شده، تمام حلقه‌ها در کد کامپایل شده انجام می‌شوند.

علاوه بر این، NumPy از چندنخی ضمنی استفاده می‌کند، به طوری که حداقل مقداری موازی‌سازی رخ می‌دهد.
استفاده از `meshgrid` به ما امکان می‌دهد حلقه for تودرتو را تکرار کنیم.
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

جمله «استفاده از meshgrid به ما امکان می‌دهد حلقه for تودرتو را تکرار کنیم» از نظر معنایی نادرست/گمراه‌کننده است؛ meshgrid و برداری‌سازی هدفشان حذف/جایگزینی حلقه‌های تودرتو با عملیات آرایه‌ای است، نه «تکرار» آن‌ها. پیشنهاد: بازنویسی جمله به شکلی که صریحاً به حذف حلقه‌ها و اجرای محاسبات در کد برداری/کامپایل‌شده اشاره کند.

Suggested change
استفاده از `meshgrid` به ما امکان می‌دهد حلقه for تودرتو را تکرار کنیم.
استفاده از `meshgrid` به ما امکان می‌دهد به‌جای نوشتن حلقه‌های `for` تودرتوی صریح، محاسبه را روی کل آرایه‌ها به‌صورت برداری انجام دهیم.

Copilot uses AI. Check for mistakes.
Comment on lines +152 to 156
# Large grid
grid = np.linspace(-3, 3, 3_000)
x, y = np.meshgrid(grid, grid)

x, y = np.meshgrid(grid, grid) # MATLAB style meshgrid

Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

در این بخش متن فارسی است اما کامنت‌های جدید داخل کد (# Large grid و # MATLAB style meshgrid) انگلیسی هستند. برای یکدستی نسخهٔ فارسی، بهتر است این کامنت‌ها ترجمه شوند یا حذف شوند (به‌خصوص چون توضیح فارسی در متن اطراف وجود دارد).

Copilot uses AI. Check for mistakes.
Comment on lines +329 to 332
# Construct a function that takes the max over all x for given y
f_vec_x_max = lambda y: jnp.max(f(grid, y))
# تابع را برداری کنید تا بتوانیم روی تمام سطرها همزمان فراخوانی کنیم
# Vectorize the function so we can call on all y simultaneously
f_vec_max = jax.vmap(f_vec_x_max)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

کامنت‌های داخل تابع compute_max_vmap به انگلیسی اضافه شده‌اند. با توجه به اینکه این یک سخنرانی ترجمه‌شده به فارسی است، بهتر است این توضیحات هم فارسی شوند (یا اگر ضروری نیستند، حذف شوند) تا خواننده مجبور به سوئیچ زبانی داخل همان بلوک کد نشود.

Copilot uses AI. Check for mistakes.
Comment on lines 352 to +356
with qe.Timer():
z_max = compute_max_vmap(grid).block_until_ready()
# First run
z_max = compute_max_vmap(grid)
# Hold interpreter
z_max.block_until_ready()
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

کامنت «Hold interpreter» در این سلول هم انگلیسی است و هم از نظر معنا دقیق نیست. هدف این خط block_until_ready() این است که اجرای ناهمگام روی دستگاه تمام شود تا زمان‌سنجی درست باشد. پیشنهاد: کامنت را به چیزی مثل «منتظر بمان تا محاسبه روی دستگاه تمام شود (برای زمان‌سنجی)» تغییر دهید.

Copilot uses AI. Check for mistakes.
Comment on lines 364 to +368
with qe.Timer():
z_max = compute_max_vmap(grid).block_until_ready()
# Second run
z_max = compute_max_vmap(grid)
# Hold interpreter
z_max.block_until_ready()
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

در سلول اجرای دوم هم کامنت «Hold interpreter» همان مشکل را دارد: هم انگلیسی است و هم دقیقاً توضیح نمی‌دهد که block_until_ready() برای اطمینان از اتمام اجرای ناهمگام و صحیح بودن زمان‌سنجی است. بهتر است کامنت اصلاح/ترجمه شود.

Copilot uses AI. Check for mistakes.
Comment thread lectures/jax_intro.md
Comment on lines +799 to +800
batch_mm_diff = jax.vmap(mm_diff) # Create a new "vectorized" version
batch_mm_diff(X) # Apply to each row of X
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

کامنت‌های اضافه‌شده در این بلوک کد (# Create a new "vectorized" version و # Apply to each row of X) انگلیسی هستند. برای نسخهٔ فارسی بهتر است این کامنت‌ها ترجمه شوند یا حذف شوند تا خوانایی یکدست بماند.

Suggested change
batch_mm_diff = jax.vmap(mm_diff) # Create a new "vectorized" version
batch_mm_diff(X) # Apply to each row of X
batch_mm_diff = jax.vmap(mm_diff) # ایجاد یک نسخهٔ «برداری‌شده» جدید
batch_mm_diff(X) # اعمال به هر سطرِ X

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

@github-actions github-actions bot temporarily deployed to pull request April 14, 2026 18:08 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants