流程控制之while迴圈
阿新 • • 發佈:2021-06-29
\[X=\left|
\begin{matrix}
x_{11} & x_{12} & \cdots & x_{1d}\\
x_{21} & x_{22} & \cdots & x_{2d}\\
\vdots & \vdots & \ddots & \vdots \\
x_{11} & x_{12} & \cdots & x_{1d}\\
\end{matrix}
\right|
\]\[\begin{matrix}
1 & x & x^2\\
1 & y & y^2\\
1 & z & z^2\\
\end{matrix}
\]\[\left\{
\begin{array}{c}
a_1x+b_1y+c_1z=d_1\\
a_2x+b_2y+c_2z=d_2\\
a_3x+b_3y+c_3z=d_3
\end{array}
\right\}
\]\[X=\begin{pmatrix}
0&1&1\\
1&1&0\\
1&0&1\\
\end{pmatrix}
\]
1. 希臘字母表
\(\Sigma\)
-
上下標、根號、省略號
- 下標:_ $ x^2$
- 上標:^ \(x_i\)
- 根號:\sqrt \(y\sqrt{x}\)
- 省略號:\(\dots\) \(\cdots\) \(\ddots\)
- 括號
-
運算子
- 求和: \(\sum_1^n\)
- 積分:\(\int_1^n\)
- 極限:\(lim_{x \to \infty}\)
- 分數:$\frac{2}{3} $
-
箭頭
\(\leftarrow \Longrightarrow\)
-
分段函式
\[f(n)= \begin{cases} n/2, & \text{if $n$ is even}\\ 3n+1,& \text{if $n$ is odd} \end{cases} \] -
方程組
\[\left. \left\{ \begin{array}{c} a_1x+b_1y+c_1z=d_1\\ a_2x+b_2y+c_2z=d_2\\ a_3x+b_3y+c_3z=d_3 \end{array} \right. \right> \] -
矩陣
7.1 基本語法
- 起始標記
\begin{matrix}
,結束標記\end{matrix}
- 每一行末尾標記
\\
- 行間元素之間用
&
分隔。
7.2 矩陣邊框
- 起始標記
\[\begin{vmatrix} 0&1&1\\ 1&1&0\\ 1&0&1\\ \end{vmatrix} \]
- 在起始、結束標記用下列詞替換
matrix
pmatrix
:小括號邊框bmatrix
:中括號邊框Bmatrix
:大括號邊框vmatrix
:單豎線邊框Vmatrix
:雙豎線邊框
7.3 省略元素
\[\begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\ \end{bmatrix} \]
- 橫省略號:
\cdots
- 豎省略號:
\vdots
- 斜省略號:
\ddots
7.4 陣列
- 需要array環境:起始、結束處以{array}宣告
- 對齊方式:在{array}後以{}逐行統一宣告
- 左對齊:
l
居中:c
右對齊:r
- 豎直線:在宣告對齊方式時,插入
|
建立豎直線- 插入水平線:
\hline
舉例:
\[\begin{array}{c|lll} {↓}&{a}&{b}&{c}\\ \hline {R_1}&{c}&{b}&{a}\\ {R_2}&{b}&{c}&{c}\\ \end{array} \]-
常用公式
8.1 線性模型
8.2 均方誤差
\[J(\theta) = \frac{1}{2m}\sum_{i=0}^m(y^i - h_\theta(x^i))^2 \]8.3 求積
\[H_c=\sum_{l_1+\dots +l_p}\prod^p_{i=1} \binom{n_i}{l_i} \]8.4 批梯度下降
\[\frac{\partial J(\theta)}{\partial\theta_j} = -\frac1m\sum_{i=0}^m(y^i - h_\theta(x^i))x^i_j \]\[\begin{align} \frac{\partial J(\theta)}{\partial\theta_j} & = -\frac1m\sum_{i=0}^m(y^i - h_\theta(x^i)) \frac{\partial}{\partial\theta_j}(y^i-h_\theta(x^i))\\ & = -\frac1m\sum_{i=0}^m(y^i-h_\theta(x^i)) \frac{\partial}{\partial\theta_j}(\sum_{j=0}^n\theta_j x^i_j-y^i)\\ &=-\frac1m\sum_{i=0}^m(y^i -h_\theta(x^i)) x^i_j \end{align} \]引用: