% !TeX document-id = {fc3853a9-0c9c-4d02-b763-6dc6c85d34db}
% !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]

\documentclass[french,a4paper,10pt]{article}
\def\RSver{0.1.5}
\usepackage[margin=1.5cm]{geometry}
\usepackage[executable=python.exe]{pyluatex}
\usepackage[pyluatex]{ResolSysteme}
\usepackage{systeme}
\usepackage{babel}
\usepackage[most]{tcolorbox}
\sisetup{locale=FR,output-decimal-marker={,},group-minimum-digits=4}
\newtcblisting{ShowCodeTeX}[1][]{colback=white,colframe=red!75!black,listing options={style=tcblatex},#1}

\begin{document}

\part*{ResolSysteme (\RSver), version \og pyluatex \fg{}}

\section{Préambule, avec le package pyluatex}

\begin{ShowCodeTeX}[listing only]
\documentclass[french,a4paper,10pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[executable=python.exe]{pyluatex}
\usepackage[pyluatex]{ResolSysteme}              %version pyluatex, lua + shell-escape
\usepackage{systeme}
\sisetup{locale=FR,output-decimal-marker={,}}
\end{ShowCodeTeX}

\section{Affichage d'une matrice, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
On considère les matrices $A=\AffMatrice(1,2 § 3,4)$
et $B=\AffMatrice[n](-1,-1/3,4 § 1/3,4,-1 § -1,0,0)$
et $C=\AffMatrice(1,2,3,4 § 5,6,7,0 § 1,1,1,1 § 2,-3,-5,-6)$.
\end{ShowCodeTeX}

\section{Déterminant d'une matrice, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
Le déterminant de $A=\AffMatrice(1,2 § 3,4)$ est
$\det(A)=\DetMatricePY(1,2 § 3,4)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
Le déterminant de $A=\AffMatrice(-1,0.5 § -1/2,4)$ est
$\det(A)=\DetMatricePY[dec](-1,0.5 § -1/2,4)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
Le dét. de $A=\begin{pNiceMatrix} -1&\frac13&4 \\ \frac13&4&-1 \\ -1&0&0 \end{pNiceMatrix}$ est
$\det(A) \approx \DetMatricePY[dec=3](-1,1/3,4 § 1/3,4,-1 § -1,0,0)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
Le dét. de $A=\begin{pNiceMatrix} 1&2&3&4\\5&6&7&0\\1&1&1&1\\2&-3&-5&-6 \end{pNiceMatrix}$
est $\det(A)=\DetMatricePY(1,2,3,4 § 5,6,7,0 § 1,1,1,1 § 2,-3,-5,-6)$.
\end{ShowCodeTeX}

\section{Calculs avec des matrices, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
$\ProduitMatricesPY(1,2)(3 § 4)[Aff]$ et $\ProduitMatricesPY(1,2)(3,4 § 5,6)[Aff]$ \\
$\ProduitMatricesPY(-5,6 § 1,4)(2 § 7)[Aff]$ et $\ProduitMatricesPY(-5,6 § 1,4)(2,-4 § 7,0)[Aff]$
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
$\ProduitMatricesPY(1,2,3)(4 § 5 § 6)[Aff]$ et $\ProduitMatricesPY(1,2,3)(1,1,1 § 2,1,5 § 0,5,-6)[Aff]$\\
$\ProduitMatricesPY(1,1,1 § 2,1,5 § 0,5,-6)(1 § 2 § 3)[Aff]$ et
$\ProduitMatricesPY(1,1,1 § 2,1,5 § 0,5,-6)(1,2,3 § -5,-4,2 § 3,3,10)[Aff]$
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
$\ProduitMatricesPY(1,2,3,4)(5 § 6 § 7 § 8)[Aff]$\\
$\ProduitMatricesPY(1,2,3,4)(1,1,1,5 § 2,1,5,6 § 0,5,-6,0 § 1,-5,4,2)[Aff]$\\
$\ProduitMatricesPY(1,1,1,5 § 2,1,5,6 § 0,5,-6,0 § 1,-5,4,2)(1 § 2 § 3 § 4)[Aff]$\\
$\ProduitMatricesPY(1,1,1,5 § 2,1,5,6 § 0,5,-6,0 § 1,-5,4,2)(1,5,4,0 § 2,-1,-1,5 § 3,0,1,2, § 4,6,9,10)[Aff]$
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
$\MatricePuissancePY(1,1 § 5,-2)(7)[Aff]$\\
$\MatricePuissancePY(1,1,-1 § 5,-2,1 § 0,5,2)(3)[Aff]$ \\
$\MatricePuissancePY(1,1,1,1 § 5,-2,1,5 § 0,5,2,-1 § 0,1,1,1)(5)[Aff]$
\end{ShowCodeTeX}

\section{Inverse d'une matrice, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2 § 3,4)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY*<cell-space-limits=2pt>(1,2 § 3,4)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&6 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2 § 3,6)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY[d]<cell-space-limits=2pt>(1,2 § 3,4)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2&3\\4&5&6\\7&8&8 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2,3 § 4,5,6 § 7,8,8)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2&3\\4&5&6\\7&8&8 \end{pNiceMatrix}$ est
$A^{-1}=\MatriceInversePY*<cell-space-limits=2pt>(1,2,3 § 4,5,6 § 7,8,8)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'inverse de $A=\begin{pNiceMatrix} 1&2&3&4\\5&6&7&0\\1&1&1&1\\2&-3&-5&-6 \end{pNiceMatrix}$
est $A^{-1}=\MatriceInversePY[n]<cell-space-limits=2pt>(1,2,3,4 § 5,6,7,0 § 1,1,1,1 § 2,-3,-5,-6)$.
\end{ShowCodeTeX}

\section{Résolution d'un système, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
La solution de $\systeme{-9x-8y=-8,3x-6y=-7}$ est $\mathcal{S}=%
\left\lbrace \SolutionSystemePY(-9,-8 § 3,-6)(-8,-7) \right\rbrace$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme{x+2y=-5,4x+8y=1}$ est $\mathcal{S}=%
\left\lbrace \SolutionSystemePY(1,2 § 4,8)(-5,1) \right\rbrace$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme{-9x-8y=-8,3x-6y=-7}$ est $\mathcal{S}=%
\left\lbrace \SolutionSystemePY[d](-9,-8 § 3,-6)(-8,-7) \right\rbrace$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme{x+y+z=-1,3x+2y-z=6,-x-y+2z=-5}$ est $\mathcal{S}=%
\left\lbrace \SolutionSystemePY(1,1,1 § 3,2,-1 § -1,-1,2)(-1,6,-5) \right\rbrace$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme{x+y+z=-1,3x+2y-z=-5,-x-y+2z=0}$ est donnée par $X=%
\SolutionSystemePY*[d]<cell-space-limits=2pt>(1,1,1 § 3,2,-1 § -1,-1,2)(-1,-5,0)[Matrice]$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme[xyzt]{y+z+t=1,x+z+t=-1,x+y+t=1,x+y+z=0}$ est $\mathcal{S}=%
\left\lbrace\SolutionSystemePY[d](0,1,1,1 § 1,0,1,1 § 1,1,0,1 § 1,1,1,0)(1,-1,1,0)\right\rbrace$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
La solution de $\systeme[xyzt]{x+2y+3z+4t=-10,5x+6y+7z=0,x+y+z+t=4,-2x-3y-5z-6t=7}$ est $X=
\SolutionSystemePY
    [dec]<cell-space-limits=2pt>
    (1,2,3,4 § 5,6,7,0 § 1,1,1,1 § -2,-3,-5,-6)(-10,0,4,7)
    [Matrice]$
\end{ShowCodeTeX}

\section{État probabiliste d'un graphe probabiliste, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
État initial : $P_0 = \AffEtatProb[t](1/3,2/3)$.

Matrice de transition :
$M=\AffMatrice[dec](0.75,0.25 § 0.9,0.1)$

État à l'instant 5 :
$P_5 \approx \EtatProbPY[dec=3](1/3,2/3)%
	(0.75,0.25 § 0.9,0.1)
	(5)$
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
État initial : $P_0 = \AffEtatProb[dec](0.33,0.52,0.15)$.

Matrice de transition :
$M=\AffMatrice[dec]%
(0.1,0.2,0.7 § 0.25,0.25,0.5 § 0.15,0.75,0.1)$

État à l'instant 7 :
$P_7 \approx \EtatProbPY[dec=3]
	(0.33,0.52,0.15)%
	(0.1,0.2,0.7 § 0.25,0.25,0.5 § 0.15,0.75,0.1)
	(7)$
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
État initial : $P_0 = \AffEtatProb[dec](0.33,0.52,0.15,0)$.

Matrice de transition :
$M=\AffMatrice[dec]%
	(0.1,0.2,0.3,0.4 § 0.25,0.25,0.25,0.25 § 0.15,0.15,0.2,0.5 § 0.3,0.3,0.2,0.2)$

État à l'instant 4 :
$P_4 \approx \EtatProbPY[dec=3]
	(0.33,0.52,0.15,0)%
	(0.1,0.2,0.3,0.4 § 0.25,0.25,0.25,0.25 § 0.15,0.15,0.2,0.5 § 0.3,0.3,0.2,0.2)%
	(4)$
\end{ShowCodeTeX}

\section{État stable d'un graphe probabiliste, 2x2 ou 3x3 ou 4x4}

\begin{ShowCodeTeX}
L'état stable du gr. prob. de matrice
$M=\AffMatrice[dec](0.72,0.28 § 0.12,0.88)$

est $\Pi = \EtatStablePY[d](0.72,0.28 § 0.12,0.88)$
ou $\Pi = \EtatStablePY[dec](0.72,0.28 § 0.12,0.88)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'état stable du gr. prob. de matrice
$M=\AffMatrice[dec](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$

est $\Pi = \EtatStablePY[d](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$
ou $\Pi = \EtatStablePY[dec](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$.
\end{ShowCodeTeX}

\begin{ShowCodeTeX}
L'état stable du gr. prob. de matrice
$M=\AffMatrice[dec](0.1,0.2,0.3,0.4 § 0.25,0.25,0.25,0.25 § 0.15,0.15,0.2,0.5 § 0.3,0.3,0.2,0.2)$

est $\Pi \approx \EtatStablePY[dec=5](0.1,0.2,0.3,0.4 § 0.25,0.25,0.25,0.25 § 0.15,0.15,0.2,0.5 § 0.3,0.3,0.2,0.2)$.
\end{ShowCodeTeX}

\end{document}