Loading

Latex学习

\[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: \(\Sigma\)

2. 上下标、根号、省略号

  • 下标:_ x^2 \(\Longrightarrow\) $ x^2$

  • 上标:^ x_i\(\Longrightarrow\) \(x_i\)

  • 根号:\sqrt | y\sqrt{x}\(\Longrightarrow\) \(y\sqrt{x}\)

  • 省略号:

    \dots \(\Longrightarrow\dots\)

    \cdots \(\Longrightarrow\cdots\)

    \ddots \(\Longrightarrow\ddots\)

  • 括号

3. 运算符

  • 求和: \sum_1^n\(\Longrightarrow\) \(\sum_1^n\)
  • 积分:\int_1^n \(\Longrightarrow\) \(\int_1^n\)
  • 极限:lim_{x \to \infty}\(\Longrightarrow\) \(lim_{x \to \infty}\)
  • 分数:\frac{2}{3} \(\Longrightarrow\) $\frac{2}{3} $

4. 箭头

\leftarrow对应 \(\leftarrow\)

5. 分段函数

f(n)=
	\begin{cases}
		n/2, & \text{if $n$ is even}\\
		3n+1,& \text{if $n$ is odd}
	\end{cases}

\[f(n)= \begin{cases} n/2, & \text{if $n$ is even}\\ 3n+1,& \text{if $n$ is odd} \end{cases} \]

6. 方程组

\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>

\[\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.矩阵

7.1 基本语法

  • 起始标记 \begin{matrix},结束标记 \end{matrix}
  • 每一行末尾标记 \\
  • 行间元素之间用 & 分隔。
\begin{matrix}
0&1&1\\
1&1&0\\
1&0&1\\
\end{matrix}

\[\begin{matrix} 0&1&1\\ 1&1&0\\ 1&0&1\\ \end{matrix} \]

7.2 矩阵边框

  • 在起始、结束标记用下列词替换 matrix
  • pmatrix:小括号边框
  • bmatrix:中括号边框
  • Bmatrix:大括号边框
  • vmatrix:单竖线边框
  • Vmatrix:双竖线边框
\begin{vmatrix}
0&1&1\\
1&1&0\\
1&0&1\\
\end{vmatrix}

\[\begin{vmatrix} 0&1&1\\ 1&1&0\\ 1&0&1\\ \end{vmatrix} \]

7.3 省略元素

  • 横省略号:\cdots
  • 竖省略号:\vdots
  • 斜省略号:\ddots
\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}

\[\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} \]

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}

\[\begin{array}{c|lll} {↓}&{a}&{b}&{c}\\ \hline {R_1}&{c}&{b}&{a}\\ {R_2}&{b}&{c}&{c}\\ \end{array} \]

  • 需要array环境:起始、结束处以{array}声明

7.5 等号上下文字

\arrowname[sub-script]{super-script}
  • arrowname具体见下面,等号名称
  • sub-script 代表等号下面内容
  • super-script 代表等号上面内容

8.常用公式

8.1 线性模型

h(\theta) = \sum_{j=0} ^n \theta_j x_j

\[h(\theta) = \sum_{j=0} ^n \theta_j x_j \]

8.2 均方误差

J(\theta) = \frac{1}{2m}\sum_{i=0}^m(y^i - h_\theta(x^i))^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}

\[H_c=\sum_{l_1+\dots +l_p}\prod^p_{i=1} \binom{n_i}{l_i} \]

8.4 批梯度下降

\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}

\[\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} \]


引用

posted @ 2021-07-09 18:41  Geoffrey_one  阅读(129)  评论(0编辑  收藏  举报
/*
*/