From 7cfb743278890b2880fe35f7305103fcb83dea51 Mon Sep 17 00:00:00 2001 From: Humphrey Yang Date: Tue, 18 Mar 2025 13:32:03 +1100 Subject: [PATCH] update newton and opt_transport --- lectures/newton_method.md | 2 +- lectures/opt_transport.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lectures/newton_method.md b/lectures/newton_method.md index ce340d2..ab66d14 100644 --- a/lectures/newton_method.md +++ b/lectures/newton_method.md @@ -426,7 +426,7 @@ k_star_approx_newton = newton(f=lambda x: g(x, params) - x, ``` ```{code-cell} ipython3 -k_star_近似牛顿法 +k_star_approx_newton ``` 结果证实了我们在上面图表中看到的收敛情况:仅需5次迭代就达到了非常精确的结果。 diff --git a/lectures/opt_transport.md b/lectures/opt_transport.md index b3317d8..b64761a 100644 --- a/lectures/opt_transport.md +++ b/lectures/opt_transport.md @@ -403,8 +403,8 @@ arr = np.arange(m+n) ``` ```{code-cell} ipython3 -已找到解 = [] -成本 = [] +sol_found = [] +cost = [] # 模拟1000次 for i in range(1000): @@ -414,9 +414,9 @@ for i in range(1000): # 如果找到新解 sol = tuple(res_shuffle.x) - if sol not in 已找到解: - 已找到解.append(sol) - 成本.append(res_shuffle.fun) + if sol not in sol_found: + sol_found.append(sol) + cost.append(res_shuffle.fun) ``` ```{code-cell} ipython3