diff --git a/.translate/state/scipy.md.yml b/.translate/state/scipy.md.yml index 5c139e2..854184e 100644 --- a/.translate/state/scipy.md.yml +++ b/.translate/state/scipy.md.yml @@ -1,6 +1,6 @@ -source-sha: cfedc1a06bbefe20d23924d26aef437a968ab2da -synced-at: "2026-03-20" -model: unknown -mode: RESYNC +source-sha: fb75a07e49cbec97c2c3e698a81ee008203b1fab +synced-at: "2026-05-08" +model: claude-sonnet-4-6 +mode: UPDATE section-count: 8 -tool-version: 0.13.1 +tool-version: 0.14.1 diff --git a/lectures/scipy.md b/lectures/scipy.md index 77a7467..5d84486 100644 --- a/lectures/scipy.md +++ b/lectures/scipy.md @@ -124,10 +124,11 @@ a = np.identity(3) ### متغیرهای تصادفی و توزیع‌ها -به یاد بیاورید که `numpy.random` توابعی را برای تولید متغیرهای تصادفی فراهم می‌کند +به یاد بیاورید که `numpy.random` ابزارهایی را برای تولید متغیرهای تصادفی فراهم می‌کند ```{code-cell} python3 -np.random.beta(5, 5, size=3) +rng = np.random.default_rng() +rng.beta(5, 5, size=3) ``` این یک نمونه از توزیع با تابع چگالی زیر را وقتی `a, b = 5, 5` تولید می‌کند @@ -208,8 +209,8 @@ plt.show() ```{code-cell} python3 from scipy.stats import linregress -x = np.random.randn(200) -y = 2 * x + 0.1 * np.random.randn(200) +x = rng.standard_normal(200) +y = 2 * x + 0.1 * rng.standard_normal(200) gradient, intercept, r_value, p_value, std_err = linregress(x, y) gradient, intercept ``` @@ -592,8 +593,9 @@ $$ \mathbb E \max\{ S_n - K, 0 \} در اینجا یک راه‌حل آورده شده است: ```{code-cell} ipython3 +rng = np.random.default_rng() M = 10_000_000 -S = np.exp(μ + σ * np.random.randn(M)) +S = np.exp(μ + σ * rng.standard_normal(M)) return_draws = np.maximum(S - K, 0) P = β**n * np.mean(return_draws) print(f"The Monte Carlo option price is {P:3f}") @@ -648,4 +650,4 @@ bisect(f, 0, 1) ``` ```{solution-end} -``` \ No newline at end of file +```