Typora中利用LaTeX 插入数学公式
Typora中利用LaTeX 插入数学公式
LaTeX 插入数学公式
利用Typora进行资料总结时,遇见公式,一般的方法是剪切粘贴,但过于麻烦,因此学习利用LaTeX进行公式编辑,Typora对Latex进行了很好的支持,对Latex插入公式进行简单总结学习
本文内容参考https://blog.csdn.net/baidu_38060633/article/details/79183905 在Typora上进行了实验。
LaTeX 编辑数学公式基本语法元素
数学公式有两种形式: inline 和 display
- 
**inline(行间公式)😗*在正文插入数学公式,用 $...$将公式括起来
- 
display(快间公式) :独立排列的公式,用 $$...$$将公式括起来,默认显示在行中间
- 
各类希腊字母表: eg: $\alpha$:α\alphaα
上下标、根号、省略号
- 
下标:_ eg: xix_ixi 
- 
上标:^ eg: $ x^2$ 注意:上下标如果多于一个字母或者符号,需要用一对{}括起来 eg: xi1x_{i1}xi1 、xαtx^{\alpha t}xαt 
- 
根号:\sqrt eg: 5n\sqrt[n]{5}n5 
- 
省略号:\dots \cdots 分别表示 …\dots… $ \cdots$ 
运算符
基本预算符: ±\pm± ÷\div÷
- 
求和: \sum_1^n :∑1n\sum_1^n∑1n 
- 
积分:\int_1^n: ∫1n\int_1^n∫1n 
- 
**极限:**lim_{x \to \infty} : $ lim_{x \to \infty}$ 
- 
分数:\frac{}{} 如:38\frac{3}{8}83 
- 
矩阵与行列式 矩阵: $$\begin{matrix}...\end{matrix}$$,使用&分隔同行元素,\ 换行。eg:
$$
	\begin{matrix}
	1 & x & x^2\\
	1 & y & y^2\\
	1 & z & z^2\\
	\end{matrix}
$$
1xx21yy21zz2 \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} 111xyzx2y2z2
	行列式:
$$
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|
$$
X=∣x11x12⋯x1dx21x22⋯x2d⋮⋮⋱⋮x11x12⋯x1d∣ 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| X=∣∣∣∣∣∣∣∣∣x11x21⋮x11x12x22⋮x12⋯⋯⋱⋯x1dx2d⋮x1d∣∣∣∣∣∣∣∣∣
- 分隔符
各种括号用 () [] { } \langle\rangle 等命令表示,注意花括号通常用来输入命令和环境的参数,所以在数学公式中它们前面要加 \。可以在上述分隔符前面加 \big \Big \bigg \Bigg 等命令来调整大小。
- 箭头
$\leftarrow$
←\leftarrow←
- 
方程式 E=mc^2E=mc2 E=mc^2 E=mc2 
- 
分段函数 $$ f(n)= \begin{cases} n/2, & \text{if $n$ is even}\\ 3n+1,& \text{if $n$ is odd} \end{cases} $$f(n)={n/2,if n is even3n+1,if n is odd f(n)= \begin{cases} n/2, & \text{if $n$ is even}\\ 3n+1,&\text{if $n$ is odd} \end{cases} f(n)={n/2,3n+1,if n is evenif n is odd 
- 
方程组 $$ \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. $${a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3 \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. ⎩⎨⎧a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3 
常用公式
- 线性模型
$$
	h(\theta) = \sum_{j=0} ^n \theta_j x_j
$$
h(θ)=∑j=0nθjxj h(\theta) = \sum_{j=0} ^n \theta_j x_j h(θ)=j=0∑nθjxj
- 
均方误差 $$ J(\theta) = \frac{1}{2m}\sum_{i=0}^m(y^i - h_\theta(x^i))^2 $$J(θ)=12m∑i=0m(yi−hθ(xi))2 J(\theta) = \frac{1}{2m}\sum_{i=0}^m(y^i - h_\theta(x^i))^2 J(θ)=2m1i=0∑m(yi−hθ(xi))2 
- 
求积公式 \$$ H_c=\sum_{l_1+\dots +l_p}\prod^p_{i=1} \binom{n_i}{l_i} \$$
Hc=∑l1+⋯+lp∏i=1p(nili) H_c=\sum_{l_1+\dots +l_p}\prod^p_{i=1} \binom{n_i}{l_i} Hc=l1+⋯+lp∑i=1∏p(lini)
- 
批量梯度下降 $$ \frac{\partial J(\theta)}{\partial\theta_j} = -\frac1m\sum_{i=0}^m(y^i - h_\theta(x^i))x^i_j $$∂J(θ)∂θj=−1m∑i=0m(yi−hθ(xi))xji \frac{\partial J(\theta)}{\partial\theta_j} = -\frac1m\sum_{i=0}^m(y^i - h_\theta(x^i))x^i_j ∂θj∂J(θ)=−m1i=0∑m(yi−hθ(xi))xji 
- 
推导过程 $$ \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} $$KaTeX parse error: Expected 'EOF', got '&' at position 48: …tial\theta_j} &̲ = -\frac1m\sum… 
添加内容:
1.字符下标
\(maxa<x<b{f(x)}\max \limits_{a<x<b}\{f(x)\}a<x<bmax{f(x)}\)
$$
\max \limits_{a<x<b}\{f(x)\}	
$$
 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号