Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .translate/state/functions.md.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source-sha: cadd911316d30a04f4bd518736088932b1c88790
source-sha: e2d28d003d61f45bf75e790a94b8d478ed0902f2
synced-at: "2026-11-02"
model: claude-sonnet-5
mode: UPDATE
Expand Down
10 changes: 5 additions & 5 deletions .translate/state/oop_intro.md.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-sha: 126eb49056ad1b685638c1820ebb7b4c89cabf89
synced-at: "2026-03-20"
model: claude-sonnet-4-6
mode: NEW
source-sha: e2d28d003d61f45bf75e790a94b8d478ed0902f2
synced-at: "2026-11-02"
model: claude-sonnet-5
mode: UPDATE
section-count: 6
tool-version: 0.13.0
tool-version: 0.30.0
10 changes: 5 additions & 5 deletions .translate/state/python_oop.md.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-sha: 8973c2e03fe820f44b841b2e13ed4107500a1226
synced-at: "2026-03-20"
model: claude-sonnet-4-6
mode: NEW
source-sha: e2d28d003d61f45bf75e790a94b8d478ed0902f2
synced-at: "2026-11-02"
model: claude-sonnet-5
mode: UPDATE
section-count: 5
tool-version: 0.13.0
tool-version: 0.30.0
5 changes: 3 additions & 2 deletions lectures/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ translation:
在本讲座中,我们将

1. 系统地介绍函数,涵盖语法和使用场景,以及
2. 学习构建我们自己的用户自定义函数。
2. 学习如何构建我们自己的用户自定义函数。

我们将使用以下导入。

Expand Down Expand Up @@ -294,6 +294,7 @@ quad(lambda x: x**3, 0, 2)

## 应用


### 随机抽取
Comment on lines 296 to 298

再次考虑 {doc}`前一讲 <python_by_example>` 中的以下代码
Expand Down Expand Up @@ -432,7 +433,7 @@ m(7, 2, 4)

基本上,递归函数是一个调用自身的函数。

例如,考虑在某个 t 时计算 $x_t$ 的问题,其中
例如,考虑在某个 $t$ 时计算 $x_t$ 的问题,其中

```{math}
:label: xseqdoub
Expand Down
4 changes: 2 additions & 2 deletions lectures/oop_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ x.__class__

* 例如,`imag` 和 `__class__` 是 `x` 的属性。

从这个例子中我们可以看到,对象具有包含辅助信息的属性。
我们从这个例子中可以看到,对象具有包含辅助信息的属性。

它们还具有像函数一样起作用的属性,称为*方法*。

Expand Down Expand Up @@ -403,4 +403,4 @@ print(callablels)
```

```{solution-end}
```
```
10 changes: 5 additions & 5 deletions lectures/python_oop.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ x.__class__

```{code-cell} python3
def earn(w,y):
"Consumer with inital wealth w earns y"
"Consumer with initial wealth w earns y"
return w+y

def spend(w,x):
Expand Down Expand Up @@ -210,7 +210,7 @@ print("w0,w1,w2,w3,w4 = ", w0,w1,w2,w3,w4)

*类*将与特定*实例*绑定的一组数据与一组对数据进行操作的函数捆绑在一起。

在我们的示例中,*实例*将是特定*人*的名字,其*实例数据*仅由其财富组成。
在我们的示例中,*实例*将是某个特定*人*的名字,其*实例数据*仅由其财富组成。

(在其他示例中,*实例数据*将由一组数据向量组成。)

Expand All @@ -230,7 +230,7 @@ print("w0,w1,w2,w3,w4 = ", w0,w1,w2,w3,w4)

尽管有些刻意,这个类的示例帮助我们内化一些特殊的语法。

以下是我们如何设置消费者类。
以下是我们如何设置消费者类的方法。

```{code-cell} python3
class Consumer:
Expand All @@ -247,7 +247,7 @@ class Consumer:
"The consumer spends x dollars if feasible"
new_wealth = self.wealth - x
if new_wealth < 0:
print("Insufficent funds")
print("Insufficient funds")
else:
self.wealth = new_wealth
```
Expand Down Expand Up @@ -909,4 +909,4 @@ class Polynomial:
```

```{solution-end}
```
```
Loading