Sarrus,3×3 矩阵的行列式

Sarrus,3×3 矩阵的行列式

我在创建其他图像时遇到了问题node[SigneMoins=red]node[SigneMoins=blue]在图像的右侧(前 3 个 = 红色;后 3 个 = 蓝色),我想在其中写入对角线积的值。谢谢。


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{fullpage,amsmath}
\begin{document}
Pierre Frédéric Sarrus (10 March 1798, Saint-Affrique - 20 November 1861) was a French mathematician.
Sarrus was professor at the University of Strasbourg, France (1826-1856) and member of the Academy of Sciences in Paris (1842). He  discovered a mnemonic rule for solving the determinant of a 3-by-3 matrix, named Sarrus' scheme, which provides an easy-to-remember method of working out the determinant of a 3-by-3 matrix (as illustrated below)

\tikzset{node style ge/.style={circle}}
det(M)=
$\left|
\begin{matrix}
    a_{11} & a_{12} & a_{13}  \\
    a_{21} & a_{22} & a_{23}  \\
    a_{31} & a_{32} & a_{33}  \\
\end{matrix}%
\right|$
=$\big(a_{11}a_{22}a_{33}+a_{21}a_{32}a_{13}+a_{31}a_{12}a_{33}\big)-\big(a_{13}a_{22}a_{31}+a_{23}a_{32}a_{11}+a_{33}a_{12}a_{31}\big)$



\begin{tikzpicture}[baseline=(A.center)]
  \tikzset{BarreStyle/.style =   {opacity=.4,line width=4 mm,line cap=round,color=#1}}
    \tikzset{SignePlus/.style =   {above left,,opacity=1,circle,fill=#1!50}}
    \tikzset{SigneMoins/.style =   {below left,,opacity=1,circle,fill=#1!50}}
% the matrices
\matrix (A) [matrix of math nodes, nodes = {node style ge},,column sep=0 mm] 
{ a_{11} & a_{12} & a_{13}  \\
  a_{21} & a_{22} & a_{23}  \\
  a_{31} & a_{32} & a_{33}  \\
  a_{11} & a_{12} & a_{13} \\
  a_{21} & a_{22} & a_{13}\\
};

 \draw [BarreStyle=blue] (A-1-1.north west) node[SignePlus=blue] {$+$} to (A-3-3.south east) ;
 \draw [BarreStyle=blue] (A-2-1.north west) node[SignePlus=blue] {$+$} to (A-4-3.south east) ;
 \draw [BarreStyle=blue] (A-3-1.north west) node[SignePlus=blue] {$+$} to (A-5-3.south east) ;
 \draw [BarreStyle=red]  (A-3-1.south west) node[SigneMoins=red] {$-$} to (A-1-3.north east);
 \draw [BarreStyle=red]  (A-4-1.south west) node[SigneMoins=red] {$-$} to (A-2-3.north east);
 \draw [BarreStyle=red]  (A-5-1.south west) node[SigneMoins=red] {$-$} to (A-3-3.north east);
\end{tikzpicture}


\end{document}

答案1

首先,使用opacity=0.4而不是fill=#1!50,使得标志和条的颜色相同。

\tikzset{SignePlus/.style =   {above left,inner sep=1.5pt,opacity=.4,circle,fill=#1}}
    \tikzset{SigneMoins/.style =   {below left,inner sep=1.5pt,opacity=.4,circle,fill=#1}}

然后这是在右侧添加产品的方法:

Sarrus 决定簇

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{fullpage,amsmath}
\begin{document}
Pierre Frédéric Sarrus (10 March 1798, Saint-Affrique - 20 November 1861) was a French mathematician.
Sarrus was professor at the University of Strasbourg, France (1826-1856) and member of the Academy of Sciences in Paris (1842). He  discovered a mnemonic rule for solving the determinant of a 3-by-3 matrix, named Sarrus' scheme, which provides an easy-to-remember method of working out the determinant of a 3-by-3 matrix (as illustrated below)

\tikzset{node style ge/.style={circle}}
det(M)=
$\left|
\begin{matrix}
    a_{11} & a_{12} & a_{13}  \\
    a_{21} & a_{22} & a_{23}  \\
    a_{31} & a_{32} & a_{33}  \\
\end{matrix}%
\right|$
=$\big(a_{11}a_{22}a_{33}+a_{21}a_{32}a_{13}+a_{31}a_{12}a_{33}\big)-\big(a_{13}a_{22}a_{31}+a_{23}a_{32}a_{11}+a_{33}a_{12}a_{31}\big)$



\begin{tikzpicture}[baseline=(A.center)]
  \tikzset{BarreStyle/.style =   {opacity=.4,line width=4 mm,line cap=round,color=#1}}
    \tikzset{SignePlus/.style =   {above left,inner sep=1.5pt,opacity=.4,circle,fill=#1}}
    \tikzset{SigneMoins/.style =   {below left,inner sep=-0.5pt,opacity=.4,circle,fill=#1}}
    \tikzset{PlusProduct/.style={anchor=north west,rectangle,rounded corners=5pt,inner sep=2pt,outer sep=2.5pt,opacity=.4,fill=#1}}
    \tikzset{MoinsProduct/.style={anchor=south west,rectangle,rounded corners=5pt,inner sep=2pt,outer sep=2.5pt,opacity=.4,fill=#1}}
% the matrices
\matrix (A) [matrix of math nodes, nodes = {node style ge},,column sep=0 mm] 
{ a_{11} & a_{12} & a_{13}  \\
  a_{21} & a_{22} & a_{23}  \\
  a_{31} & a_{32} & a_{33}  \\
  a_{11} & a_{12} & a_{13} \\
  a_{21} & a_{22} & a_{23}\\
};

 \draw [BarreStyle=blue] (A-1-1.north west) node[SignePlus=blue] {$+$} to (A-3-3.south east) node[PlusProduct=blue]{$a_{11}\times a_{22}\times a_{33}$};
 \draw [BarreStyle=blue] (A-2-1.north west) node[SignePlus=blue] {$+$} to (A-4-3.south east)  node[PlusProduct=blue]{$a_{21}\times a_{32}\times a_{13}$};
 \draw [BarreStyle=blue] (A-3-1.north west) node[SignePlus=blue] {$+$} to (A-5-3.south east)  node[PlusProduct=blue]{$a_{31}\times a_{12}\times a_{23}$};
 
 \draw [BarreStyle=red]  (A-3-1.south west) node[SigneMoins=red] {\strut $-$} to (A-1-3.north east) node[MoinsProduct=red]{$a_{31}\times a_{22}\times a_{13}$};
 \draw [BarreStyle=red]  (A-4-1.south west) node[SigneMoins=red] {\strut $-$} to (A-2-3.north east) node[MoinsProduct=red]{$a_{11}\times a_{32}\times a_{23}$};
 \draw [BarreStyle=red]  (A-5-1.south west) node[SigneMoins=red] {\strut $-$} to (A-3-3.north east) node[MoinsProduct=red]{$a_{21}\times a_{12}\times a_{33}$};
\end{tikzpicture}


\end{document}

我还\strut向减号添加了一个命令,以便它们正确地位于节点的中心。

相关内容