Skip to content
Open
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
8 changes: 4 additions & 4 deletions .translate/state/about_py.md.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-sha: 9490497982787a5b0eb54ee1dcd73ac326d5ae04
synced-at: "2026-03-20"
source-sha: 3213613a05778899068ddb92336dfe6a58517936
synced-at: "2026-05-09"
model: claude-sonnet-4-6
mode: NEW
mode: UPDATE
section-count: 3
tool-version: 0.13.0
tool-version: 0.15.0
23 changes: 3 additions & 20 deletions lectures/about_py.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ translation:

您**不需要**理解本讲座中看到的所有内容——我们将在后续讲座系列中逐步深入讲解细节。


### 我就不能直接使用大语言模型吗?

不行!
Expand All @@ -78,7 +77,6 @@ translation:

话虽如此,一个好的大语言模型是学习本系列讲座的有用伴侣——试着把本系列中的一些代码复制粘贴过去,并请求它进行解释。


### MATLAB 不是更好吗?

不,不,绝对不是。
Expand All @@ -93,8 +91,6 @@ Nirvana 很伟大(而 Soundgarden [更胜一筹](https://www.youtube.com/watch

我们将在本系列讲座中以及后续关于 [JAX](https://jax.quantecon.org/intro.html) 的系列中讨论 Python 库的相对优势。



## Python 简介

[Python](https://www.python.org) 是一种通用编程语言,由 [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum) 于 1989 年构想创建。
Expand All @@ -107,7 +103,6 @@ Python 是免费且[开源](https://en.wikipedia.org/wiki/Open_source)的,其
* 意味着 Python 由用户社区而非营利性企业控制,以及
* 鼓励可重复性研究和[开放科学](https://en.wikipedia.org/wiki/Open_science)。


### 常见用途

{index}`Python <single: Python; common uses>` 是一种通用语言,几乎在所有应用领域都有使用,包括
Expand All @@ -132,7 +127,6 @@ Python 是免费且[开源](https://en.wikipedia.org/wiki/Open_source)的,其
* [Reddit](https://www.reddit.com/)
* 等等


### 相对流行度

Python 是[最流行的编程语言](https://www.tiobe.com/tiobe-index/)之一——如果不是最流行的话。
Expand All @@ -148,8 +142,6 @@ Python 库,如 [pandas](https://pandas.pydata.org/) 和 [Polars](https://pola.
```
PyTorch 只是 Python 众多深度学习和人工智能库之一。



### 特性

Python 是一种[高级语言](https://en.wikipedia.org/wiki/High-level_programming_language),这意味着它相对容易阅读、编写和调试。
Expand All @@ -160,7 +152,6 @@ Python 是一种[高级语言](https://en.wikipedia.org/wiki/High-level_programm

Python 灵活而务实,支持多种编程风格(过程式、面向对象、函数式等)。


### 语法与设计

```{index} single: Python; syntax and design
Expand Down Expand Up @@ -251,8 +242,6 @@ print(f"Average: {total / count if count else 'No valid data'}")

```



### 与人工智能的关联

人工智能正在接管许多目前由人类执行的任务,就像过去几个世纪其他形式的机械所做的那样。
Expand All @@ -265,7 +254,6 @@ print(f"Average: {total / count if count else 'No valid data'}")

本系列讲座将解释如何做到这一点。


## 使用 Python 进行科学编程

```{index} single: scientific programming
Expand All @@ -286,7 +274,6 @@ Python 在经济学、金融学以及运筹学等相邻领域的应用也在不

本节将简要展示一些 Python 用于通用科学编程的示例。


### NumPy

```{index} single: scientific programming; numeric
Expand Down Expand Up @@ -346,7 +333,6 @@ b @ c

我们将在后续讲座中深入介绍 NumPy 的详细内容。


### NumPy 的替代方案

虽然 NumPy 仍然是 Python 中数组处理的王者,但现在出现了一些重要的竞争者。
Expand Down Expand Up @@ -391,7 +377,6 @@ SciPy 包含许多标准例程,用于

稍后我们将更详细地讨论 SciPy。


### 图形可视化

```{index} single: Matplotlib
Expand Down Expand Up @@ -433,7 +418,6 @@ Python 的一大优势是数据可视化。

您可以访问 [Python Graph Gallery](https://python-graph-gallery.com/) 查看使用各种库绘制的更多示例图表。


### 网络与图

[网络](https://networks.quantecon.org/)研究正在成为经济学、金融学和其他领域科学工作的重要组成部分。
Expand Down Expand Up @@ -462,10 +446,10 @@ Python 拥有许多用于研究网络和图的库。
```{code-cell} ipython
import networkx as nx
import matplotlib.pyplot as plt
np.random.seed(1234)
rng = np.random.default_rng(1234)

# 生成随机图
p = dict((i, (np.random.uniform(0, 1), np.random.uniform(0, 1)))
p = dict((i, (rng.uniform(0, 1), rng.uniform(0, 1)))
for i in range(200))
g = nx.random_geometric_graph(200, 0.12, pos=p)
pos = nx.get_node_attributes(g, 'pos')
Expand All @@ -487,7 +471,6 @@ nx.draw_networkx_nodes(g,
plt.show()
```


### 其他科学库

如上所述,Python 有数以千计的科学库。
Expand All @@ -511,4 +494,4 @@ plt.show()
* [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) — 用于从 HTML 和 XML 文件中提取数据


在本系列讲座中,我们将学习如何使用这些库中的许多库来完成经济学和金融学中的科学计算任务。
在本系列讲座中,我们将学习如何使用这些库中的许多库来完成经济学和金融学中的科学计算任务。
Loading