Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmj01 committed May 17, 2024
1 parent e50c0c1 commit 838aeb5
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 314 deletions.
194 changes: 159 additions & 35 deletions articles/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,6 @@ function func(a, b) {
}
```

## [katex](https://katex.org/)

- [js katex api ](https://katex.org/docs/api)
- [支持格式](https://katex.org/docs/support_table)

$$
a^2=b^2+c^2
$$

This is inline katex:

$ c = \\pm\\sqrt{ a^2 + b^2 } $

This is block level katex:

$$
c = \\pm\\sqrt{a^2 + b^2}
$$

$$
\\begin{array}{cc}
a & b \\\\
c & d
\\end{array}
$$

$$
\\begin{array}{cc}
1 & 2 & 3 \\\\
4 & 5 & 6 \\\\
7 & 8 & 9
\\end{array}
$$

[maths symbols for latex](https://mirrors.jlu.edu.cn/CTAN/info/symbols/math/maths-symbols.pdf)

## [alert](https://github.com/bent10/marked-extensions/tree/main/packages/alert)
- [Enables GFM alerts](https://github.com/orgs/community/discussions/16925)
Expand Down Expand Up @@ -98,6 +63,165 @@ $$
| Header | Title | Here's this |
| Paragraph | Text | And more |

## [katex](https://katex.org/)

- [js katex api ](https://katex.org/docs/api)
- [支持格式](https://katex.org/docs/support_table)
- [常用数学公式排版KaTex语法总结](https://kissingfire123.github.io/2022/02/18_%E6%95%B0%E5%AD%A6%E5%85%AC%E5%BC%8Fkatex%E5%B8%B8%E7%94%A8%E8%AF%AD%E6%B3%95%E6%80%BB%E7%BB%93/)

可以使用text来包装字体,这样就不会出现问题了

$$ x^{y^z}=(1+{\rm e}^x)^{-2xy^w} $$

$$
a^2=b^2+c^2
$$

This is inline katex:

$ c = \\pm\\sqrt{ a^2 + b^2 } $

This is block level katex:

$$
c = \\pm\\sqrt{a^2 + b^2}
$$

注意公式内换行,是四个反斜杠

$$
\\begin{array}{cc}
a & b \\\\
c & d
\\end{array}
$$

$$
\\begin{array}{cc}
1 & 2 & 3 \\\\
4 & 5 & 6 \\\\
7 & 8 & 9
\\end{array}
$$

$$
\begin{matrix}
1 & x & x^2 \\\\
1 & y & y^2 \\\\
1 & z & z^2 \\\\
\end{matrix}
$$

$ \begin{matrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{matrix} $

$ \begin{pmatrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{pmatrix} $

$ \begin{bmatrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{bmatrix} $

$ \begin{Bmatrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{Bmatrix} $

$ \begin{vmatrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{vmatrix} $

$ \begin{Vmatrix} 1 & 2 \\\\ 3 & 4 \\\\ \end{Vmatrix} $

$$
\begin{pmatrix}
1 & a_1 & a_1^2 & \cdots & a_1^n \\\\
1 & a_2 & a_2^2 & \cdots & a_2^n \\\\
\vdots & \vdots & \vdots & \ddots & \vdots \\\\
1 & a_m & a_m^2 & \cdots & a_m^n \\\\
\end{pmatrix}
$$

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

$\text{这是一个行中矩阵的示例}\bigl(\begin{smallmatrix} a & b \\\\ c & d \end{smallmatrix}\bigr)\text{。}$

$\lVert \boldsymbol{X}_i - \boldsymbol{S}_j \rVert^2$

$$ f(x,y,z) = 3y^2z \left( 3+\frac{7x+5}{1+y^2} \right) $$

$$ \left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0} $$

分数

$$ \frac{a-1}{b-1} \quad or \quad {a+1 \over b+1} $$

$$ \frac 12,\frac 1a,\frac a2 \quad \mid \quad \text{2 letters only:} \quad \frac 12a \\,, k\frac q{r^2} $$

$$ \sqrt{2} \quad or \quad \sqrt[n]{3} $$

$$ f(x_1,x_2 \ldots x_n) = x_1^2 + x_2^2 + \cdots + x_n^2 $$

$$ \vec{a} \cdot \vec{b}=0 $$

$$ xy \text{ with arrows:} \quad \overleftarrow{xy} \\; \mid \\; \overleftrightarrow{xy} \\; \mid \\; \overrightarrow{xy} $$

$$ \int_0^1 {x^2} \,{\rm d}x $$

$$ \lim_{n \to \infty} \frac{1}{n(n+1)} \quad and \quad \lim_{x\leftarrow{\text{示例}}} \frac{1}{n(n+1)} $$

$$ \sum_{i=1}^n \frac{1}{i^2} \quad and \quad \prod_{i=1}^n \frac{1}{i^2} \quad and \quad \bigcup_{i=1}^{2} \Bbb{R} $$

$$ \verb+\overset{above}{level}+ \qquad \overset{xx}{ABC} \\;\\; \mid \quad \overset{x^2}{\longmapsto}\ \\, \mid \quad \overset{\bullet\circ\circ\bullet}{T} $$

$$ \verb+\underset{below}{level}+ \qquad \underset{xx}{ABC} \\;\\; \mid \quad \underset{x^2}{\longmapsto}\ \\, \mid \quad \underset{\bullet\circ\circ\bullet}{T} $$

$$ \rm {SrO} + V^{''}_{Sr} \overset{H_2}{\underset{1300 \text{ \textdegree C} }{\Longleftrightarrow}} 2e^{'}+\frac 12O_2(g) + Sr^{\times}_S $$

$$
\begin{array}{cc}
\mathrm{Bad} & \mathrm{Better} \\\\
\hline \\\\
\int_0^1 x^2 dx & \int_0^1 x^2 \\,{\rm d}x
\end{array}
$$

<!-- $$f\left( \left[ \frac{ 1+\left\\{x,y\right\\} }{ \left( \frac xy + \frac yx \right) (u+1) }+a\right]^{3/2} \right)\tag {\text{行标}}$$ -->

$$
\begin{aligned}
a=&\left(1+2+3+ \cdots \right. \\\\
&\cdots+\left. \infty-2+\infty-1+\infty\right)
\end{aligned}
$$

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

$$
A B \quad Vs \quad A\\,B \\\\
C D \quad Vs \quad C\\;D \\\\
E F \quad Vs \quad E\space F
$$

$$ \mu_0=4\pi\times10^{-7} \ \left.\mathrm{\mathrm{T}\\!\cdot\\!\mathrm{m}}\middle/\mathrm{A}\right.$$

$$ 180^\circ=\pi \ \mathrm{rad} $$

$$ \mathrm{N_A} = 6.022\times10^{23} \ \mathrm{mol}^{-1}$$

$$
\begin{array}{|rrrrrrrr|}\hline
\verb+#000+ & \color{#000}{text} & & &
\verb+#00F+ & \color{#00F}{text} & & \\\\
& & \verb+#0F0+ & \color{#0F0}{text} &
& & \verb+#0FF+ & \color{#0FF}{text} \\\\
\verb+#F00+ & \color{#F00}{text} & & &
\verb+#F0F+ & \color{#F0F}{text} & & \\\\
& & \verb+#FF0+ & \color{#FF0}{text} &
& & \verb+#FFF+ & \color{#FFF}{text} \\\\
\hline\end{array}
$$

[maths symbols for latex](https://mirrors.jlu.edu.cn/CTAN/info/symbols/math/maths-symbols.pdf)


## 其他

Expand Down
6 changes: 5 additions & 1 deletion cpl/language.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 编程语言

- [位运算](/cpl/tools/bit.md)
- [浮点数与定点数](/cpl/tools/number.md)

程序执行的过程就是把解决问题的思路翻译成计算机可执行的精确化形式语言的过程,编程语言就是解决问题思路的呈现

计算过程依赖于形式语言,而形式语言的核心就是代数体系,就是定义了数据类型及针对这些类型的运算规则,确保运算的封闭性和自洽性。
Expand Down Expand Up @@ -52,4 +55,5 @@ rust语言的安全,就是通过所有权的确定来保证在运行期不会

### 语法高亮

- [js版的highlight高亮配置,选中语言,下载后选择es版本的,选择特定语言即可](https://highlightjs.org/download)
- [js版的highlight高亮配置,选中语言,下载后选择es版本的,选择特定语言即可](https://highlightjs.org/download)

57 changes: 57 additions & 0 deletions cpl/tools/number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
> 在计算机中得表示
## 定点数

约定计算机中小数点的位置,且这个位置固定不变,小数点前、后的数字,分别用二进制表示,然后组合起来就可以把这个数字在计算机中存储起来,这种表示方式叫做「定点」表示法,用这种方法表示的数字叫做「定点数」

- 纯整数:例如整数100,小数点其实在最后一位,所以忽略不写
1. 纯整数100,由于小数点固定在最低位,假定我们以 1 个字节(8 bit)表示,用定点数表示如 100(D) = 01100100(B)
- 纯小数:例如:0.123,小数点固定在最高位
1. 纯小数 0.125,由于小数点固定在最高位,同样以 1 个字节(8 bit)表示,用定点数表示 0.125(D) = 0.00100000(B)
- 整数+小数:例如1.24、10.34,小数点在指定某个位置
1. 约定前 5 位表示整数部分,后 3 位表示小数部分
2. 数字 1.5 用定点数表示 1.5(D) = 00001 100(B)
3. 数字 25.125 用定点数表示 25.125(D) = 11001 001(B)

定点数表示整数还是很好得,表示小数时就有问题了
- 数值的表示范围有限(小数点越靠左,整个数值范围越小)
- 数值的精度范围有限(小数点越靠右,数值精度越低)


## 浮点数
> float
- [IEEE-754 Floating Point Converter](https://www.h-schmidt.net/FloatConverter/IEEE754.html)
- [IEEE Std 754™-2008 (Revision of IEEE Std 754-1985) IEEE Standard for Floating-Point Arithmetic](http://www.dsc.ufcg.edu.br/~cnum/modulos/Modulo2/IEEE754_2008.pdf)

浮点数是采用科学计数法来表示一个数字的,它的格式可以写成这样

$$
V = (-1)^S * M * R^E
$$

其中各个变量的含义如下
- S:符号位,取值 0 或 1,决定一个数字的符号,0 表示正,1 表示负
- M:尾数,用小数表示,例如前面所看到的 8.345 * 10^0,8.345 就是尾数
- R:基数,表示十进制数 R 就是 10,表示二进制数 R 就是 2
- E:指数,用整数表示,例如前面看到的 10^-1,-1 即是指数

直到1985年,IEEE 组织推出了浮点数标准,就是我们经常听到的 IEEE754 浮点数标准,这个标准统一了浮点数的表示形式,并提供了 2 种浮点格式:
- 单精度浮点数 float:32 位,符号位 S 占 1 bit,指数 E 占 8 bit,尾数 M 占 23 bit
- 双精度浮点数 float:64 位,符号位 S 占 1 bit,指数 E 占 11 bit,尾数 M 占 52 bit


## 误差
浮点数会带来误差,但是这种误差得消除不仅仅是从数的表示上,还可以从其他方法上。

### 存在歧义
一般图形库都会设置距离误差和角度误差,这两个误差有一定的倍差关系,一般情况下不会出现问题。
如点接近重叠时,一个满足要求,一个不满足要求的情况。通过算法统一误差计算方法,但是会导致算法变慢
这时就需要折中处理其误差了。

特别是处理几何数据时,误差就需要考虑了!之前云旎项目时让我解析STL的数据,我个人认为没有点、边关系,处理起来感觉不靠谱,但是其他同事还是硬处理了,
其实就是把误差当作很小,不受影响的问题。我的想法是在浮点数如何来判断点的关系了,这其实就是精度完全可接受的范围内,重叠点就是另外的情况了。

stl中的格式中,每个面片都是各自存储其顶点的,这里直接判断两个顶点相等,不考虑误差。


22 changes: 22 additions & 0 deletions exercises/advanced.mathematics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 高等数学
>
## 例题1 2024-5-17

> **Note来源**
> 吴康公众号
$$
\text{设}F(x) = sinx \cdot sin2x \cdots sin(2022x), \text{求}F^{2024}(0). \newline
\text{首先,把公式一般化,就是}F(x) = \prod _{\substack{1 \le k \le n}} {sin(kx)}, n \in N^+. \text{求 }F^{n+2}(0)
$$

解:

$$
\text{引入定理,证略} \newline
sinx = x - \frac{x^3}{6} + o(x^3), x \to 0 \text{带入可以得到} F(x) = \prod _{\substack{1 \le k \le n}} { \[ kx - \frac{kx^3}{6} + o(x^3) \]}, x \to 0 \newline
F(x) \text{的展开式中}x^{n+2}\text{项为} \newline
\sum_{1 \le k \le n}{\[\prod_{1 \le k \le n}\]}(kx)^{-1} \cdot (-6^{-1})(kx)^3=-6^{-1}\lgroup{\sum_{1 \le k \le n}{k^2}}\rgroup n!x^{n+2} = -36^{-1}n(2n+1)(n+1)!(n+2)!
$$

7 changes: 5 additions & 2 deletions exercises/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# 习题
> 典型和分类学习

- [数论](/exercises/number.theory.md)
- [夹逼法](/exercises/sequeezing.md)
- [小学数学](/exercises/math.primary.md)
- [初中数学](/exercises/math.secondary.md)
- [高中数学](/exercises/math.high.md)
- [二次方程](/exercises/quadratic.equation.md)
- [高等数学](/exercises/advanced.mathematics.md)
- [夹逼法](/exercises/sequeezing.md)
2 changes: 2 additions & 0 deletions exercises/math.high.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 高中数学
>
Loading

0 comments on commit 838aeb5

Please sign in to comment.