矩阵定义为一组称为元素的数字,这些数字以行和列的形式排列,以便从矩形阵列排列。它具有广泛的应用,并用于各种目的。
该环境用于实现矩阵,如下所示:
\begin{matrix} ...... \end{matrix}
“与"号(&)分隔矩阵中的列。
我们可以根据需要在矩阵中添加任意多的行和列,这些行由\\命令分隔,该命令通常用于指定新行中的文本。
矩阵环境使用\和[。它写为:
\[ ..... \]
如果不使用上述环境,Texmaker将给出错误。
让我们用一个简单的例子来理解。该示例是 2 x 2 矩阵。它是一个具有两行两列的矩阵。
下面给出了该示例的代码:
链接:https://www.learnfk.comhttps://www.learnfk.com/latex/latex-matrix.html
来源:LearnFk无涯教程网
\documentclass[10pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{matrix} a & b \\ c & d \end{matrix} \] \end{document}
输出:
有多种不同的矩阵环境可用于为矩阵创建不同样式的括号,如下所示:
环境 | 环绕支架 |
---|---|
pmatrix | () |
Bmatrix | {} |
bmatrix | [] |
Vmatrix | || || |
vmatrix | | | |
上述环境的加星标版本用于对齐矩阵的列,如下所示:
环境 | 环绕支架 |
---|---|
pmatrix * | () |
Bmatrix * | {} |
bmatrix * | [] |
Vmatrix * | || || |
vmatrix * | | | |
让我们以示例的方式了解上述对齐过程。该示例是具有三行和三列的 3 x 3 矩阵。
下面给出了该示例的代码:
链接:https://www.learnfk.comhttps://www.learnfk.com/latex/latex-matrix.html
来源:LearnFk无涯教程网
\documentclass[10pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{bmatrix} % you can specify any environment according to your choice A & B & C \\ D & E & F \\ G & H & I \end{bmatrix} = \begin{bmatrix*} J & K & L \\ M & N & O \\ P & Q & R \end{bmatrix*} \] \end{document}
输出:
您也可以设计任意大小的矩阵。可以使用\ddots(⋱),\vdots(⋮)和\cdots(&ctdot)命令指定矩阵之间的点。
创建这种矩阵的代码如下:
\documentclass[10pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{pmatrix} % 您可以根据自己的选择指定任何环境 b_{11} & b_{12} & \cdots & b_{1 n} \\ b_{21} & b_{22} & \cdots & b_{2 n} \\% 对于一位以上的数字,我们需要将下划线值括在大括号内。 \vdots & \vdots & \ddots & \vdots \\ b_{31} & b_{32} & \cdots & b_{3 n} \end{pmatrix} \] \end{document}
输出:
在运行文本中,我们可以插入矩阵。这种类型的矩阵称为小矩阵。
下面给出了用于创建小型矩阵的环境:
\begin{smallmatrix} ..... \end{smallmatrix}
但是在这里,我们需要指定文本的大小应大于矩阵的大小。
让我们看一个例子。代码如下:
\documentclass[10pt]{article} \usepackage{mathtools} \begin{document} The text around the matrix is larger compared $\bigl(\begin{smallmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{smallmatrix} \bigr)$ to the size of elements of the particular matrix. % 在这个例子中,我们不需要指定 \[...\] 环境,因为使用了 \big 命令。它会自动调整文本之间的矩阵。您也可以根据需要更改格式。 \end{document}
输出:
边界矩阵用于在矩阵周围创建边界。 \bordermatrix 命令用于实现此类矩阵。
下面给出了该示例的代码:
链接:https://www.learnfk.comhttps://www.learnfk.com/latex/latex-matrix.html
来源:LearnFk无涯教程网
\documentclass[12pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{vmatrix} % 您可以根据需要指定任何矩阵环境 M = \bordermatrix{~ & 0 & 1 \cr % \cr 命令用作额外的对齐选项卡 0 & a & b \cr 1 & c & d \cr} \end{vmatrix} \] \end{document}
输出:
分数矩阵由分数元素组成。我们还可以根据要求插入非小数元素。
让我们用一个简单的例子来理解。在这里,我们使用了 Vmatrix 环境。
下面给出了该示例的代码:
链接:https://www.learnfk.comhttps://www.learnfk.com/latex/latex-matrix.html
来源:LearnFk无涯教程网
\documentclass[12pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{Vmatrix} \frac{2}{3} & 0 & 0 \\ 0 & \frac{4}{5} & 0 \\ 0 & 0 & \frac{6}{7} \end{Vmatrix} \] \end{document}
输出:
该数组类似于矩阵。但是在这里,我们可以在行和列之间插入行。
用于此目的的环境如下:
\begin{array} ....... \end{array}
让我们用两个例子来理解。
下面是第一个示例的代码:
\documentclass[12pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{matrix} \begin{array}{c|c} a & b \\ \hline c & d \end{array} \end{matrix} \] \end{document}
输出:
下面给出第二个示例的代码:
\documentclass[12pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{matrix} \begin{array}{|l|c|r|} a & b & c \\ \hline d & e & f \end{array} \end{matrix} \] \end{document}
输出:
1)使用\left {和\right} 命令定义数学中的大括号。
让我们通过两个例子来理解。
下面是第一个示例的代码:
\documentclass[12pt]{article} \usepackage{mathtools} \usepackage{xfrac} \begin{document} \begin{math} \left\{\frac{a - 1}{b}\right\} \end{math} \end{document}
输出:
2)这是案件的关键部分。在此,cases环境用于实现此类方法,其编写为:
\begin{cases} ..... \end{cases}
上述环境通常用于数学中,仅在单个括号内编写具有一定条件的两个方程。
下面给出第二个示例的代码:
\documentclass[12pt]{article} \usepackage{mathtools} \usepackage{xfrac} \begin{document} \[ f(x) = \begin{cases} x^2 + 2x & \quad \text{if } x \text{ is greater than 0}\\% text 命令仅用于格式化 0 & \quad \text{if } x \text{ is less than 0} % \quad 命令保持文本和数学变量之间的距离 \end{cases} \] \end{document}
输出:
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)