Signed-off-by: sairate <sairate@sina.cn>

This commit is contained in:
sairate 2024-09-03 19:35:04 +08:00
parent 7804c7eccc
commit 2dba979456
5 changed files with 75 additions and 68 deletions

View File

@ -22,5 +22,6 @@ $ mkdocs serve # 在本地启动服务器预览
我们欢迎和鼓励所有人贡献自己的知识和经验! 我们欢迎和鼓励所有人贡献自己的知识和经验!
- 在工单中提交需求 - 在工单中提交需求
- 联系我:sairate@sina.cn
![issues](.\static\image\issues.jpg) ![issues](.\static\image\issues.jpg)

View File

@ -5,78 +5,64 @@
**例如:** **例如:**
设有两个矩阵 \( A \) 和 \( B \),如下: 设有两个矩阵 \( A \) 和 \( B \),如下:
\[ A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \quad B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} \] $$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \quad B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}
$$
**加法:** **加法:**
\[ A + B = \begin{pmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{pmatrix} = \begin{pmatrix} 6 & 8 \\ 10 & 12 \end{pmatrix} \] $$
A + B = \begin{pmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{pmatrix} = \begin{pmatrix} 6 & 8 \\ 10 & 12 \end{pmatrix}
$$
**减法:** **减法:**
\[ A - B = \begin{pmatrix} 1-5 & 2-6 \\ 3-7 & 4-8 \end{pmatrix} = \begin{pmatrix} -4 & -4 \\ -4 & -4 \end{pmatrix} \] $$
A - B = \begin{pmatrix} 1-5 & 2-6 \\ 3-7 & 4-8 \end{pmatrix} = \begin{pmatrix} -4 & -4 \\ -4 & -4 \end{pmatrix}
$$
### 2. 矩阵乘法 ### 2. 矩阵乘法
矩阵乘法是矩阵运算中最常见的一种操作。矩阵 \( A \) 的列数必须等于矩阵 \( B \) 的行数。结果矩阵的维度为 \( A \) 的行数和 \( B \) 的列数。 矩阵乘法是矩阵运算中最常见的一种操作。矩阵 \( A \) 的列数必须等于矩阵 \( B \) 的行数。结果矩阵的维度为 \( A \) 的行数和 \( B \) 的列数。
**例如:** **例如:**
设有矩阵 \( A \) 和 \( B \),如下: 设有矩阵 \( A \) 和 \( B \),如下:
\[ A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \quad B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} \] $$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \quad B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}
$$
**乘法:** **乘法:**
\[ A \times B = \begin{pmatrix} 1\times5 + 2\times7 & 1\times6 + 2\times8 \\ 3\times5 + 4\times7 & 3\times6 + 4\times8 \end{pmatrix} = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix} \] $$
A \times B = \begin{pmatrix} 1\times5 + 2\times7 & 1\times6 + 2\times8 \\ 3\times5 + 4\times7 & 3\times6 + 4\times8 \end{pmatrix} = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}
$$
### 3. 矩阵转置 ### 3. 矩阵转置
矩阵的转置是将矩阵的行和列互换。对于矩阵 \( A \) 的转置矩阵记作 \( A^T \)。 矩阵的转置是将矩阵的行和列互换。对于矩阵 \( A \) 的转置矩阵记作 \( A^T \)。
**例如:** **例如:**
设矩阵 \( A \) 如下: 设矩阵 \( A \) 如下:
\[ A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} \] $$
A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}
$$
**转置:** **转置:**
\[ A^T = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix} \] $$
A^T = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}
$$
### 4. 单位矩阵和逆矩阵 ### 4. 单位矩阵和逆矩阵
- **单位矩阵** \( I \) 是一个对角线上全为1其余元素为0的方阵。它在矩阵乘法中起着类似于数字1在数乘中的作用。 - **单位矩阵** \( I \) 是一个对角线上全为1其余元素为0的方阵。它在矩阵乘法中起着类似于数字1在数乘中的作用。
**例如:** **例如:**
\[ I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \] $$
I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
$$
- **逆矩阵** \( A^{-1} \) 是一个矩阵,使得 \( A \times A^{-1} = I \)。只有方阵(行数等于列数)并且行列式不为零的矩阵才有逆矩阵。 - **逆矩阵** \( A^{-1} \) 是一个矩阵,使得 \( A \times A^{-1} = I \)。只有方阵(行数等于列数)并且行列式不为零的矩阵才有逆矩阵。
### 5. 矩阵行列式 ### 5. 矩阵行列式
行列式是一个标量值,可以用于判断矩阵是否可逆。对于 \( 2 \times 2 \) 的矩阵 \( A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \),行列式 \( \det(A) \) 计算如下: 行列式是一个标量值,可以用于判断矩阵是否可逆。对于 \( 2 \times 2 \) 的矩阵 \( A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \),行列式 \( \det(A) \) 计算如下:
\[ \det(A) = ad - bc \] $$
\det(A) = ad - bc
$$
如果行列式不为零,矩阵 \( A \) 可逆。 如果行列式不为零,矩阵 \( A \) 可逆。
### 6. Python 中的矩阵运算
在 Python 中NumPy 是一个常用的库来进行矩阵运算。
```python
import numpy as np
# 定义矩阵
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
# 矩阵加法
C = A + B
# 矩阵乘法
D = np.dot(A, B)
# 矩阵转置
E = A.T
# 矩阵的行列式
det_A = np.linalg.det(A)
# 矩阵的逆
inv_A = np.linalg.inv(A)
print("矩阵加法结果:\n", C)
print("矩阵乘法结果:\n", D)
print("矩阵转置结果:\n", E)
print("矩阵的行列式:", det_A)
print("矩阵的逆:\n", inv_A)
```
这些基本运算为许多复杂的线性代数问题打下了基础。如果你对更高级的矩阵运算或应用有兴趣,可以继续深入学习特征值分解、奇异值分解等内容。 这些基本运算为许多复杂的线性代数问题打下了基础。如果你对更高级的矩阵运算或应用有兴趣,可以继续深入学习特征值分解、奇异值分解等内容。

View File

@ -1,11 +1,10 @@
document$.subscribe(({ body }) => { document$.subscribe(({ body }) => {
renderMathInElement(body, { renderMathInElement(body, {
delimiters: [ delimiters: [
{ left: "$$", right: "$$", display: true }, { left: "$$", right: "$$", display: true }, // 用于块级显示的数学公式
{ left: "$", right: "$", display: false }, { left: "$", right: "$", display: false }, // 用于行内显示的数学公式
{ left: "\\(", right: "\\)", display: false }, { left: "\\(", right: "\\)", display: false }, // 行内数学公式的另一种表示法
{ left: "\\[", right: "\\]", display: true }, { left: "\\[", right: "\\]", display: true } // 块级数学公式的另一种表示法
{ left: "\[", right: "\]", display: true }
], ],
}) })
}) })

View File

@ -1,7 +1,16 @@
// markdown_extensions: window.MathJax = {
// - pymdownx.arithmatex: tex: {
// generic: true inlineMath: [["\\(", "\\)"]],
// displayMath: [["\\[", "\\]"]],
// extra_javascript: processEscapes: true,
// - javascripts/mathjax.js processEnvironments: true
// - https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js },
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {
MathJax.typesetPromise()
})

View File

@ -33,18 +33,30 @@ markdown_extensions:
- pymdownx.arithmatex: - pymdownx.arithmatex:
generic: true generic: true
extra_javascript:
- javascripts/katex.js
- https://unpkg.com/katex@0/dist/katex.min.js
- https://unpkg.com/katex@0/dist/contrib/auto-render.min.js
extra_css: extra_css:
- https://unpkg.com/katex@0/dist/katex.min.css - themes/css/custom.css
- themes/css/simpleLightbox.min.css
- themes/css/pied_piper.css
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css
#markdown_extensions: extra_javascript:
# - pymdownx.arithmatex: - themes/js/custom.js
# generic: true - themes/js/simpleLightbox.min.js
# - themes/js/optionalConfig.js
#extra_javascript: - themes/js/mermaidloader.js
# - javascripts/mathjax.js - themes/js/umlconvert.js
# - https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js - themes/js/mathjax.js
- themes/js/katex.js
- https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js
- https://cdnjs.cloudflare.com/ajax/libs/flowchart/1.17.1/flowchart.min.js
- https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js
- https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js
- https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-mindmap@9.3.0/dist/diagram-definition.0faef4c2.min.js
- https://cdn.jsdelivr.net/npm/markdown-it-plantuml@1.4.1/index.min.js
- https://cdnjs.cloudflare.com/ajax/libs/webfont/1.6.28/webfontloader.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-mml-chtml.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml-full.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-svg-full.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/auto-render.min.js