Skip to content

Commit e0725cb

Browse files
authored
Add files via upload
1 parent c707498 commit e0725cb

5 files changed

+672
-0
lines changed

LA_01_02_坐标系.pdf

1.37 MB
Binary file not shown.

LA_01_03_01.ipynb

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "f04dd603-a2d1-48ce-8c17-9f1dba8de1ee",
6+
"metadata": {},
7+
"source": [
8+
"Chapter 01\n",
9+
"\n",
10+
"# 向量加法\n",
11+
"《线性代数》 | 鸢尾花书:数学不难"
12+
]
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"id": "ccafb456-2453-4c82-8a65-b1963a370cb2",
17+
"metadata": {},
18+
"source": [
19+
"代码的目标是演示**向量加法**的数学原理,并计算两个二维向量的和。我们详细分析其数学背景和计算过程。\n",
20+
"\n",
21+
"---\n",
22+
"\n",
23+
"### **1. 向量的数学表示**\n",
24+
"在二维欧几里得空间 $\\mathbb{R}^2$ 中,一个向量可以表示为:\n",
25+
"\n",
26+
"$$\n",
27+
"\\mathbf{a} = \\begin{bmatrix} a_1 \\\\ a_2 \\end{bmatrix}, \\quad\n",
28+
"\\mathbf{b} = \\begin{bmatrix} b_1 \\\\ b_2 \\end{bmatrix}\n",
29+
"$$\n",
30+
"\n",
31+
"在代码中:\n",
32+
"- 向量 $\\mathbf{a}$ 由 `a_vec = np.array([4, 1])` 赋值,其中 $a_1 = 4, a_2 = 1$。\n",
33+
"- 向量 $\\mathbf{b}$ 由 `b_vec = np.array([1, 2])` 赋值,其中 $b_1 = 1, b_2 = 2$。\n",
34+
"\n",
35+
"---\n",
36+
"\n",
37+
"### **2. 向量加法的数学定义**\n",
38+
"向量加法的运算规则是按分量相加,即:\n",
39+
"\n",
40+
"$$\n",
41+
"\\mathbf{a} + \\mathbf{b} =\n",
42+
"\\begin{bmatrix} a_1 \\\\ a_2 \\end{bmatrix} +\n",
43+
"\\begin{bmatrix} b_1 \\\\ b_2 \\end{bmatrix} =\n",
44+
"\\begin{bmatrix} a_1 + b_1 \\\\ a_2 + b_2 \\end{bmatrix}\n",
45+
"$$\n",
46+
"\n",
47+
"代入具体数值:\n",
48+
"\n",
49+
"$$\n",
50+
"\\begin{bmatrix} 4 \\\\ 1 \\end{bmatrix} +\n",
51+
"\\begin{bmatrix} 1 \\\\ 2 \\end{bmatrix} =\n",
52+
"\\begin{bmatrix} 4 + 1 \\\\ 1 + 2 \\end{bmatrix} =\n",
53+
"\\begin{bmatrix} 5 \\\\ 3 \\end{bmatrix}\n",
54+
"$$\n",
55+
"\n",
56+
"在代码中:\n",
57+
"```python\n",
58+
"a_plus_b = a_vec + b_vec\n",
59+
"```\n",
60+
"执行的是 NumPy 数组的逐元素加法,返回 $\\begin{bmatrix} 5 \\\\ 3 \\end{bmatrix}$。\n",
61+
"\n",
62+
"---\n",
63+
"\n",
64+
"### **3. 计算结果**\n",
65+
"执行 `a_plus_b` 之后,Python 计算出的结果是:\n",
66+
"```python\n",
67+
"array([5, 3])\n",
68+
"```\n",
69+
"这正是数学计算得出的 $\\mathbf{a} + \\mathbf{b}$ 的值。\n",
70+
"\n",
71+
"---"
72+
]
73+
},
74+
{
75+
"cell_type": "markdown",
76+
"id": "d6e57ed8-33df-433f-9e7e-717f21e198d6",
77+
"metadata": {},
78+
"source": [
79+
"## 初始化"
80+
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": 1,
85+
"id": "79c8f4f2-d504-41f4-82e5-a06716cbf6ea",
86+
"metadata": {},
87+
"outputs": [],
88+
"source": [
89+
"import numpy as np"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"id": "6670ff2f-380b-4932-b22b-cbfe2efc825b",
95+
"metadata": {},
96+
"source": [
97+
"## 定义向量"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 2,
103+
"id": "e28b3f7e-8fbe-4ba4-91dd-010623fbd111",
104+
"metadata": {},
105+
"outputs": [],
106+
"source": [
107+
"a_vec = np.array([4, 1])\n",
108+
"b_vec = np.array([1, 2])"
109+
]
110+
},
111+
{
112+
"cell_type": "markdown",
113+
"id": "cf0bea02-16b3-4340-86d1-ffcd2f1835de",
114+
"metadata": {},
115+
"source": [
116+
"## 向量加法"
117+
]
118+
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": 3,
122+
"id": "3a48970a-ea1f-4c59-968a-dcdb1f0d5daf",
123+
"metadata": {},
124+
"outputs": [
125+
{
126+
"data": {
127+
"text/plain": [
128+
"array([5, 3])"
129+
]
130+
},
131+
"execution_count": 3,
132+
"metadata": {},
133+
"output_type": "execute_result"
134+
}
135+
],
136+
"source": [
137+
"a_plus_b = a_vec + b_vec\n",
138+
"a_plus_b"
139+
]
140+
},
141+
{
142+
"cell_type": "markdown",
143+
"id": "582f5109-82df-4493-bf02-0152e0603fe8",
144+
"metadata": {},
145+
"source": [
146+
"作者\t**生姜DrGinger** \n",
147+
"脚本\t**生姜DrGinger** \n",
148+
"视频\t**崔崔CuiCui** \n",
149+
"开源资源\t[**GitHub**](https://github.com/Visualize-ML) \n",
150+
"平台\t[**油管**](https://www.youtube.com/@DrGinger_Jiang)\t\t\n",
151+
"\t\t[**iris小课堂**](https://space.bilibili.com/3546865719052873)\t\t\n",
152+
"\t\t[**生姜DrGinger**](https://space.bilibili.com/513194466) "
153+
]
154+
}
155+
],
156+
"metadata": {
157+
"kernelspec": {
158+
"display_name": "Python [conda env:base] *",
159+
"language": "python",
160+
"name": "conda-base-py"
161+
},
162+
"language_info": {
163+
"codemirror_mode": {
164+
"name": "ipython",
165+
"version": 3
166+
},
167+
"file_extension": ".py",
168+
"mimetype": "text/x-python",
169+
"name": "python",
170+
"nbconvert_exporter": "python",
171+
"pygments_lexer": "ipython3",
172+
"version": "3.12.7"
173+
}
174+
},
175+
"nbformat": 4,
176+
"nbformat_minor": 5
177+
}

LA_01_03_02.ipynb

+245
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)