数学公式用法整理

分段函数

升级后的插件需要双反斜杠“\\\\”,网页才能正确渲染下来

$$
y=
\begin{cases}
-x,\quad x\leq 0 \\
x, \quad x>0
\end{cases}
\tag{1}
$$

方程组

array和aligned都不适配当前需求,直接用cases环境

$$
\begin{cases}
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{cases}
$$

均方误差

$$
J(\theta) = \frac{1}{2m}\sum_{i = 0} ^m(y^i - h_\theta (x^i))^2
$$

批量梯度下降

$$
\frac{\partial J(\theta)}{\partial\theta_j}=-\frac1m\sum_{i=0}^m(y^i-h_\theta(x^i))x^i_j
$$

推导过程

$$
\begin{aligned}
\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_jx_j^i-y^i) \\
& = -\frac1m\sum_{i=0}^m(y^i-h_\theta(x^i))x^i_j
\end{aligned}
$$

case环境的使用

$$
a =
\begin{cases}
\int x, \mathrm{d} x\\
b^2
\end{cases}
$$

带方框的等式

$$
\begin{aligned}
\boxed{x^2+y^2 = z^2}
\end{aligned}
$$

最大(最小)操作符

$$
\begin{gathered}
\operatorname{arg,max}_a f(a)
= \operatorname*{arg,max}_b f(b) \\
\operatorname{arg,min}_c f(c)
= \operatorname*{arg,min}_d f(d)
\end{gathered}
$$

求极限

$$
\begin{aligned}
\lim_{a\to \infty} \tfrac{1}{a}
\end{aligned}
$$
$$
\begin{aligned}
\lim\nolimits_{a\to \infty} \tfrac{1}{a}
\end{aligned}
$$

求积分

$$
\begin{aligned}
\int_a^b x^2 \mathrm{d} x
\end{aligned}
$$
$$
\begin{aligned}
\int\limits_a^b x^2 \mathrm{d} x
\end{aligned}
$$

多行表达公式

$$
\begin{aligned}
J(\mathbf{w})&=\frac{1}{2m}\sum_{i=1}^m(f(\mathbf{x_i})-y_i)^2\\
&=\frac{1}{2m}\sum_{i=1}^m [f(\mathbf{x_i})]^2-2f(\mathbf{x_i)}y_i+y_i^2
\end{aligned}
$$

小括号矩阵

$$\left(
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
\right)
\tag{2}
$$

中括号矩阵

$$\left[
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
\right]
\tag{3}
$$

带省略号的矩阵

$$
\left[
\begin{matrix}
a & b & \cdots & a\\
b & b & \cdots & b\\
\vdots & \vdots & \ddots & \vdots\\
c & c & \cdots & c
\end{matrix}
\right]
\tag{5}
$$

三角函数

$\sin^2\alpha+\cos^2\alpha=1$

$\cfrac{\sin\alpha}{\cos\alpha}=\tan\alpha$

$\sin(2k\pi+\alpha)=\sin\alpha(k\in Z)$

$\cos(2k\pi+\alpha)=\cos\alpha(k\in Z)$

$\tan(2k\pi+\alpha)=\tan\alpha(k\in Z)$

$\cot(2k\pi+\alpha)=\cot\alpha(k\in Z)$

$\sin(\pi+\alpha)=-\sin\alpha$

$\cos(\pi+\alpha)=-\cos\alpha$

$\tan(\pi+\alpha)=\tan\alpha$

$\cot(\pi+\alpha)=\cot\alpha$

$\sin(\cfrac{n\pi}{2}+\alpha) = \begin{cases} (-1)^{\cfrac{n}{2}}\sin\alpha(n为偶数)\\
(-1)^{\cfrac{n-1}{2}}\cos\alpha(n为奇数)\end{cases}$

$\cos(\cfrac{n\pi}{2}+\alpha) = \begin{cases} (-1)^{\cfrac{n}{2}}\cos\alpha(n为偶数)\\(-1)^{\cfrac{n+1}{2}}\sin\alpha(n为奇数)\end{cases}$

$$
\left[
\begin{array}{c|cc}
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\
7 & 8 & 9
\end{array}
\right]
\tag{7}
$$

$$x=a_0 + \frac{1^2}{a_ 1+\frac{2^2}{a_2+\frac{3^2}{a_3+ \frac{4^2}{a_4+…}}}}$$

$a \equiv b \pmod n$

欧拉公式

$$
e^{i\pi} + 1 = 0
$$


数学公式用法整理
http://toutou.zeabur.app/2024/09/08/Math-formula/
Author
toutou
Posted on
September 8, 2024
Licensed under