数学表达式基础——2 集合、向量与矩阵
文章目錄
- 1 集合
- 1.1 集合的表示方法
- 1. 2 常用的集合
- 1.3 元素與子集
- 1.4 集合運算
 
- 2 簇
- 3 向量
- 4 矩陣
1 集合
1.1 集合的表示方法
| 枚舉法 | 1) A={0,1,2,3,4,5,6,7,8,9}\mathbf{A} = \{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}A={0,1,2,3,4,5,6,7,8,9}是阿拉伯數字的集合 2)N={0,1,2,…,}2) \mathbf{N} = \{0, 1, 2, \dots,\}2)N={0,1,2,…,}是自然數的集合 3)Ω={a,b,…,z}3) \mathbf{\Omega} = \{\textrm{a}, \textrm{b}, \dots, \textrm{z}\}3)Ω={a,b,…,z}是英文字母表 | 1) \mathbf{A} = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 2) \mathbf{N} = {0, 1, 2, \dots,} 3) mathbf{\Omega} = {\textrm{a}, \textrm{b}, \dots, \textrm{z}} | 易錯的三個坑: 1) 逗號前無空格,逗號后有空格; 2) 集合要用加粗; 3) 集合用{ },且元素無序 | 
| 枚舉的簡記法 | 1) 兩個整數間的枚舉集合: [1..10]={1,2,…,10}[1 ..10] = \{1, 2, \dots, 10\}[1..10]={1,2,…,10} 2) 區間:(3, 5)[3,5) … 3) X={xi}i=1n={x1,…,xn}\mathbf{X} = \{ x_i\}_{i=1}^n = \{ x_1, \dots, x_n\}X={xi?}i=1n?={x1?,…,xn?} | 1) [1. .10] = {1, 2, \dots, 10} 2)(3, 5)[3,5) 3) \mathbf{X} = { x_i}_{i=1}^n = {x_1, \dots, x_n} | |
| 謂詞法 | 奇數的集合: O={x∣x∈N,xmod2=1}\mathbf{O} = \{ x \vert x \in \mathbf{N}, x \mod 2 = 1\}O={x∣x∈N,xmod2=1} 或 O={x∈N∣xmod2=1}\mathbf{O} = \{ x \in \mathbf{N} \vert x \mod 2 = 1\}O={x∈N∣xmod2=1} | 1) mathbf{O} = { x \vert x \in \mathbf{N}, x \mod 2 = 1} 2) \mathbf{O} = { x \in \mathbf{N} \vert x \mod 2 = 1} | 第2種寫法,通常把基本的限制寫在左邊,但是只能寫一個條件 | 
1. 2 常用的集合
| 實數 | R(常用,推薦)\mathbb{R}(常用,推薦)R(常用,推薦) R\mathcal{R}R(可以接受) | \mathbb{R} \mathcal{R} | R\mathbb{R}R是實數專用,不能另做他用 | 
| 空集 | ?\emptyset? | \emptyset | ?\phi?(\phi)是錯誤的表達 | 
| 全集 | U\mathbf{U}U | \mathbf{U} | 
1.3 元素與子集
| 元素 | x∈Xx \in \mathbf{X}x∈X | x \in \mathbf{X} | 元素xxx與集合X\mathbf{X}X的關系 | 
| 子集 | A?B\mathbf{A} \subset \mathbf{B}A?B | \mathbf{A} \subset \mathbf{B} | 集合A與集合B的關系 | 
| 子集 | A?B\mathbf{A} \subseteq \mathbf{B}A?B | \mathbf{A} \subseteq \mathbf{B} | 集合A與集合B的關系 | 
1.4 集合運算
| 基 | ∣X∣\vert \mathbf{X} \vert∣X∣ | \vert \mathbf{X} \vert | 集合X\mathbf{X}X中元素的個數 ∣?∣=0\vert \emptyset \vert = 0∣?∣=0 | 
| 并 | 1) X∪Y\mathbf{X} \cup \mathbf{Y}X∪Y 2) ?i=1nXi\bigcup_{i=1}^n \mathbf{X}_i?i=1n?Xi? | 1) \mathbf{X} \cup \mathbf{Y} 2) \bigcup_{i=1}^n \mathbf{X}_i | 1) 兩個集合并 2) n個集合并 | 
| 交 | 1) X∩Y\mathbf{X} \cap \mathbf{Y}X∩Y 2) ?i=1nXi\bigcap_{i=1}^n \mathbf{X}_i?i=1n?Xi? | 1) \mathbf{X} \cap \mathbf{Y} 2) \bigcap_{i=1}^n \mathbf{X}_i | 1) 兩個集合并交 2) n個集合交 | 
| 差 | X?Y\mathbf{X} \setminus \mathbf{Y}X?Y | \mathbf{X} \setminus \mathbf{Y} | 兩個集合差 | 
| 補 | X ̄=U?X\overline{\mathbf{X}} = \mathbf{U} \setminus \mathbf{X}X=U?X | \overline{\mathbf{X}} = \mathbf{U} \setminus \mathbf{X} | 全集U\mathbf{U}U 有人用?X\neg \mathbf{X}?X 可以接受,但不建議 | 
| 冪集 | 2A={B∣B?A}2^\mathbf{A} = \{ \mathbf{B} \vert \mathbf{B} \subseteq \mathbf{A}\}2A={B∣B?A} | 2^\mathbf{A} = { \mathbf{B} \vert \mathbf{B} \subseteq \mathbf{A}} | 例如:A={0,1,2}\mathbf{A} = \{0, 1, 2\}A={0,1,2},則: 1)2A={?,{0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}}2^\mathbf{A} = \{\emptyset, \{0\}, \{1\}, \{2\}, \{0, 1\}, \{0, 2\}, \{1, 2\}, \{0, 1, 2\}\}2A={?,{0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}} 2) ∣2A∣=2∣A∣=23=8\vert 2^\mathbf{A} \vert = 2 ^{\vert \mathbf{A}}\vert = 2^3 = 8∣2A∣=2∣A∣=23=8 3)B?A\mathbf{B} \subseteq \mathbf{A}B?A 與 B∈2A\mathbf{B} \in 2^\mathbf{A}B∈2A等價 | 
| 笛卡爾積 | A×B={(a,b)∣a∈A,b∈B}\mathbf{A} \times \mathbf{B} = \{(a, b) \vert a \in \mathbf{A}, b \in \mathbf{B}\}A×B={(a,b)∣a∈A,b∈B} | \mathbf{A} \times \mathbf{B} = {(a, b) \vert a \in \mathbf{A}, b \in \mathbf{B}} | A\mathbf{A}A和B\mathbf{B}B各出一個元素,組成一個新的元素對 (a,b)≠(b,a)(a, b) \neq (b, a)(a,b)?=(b,a),所以 A×B≠B×A\mathbf{A} \times \mathbf{B} \neq \mathbf{B} \times \mathbf{A}A×B?=B×A 對于有窮集合: ∣A×B∣=∣A∣×∣B∣\vert \mathbf{A} \times \mathbf{B} \vert = \vert \mathbf{A}\vert \times \vert \mathbf{B} \vert∣A×B∣=∣A∣×∣B∣ | 
2 簇
集合的集合稱為簇,一般用\mathcal符號表示
| 簇 | B={B1,…,BN}\mathcal{B} = \{ \mathbf{B}_1, \dots, \mathbf{B}_N\}B={B1?,…,BN?}, where Bi={xi1,…,xij}\mathbf{B}_i=\{ \mathbf{x}_{i1}, \dots, \mathbf{x}_{ij}\}Bi?={xi1?,…,xij?} | \mathcal{B} = { \mathbf{B}_1, \dots, \mathbf{B}N}, \mathbf{B}i={ \mathbf{x}{i1}, \dots, \mathbf{x}{ij}} | 即xij\mathbf{x}_{ij}xij?是Bi\mathbf{B}_iBi?中的一個向量,Bi\mathbf{B}_iBi?是向量的集合,而B\mathcal{B}B是Bi\mathbf{B}_iBi?的集合 | 
| 簇的并運算 | ∪B=∪{B1,…,BN}=?i=1N{Bi}=B1∪B2∪?∪BN\cup \mathcal{B} =\cup \{ \mathbf{B}_1, \dots, \mathbf{B}_N\} =\bigcup_{i=1}^N\{B_i\} = \mathbf{B}_1\cup \mathbf{B}_2\cup\dots\cup \mathbf{B}_N∪B=∪{B1?,…,BN?}=?i=1N?{Bi?}=B1?∪B2?∪?∪BN? | \cup \mathcal{B} =\cup { \mathbf{B}_1, \dots, \mathbf{B}N} =\bigcup{i=1}^N{B_i} = \mathbf{B}_1\cup \mathbf{B}_2\cup\dots\cup \mathbf{B}_N | 即進行“解簇”運算,讓所有集合并成了一個集合。 | 
例1:
 
上式描述,xij\mathbf{x}_{ij}xij?屬于標簽為正的包Bi\mathbf{B}_iBi?, 但是謂詞法(\vert)標準用法是用于集合。
 但如果這里加上括號,即:xij∈{Bi∣yi=+1}\mathbf{x}_{ij} \in \{\mathbf{B}_i \vert y_i=+1\}xij?∈{Bi?∣yi?=+1},那么一個向量xij\mathbf{x}_{ij}xij?屬于一個簇,則是不對的。
 解決:
 xij∈∪{Bi∣yi=+1}\mathbf{x}_{ij} \in \cup\{\mathbf{B}_i \vert y_i=+1\}xij?∈∪{Bi?∣yi?=+1},這樣就可以啦。
例2:
 
上式想表示X1?\mathbf{X}_1^*X1??是一個Bi\mathbf{B}_iBi?的一個并集,并且Bi\mathbf{B}_iBi?是標簽為-1的包,且屬于B\mathcal{B}B。
 但是,\vert這種表示,都是集合的謂詞描述方法,那么,上式可以改寫為:
 X1?=?{Bi∈B∣yi=?1}\mathbf{X}_1^*=\bigcup \{\mathbf{B}_i \in \mathcal{B}\vert y_i=-1\}X1??=?{Bi?∈B∣yi?=?1}
3 向量
表示向量用( )或 [ ] ;
 向量通常用小寫加粗符號,如: \mathbf{x} \bm{x} \boldsymbol{x}
| 列向量 | 1) x∈Rm\mathbf{x} \in \mathbb{R}^mx∈Rm 2) x=(x1;x2;…;xn)\mathbf{x} = (x_1; x_2; \dots; x_n)x=(x1?;x2?;…;xn?), xi∈Rx_i \in \mathbb{R}xi?∈R | 1) \mathbf{x} \in \mathbb{R}^m 2) \mathbf{x} = ( x_1; x_2; \dots; x_n) | m*1維空間的一個點 | 
| 行向量 | 1) x∈R1?m\mathbf{x} \in \mathbb{R}^{1*m}x∈R1?m 2) x=(x1,x2,…,xn)\mathbf{x} = ( x_1, x_2, \dots, x_n)x=(x1?,x2?,…,xn?), xi∈Rx_i \in \mathbb{R}xi?∈R | 1) \mathbf{x} \in \mathbb{R}^{1*m} 2) \mathbf{x} = ( x_1, x_2, \dots, x_n) | 1*m維空間的一個點 | 
| 轉置 | x=(x1,x2,…,xn)\mathbf{x} = ( x_1, x_2, \dots, x_n)x=(x1?,x2?,…,xn?),則 xT=(x1;x2;…;xn)\mathbf{x}^{\mathrm{T}} = ( x_1; x_2; \dots; x_n)xT=(x1?;x2?;…;xn?) | \mathbf{x}^{\mathrm{T}} = ( x_1; x_2; \dots; x_n) | |
| 內積(點積) | a?b=abT=∑i=1naibi\mathbf{a} \cdot \mathbf{b} = \mathbf{a}\mathbf{b}^\mathrm{T} = \sum_{i=1}^n a_ib_ia?b=abT=∑i=1n?ai?bi? | \mathbf{a} \cdot \mathbf{b} = \mathbf{a}\mathbf{b}^\mathrm{T} = \sum_{i=1}^n a_ib_i | 機器學習里面,常用于求向量的加權和: x?w=xwT=∑i=1nxiwi\mathbf{x} \cdot \mathbf{w} = \mathbf{x}\mathbf{w}^\mathrm{T} = \sum_{i=1}^n x_iw_ix?w=xwT=∑i=1n?xi?wi? | 
4 矩陣
| m行n列的矩陣 | 1) X∈Rm×n\mathbf{X} \in \mathbb{R}^{m \times n}X∈Rm×n 2) X=[xij]m×n\mathbf{X} = [x_{ij}]_{m \times n}X=[xij?]m×n?, xij∈Rx_{ij} \in \mathbb{R}xij?∈R | 1) \mathbf{X} \in \mathbb{R}^{m \times n} 2) \mathbf{X} = [x_{ij}]_{m \times n} | m×nm \times nm×n 維空間的一個點 | 
| 機器學習的特殊表示 | X={xi}i=1m={x1,x2,…,xm}.\mathbf{X} = \{ \mathbf{x}_i\}_{i=1}^m = \{ \mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_m\}.X={xi?}i=1m?={x1?,x2?,…,xm?}. 其中,xi=(xi1,xi2,…,xin)\mathbf{x}_i = ( x_{i1}, x_{i2}, \dots, x_{in})xi?=(xi1?,xi2?,…,xin?) | 描述的是,X\mathbf{X}X包括m個實例,每個示例用n個屬性表示。X\mathbf{X}X是集合,后者是向量。 好處:方便表示實例和特征值的關系 缺點:X\mathbf{X}X不能參與矩陣運算 若實在需要,只能適當犧牲嚴謹性,做一些說明,如: in the following context, $\mathbf{X} is alos treated as [x1,x2,…,xn]T[\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_n]^\mathrm{T}[x1?,x2?,…,xn?]T to surpport matrix operations. | 
總結
以上是生活随笔為你收集整理的数学表达式基础——2 集合、向量与矩阵的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: system的用法,多样用法、有趣的sy
- 下一篇: 期末了给孩子们一些鼓励吧!用Python
