Skip to content

Commit

Permalink
new way to render math formula via MathJax
Browse files Browse the repository at this point in the history
  • Loading branch information
AIboy996 committed Jan 17, 2024
1 parent bfe6a3c commit 54202dc
Show file tree
Hide file tree
Showing 12 changed files with 731 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/Note/SAS/SAS_application.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ run;
#### 明可夫斯基距离

$$
d_{ij}=\{\sum_{k=1}^p|x_{ik}-x_{jk}|^q\}^{1/q}
d_{ij}=\\{\sum_{k=1}^p|x_{ik}-x_{jk}|^q\\}^{1/q}
$$

q=2时,即为欧氏距离
Expand Down
102 changes: 102 additions & 0 deletions docs/Note/mkdocs/about_math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
tags:
- mkdocs
---

# 写数学公式的坑

在使用Mkdocs生成网页的过程中,如果你的markdown中包含大量的数学公式,那么你大概率会遇到各种各样的问题。

## `\`的转义

我们都知道,`\`符号在tex中经常用到,而它markdown在文件中又是特殊的转义符号,需要格外注意。


### `\\`符号
如果你想写一个$2\times 2$的矩阵。

- 错误示范:
=== "渲染"
$$
\begin{pmatrix}
1&0\\
0&2
\end{pmatrix}
$$
=== "源代码"
```tex hl_lines="3"
$$
\begin{pmatrix}
1&0\\
0&2
\end{pmatrix}
$$
```

- 正确示范:
=== "渲染"
$$
\begin{pmatrix}
1&0\\\\
0&2
\end{pmatrix}
$$
=== "源代码"
```tex hl_lines="3"
$$
\begin{pmatrix}
1&0\\\\
0&2
\end{pmatrix}
$$
```
### `\{``\}`
再比如我们要写一个自适应大小的大括号。

- 错误示范:
=== "渲染"
$$
\exp\left\{ -\frac{x^2}{2} \right\}
$$
=== "源代码"
```tex hl_lines="2"
$$
\exp\left\{ -\frac{x^2}{2} \right\}
$$
```

- 正确示范:
=== "渲染"
$$
\exp\left\\{ -\frac{x^2}{2} \right\\}
$$

=== "源代码"
```tex hl_lines="2"
$$
\exp\left\\{ -\frac{x^2}{2} \right\\}
$$
```

或者是写一个分段函数。

=== "渲染"
$$
q(x) = \left\\{
\begin{aligned}
&1 \quad x\in \mathbb{Q}\\\\
&0\quad \text{otherwise}
\end{aligned} \right.
$$
=== "源代码"
```tex hl_lines="4"
$$
q(x) = \left\\{
\begin{aligned}
&1 \quad x\in \mathbb{Q}\\\\
&0\quad \text{otherwise}
\end{aligned} \right.
$$
```

TBC:数学公式的坑
26 changes: 13 additions & 13 deletions docs/SomeMath/complex/constructible_number.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ $$
>
> 我们就说:作$\sqrt{2}$引起了域的**扩张**
根据线性代数的知识,可以验证$\mathbb{Q}(\sqrt{2})$是$\mathbb{Q}$上的一个线性空间,并且$\{1,\sqrt{2}\}$恰可以成为这个域上的一个基(也就是说该域中的所有元素都可以表示为它们的线性组合$a*1+b*\sqrt{2}$),所以它的维度
根据线性代数的知识,可以验证$\mathbb{Q}(\sqrt{2})$是$\mathbb{Q}$上的一个线性空间,并且$\\{1,\sqrt{2}\\}$恰可以成为这个域上的一个基(也就是说该域中的所有元素都可以表示为它们的线性组合$a*1+b*\sqrt{2}$),所以它的维度
$$
\dim \mathbb{Q}(\sqrt{2})=2
$$
Expand Down Expand Up @@ -235,9 +235,9 @@ $$
>
> 那么
> $$
> \mathbb{Q}(\sqrt{2},\sqrt{3})=\{x|x=a+b\sqrt{3}\quad a,b\in\mathbb{Q}(\sqrt{2})\}
> \mathbb{Q}(\sqrt{2},\sqrt{3})=\\{x|x=a+b\sqrt{3}\quad a,b\in\mathbb{Q}(\sqrt{2})\\}
> $$
> 显然$\{1,\sqrt{3}\}$是$\mathbb{Q}(\sqrt{2},\sqrt{3})$在$\mathbb{Q}(\sqrt{2})$上作为线性空间的一组基底,所以扩张次数是:
> 显然$\\{1,\sqrt{3}\\}$是$\mathbb{Q}(\sqrt{2},\sqrt{3})$在$\mathbb{Q}(\sqrt{2})$上作为线性空间的一组基底,所以扩张次数是:
> $$
> [\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q}(\sqrt{2})]=2
> $$
Expand All @@ -247,7 +247,7 @@ $$
> $$
> a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6}\quad a,b,c,d\in \mathbb{Q}
> $$
> 所以$\{1,\sqrt{2},\sqrt{3},\sqrt{6}\}$是$\mathbb{Q}(\sqrt{2},\sqrt{3})$在$\mathbb{Q}$上作为线性空间的一组基底,所以扩张次数是:
> 所以$\\{1,\sqrt{2},\sqrt{3},\sqrt{6}\\}$是$\mathbb{Q}(\sqrt{2},\sqrt{3})$在$\mathbb{Q}$上作为线性空间的一组基底,所以扩张次数是:
> $$
> [\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q}] = 4
> $$
Expand All @@ -269,16 +269,16 @@ $$

## 言归正传

### 求$\mathbb{Q}(\cos(\pi/9))$的维度
### 求域扩张的维度

设$a=\cos(\pi/9)$,那么
$$
\mathbb{Q}(a)=\{z:z=x+ya^k\quad x,y\in \mathbb{Q}\quad k\in \mathbb{N}\}
\mathbb{Q}(a)=\\{z:z=x+ya^k\quad x,y\in \mathbb{Q}\quad k\in \mathbb{N}\\}
$$

> 请注意这里集合的写法,之前我们写的扩张域都是写成:
> $$
> \mathbb{Q}(\sqrt{2})=\{x|x=a+b\sqrt{2}\quad a,b\in \mathbb{Q}\}
> \mathbb{Q}(\sqrt{2})=\\{x|x=a+b\sqrt{2}\quad a,b\in \mathbb{Q}\\}
> $$
> 这一点其实没有那么直接,因为所谓的扩张域是“把一个元素加入之后,对加减乘除法构成封闭的集合”,只不过很容易验证,它可以写成上面的集合。但是$\cos(\pi/9)$要特殊的多,我们需要写出上述较为一般的形式。
Expand All @@ -288,13 +288,13 @@ $$
$$
可以证明:
$$
\{1,a,a^2\}
\\{1,a,a^2\\}
$$
是$\mathbb{Q}(\cos(\pi/9))$的一组基底。所以这个域的扩张次数$[\mathbb{Q}(\cos(\pi/9)):\mathbb{Q}]=3$

>证明基底需要一些**线性代数**的知识,我们先使用反证法来说明它们**线性无关**
>
>假设$\{1,a,a^2\}$是线性相关的,那么在数域$\mathbb{Q}$上存在不全为0的$k_{1,2,3}$使得:
>假设$\\{1,a,a^2\\}$是线性相关的,那么在数域$\mathbb{Q}$上存在不全为0的$k_{1,2,3}$使得:
>$$
>k_1+k_2a+k_3a^2=0
>$$
Expand Down Expand Up @@ -344,7 +344,7 @@ $$
>
>故而矛盾产生,假设不成立,$a$不是有理数。
>
>所以我们最初的假设也不成立,$\{1,a,a^2\}$应该是线性无关的。
>所以我们最初的假设也不成立,$\\{1,a,a^2\\}$应该是线性无关的。
>
>并且
>$$
Expand All @@ -354,11 +354,11 @@ $$
>
>以此类推,更高的次幂可以不断降幂,从而:
>$$
>\forall z\in\mathbb{Q}(a)=\{z:z=x+ya^k\quad x,y\in \mathbb{Q}\quad k\in \mathbb{N}\}
>\forall z\in\mathbb{Q}(a)=\\{z:z=x+ya^k\quad x,y\in \mathbb{Q}\quad k\in \mathbb{N}\\}
>$$
>都可以被$\{1,a,a^2\}$线性表出。
>都可以被$\\{1,a,a^2\\}$线性表出。
>
>所以$\{1,a,a^2\}$是一组基底,空间的维度为:
>所以$\\{1,a,a^2\\}$是一组基底,空间的维度为:
>$$
>\dim \mathbb{Q}(\cos(\pi/9)) =3
>$$
Expand Down
2 changes: 1 addition & 1 deletion docs/SomeMath/prob/Montmort1.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $$
那么:

??? question "成对的数量$M(n)$的期望是多少?"
- 利用期望的线性性质, 求$\begin{pmatrix}n\\2\end{pmatrix}$对人, 每一对成对的概率即可. 这个概率就是对应示性函数的期望.
- 利用期望的线性性质, 求$\begin{pmatrix}n\\\\2\end{pmatrix}$对人, 每一对成对的概率即可. 这个概率就是对应示性函数的期望.

??? question "在$n$个人交换礼物的过程中, 形成的循环个数$C(n)$的期望是多少?"
- 本题可以条件于第一个人所处循环的长度, 使用条件期望公式来求.
Expand Down
1 change: 1 addition & 0 deletions docs/SomeMath/real/derivatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tags:

# 导数

TBD:导数
Loading

0 comments on commit 54202dc

Please sign in to comment.