Debian Codegraph @

texmf-dist/doc/latex/resolsysteme/ResolSysteme-exemples-pyluatex.tex

raw
1 % !TeX document-id = {fc3853a9-0c9c-4d02-b763-6dc6c85d34db}
2 % !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]
3
4 \documentclass[french,a4paper,10pt]{article}
5 \def\RSver{0.1.8}
6 \usepackage[margin=1.5cm]{geometry}
7 \usepackage[executable=python.exe]{pyluatex}
8 \usepackage[pyluatex]{ResolSysteme}
9 \usepackage{systeme}
10 \usepackage{babel}
11 \usepackage[most]{tcolorbox}
12 \sisetup{locale=FR,output-decimal-marker={,},group-minimum-digits=4}
13 \newtcblisting{ShowCodeTeX}[1][]{colback=white,colframe=red!75!black,listing options={style=tcblatex},#1}
14
15 \begin{document}
16
17 \part*{ResolSysteme (\RSver), version \og pyluatex \fg{}}
18
19 \section{Préambule, avec le package pyluatex}
20
21 \begin{ShowCodeTeX}[listing only]
22 \documentclass[french,a4paper,10pt]{article}
23 \usepackage[margin=1.5cm]{geometry}
24 \usepackage[executable=python.exe]{pyluatex}
25 \usepackage[pyluatex]{ResolSysteme} %version pyluatex, lua + shell-escape
26 \usepackage{systeme}
27 \sisetup{locale=FR,output-decimal-marker={,}}
28 \end{ShowCodeTeX}
29
30 \section{Affichage d'une matrice, 2×2 ou 3×3 ou 4×4}
31
32 \begin{ShowCodeTeX}
33 On considère les matrices $A=\AffMatrice(1,2 § 3,4)$
34 et $B=\AffMatrice[n](-1,-1/3,4 § 1/3,4,-1 § -1,0,0)$
35 et $C=\AffMatrice(1,2,3,4 § 5,6,7,0 § 1,1,1,1 § 2,-3,-5,-6)$.
36 \end{ShowCodeTeX}
37
38 \section{Déterminant d'une matrice, 2×2 ou 3×3 ou 4×4}
39
40 \begin{ShowCodeTeX}
41 Le déterminant de $A=\AffMatrice(1,2 § 3,4)$ est
42 $\det(A)=\DetMatricePY(1,2 § 3,4)$.
43 \end{ShowCodeTeX}
44
45 \begin{ShowCodeTeX}
46 Le déterminant de $A=\AffMatrice(-1,0.5 § -1/2,4)$ est
47 $\det(A)=\DetMatricePY[dec](-1,0.5 § -1/2,4)$.
48 \end{ShowCodeTeX}
49
50 \begin{ShowCodeTeX}
51 Le dét. de $A=\begin{pNiceMatrix} -1&\frac13&4 \\ \frac13&4&-1 \\ -1&0&0 \end{pNiceMatrix}$ est
52 $\det(A) \approx \DetMatricePY[dec=3](-1,1/3,4 § 1/3,4,-1 § -1,0,0)$.
53 \end{ShowCodeTeX}
54
55 \begin{ShowCodeTeX}
56 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}$
57 est $\det(A)=\DetMatricePY(1,2,3,4 § 5,6,7,0 § 1,1,1,1 § 2,-3,-5,-6)$.
58 \end{ShowCodeTeX}
59
60 \section{Calculs avec des matrices, 2×2 ou 3×3 ou 4×4}
61
62 \begin{ShowCodeTeX}
63 $\ProduitMatricesPY(1,2)(3 § 4)[Aff]$ et $\ProduitMatricesPY(1,2)(3,4 § 5,6)[Aff]$ \\
64 $\ProduitMatricesPY(-5,6 § 1,4)(2 § 7)[Aff]$ et $\ProduitMatricesPY(-5,6 § 1,4)(2,-4 § 7,0)[Aff]$
65 \end{ShowCodeTeX}
66
67 \begin{ShowCodeTeX}
68 $\ProduitMatricesPY(1,2,3)(4 § 5 § 6)[Aff]$ et $\ProduitMatricesPY(1,2,3)(1,1,1 § 2,1,5 § 0,5,-6)[Aff]$\\
69 $\ProduitMatricesPY(1,1,1 § 2,1,5 § 0,5,-6)(1 § 2 § 3)[Aff]$ et
70 $\ProduitMatricesPY(1,1,1 § 2,1,5 § 0,5,-6)(1,2,3 § -5,-4,2 § 3,3,10)[Aff]$
71 \end{ShowCodeTeX}
72
73 \begin{ShowCodeTeX}
74 $\ProduitMatricesPY(1,2,3,4)(5 § 6 § 7 § 8)[Aff]$\\
75 $\ProduitMatricesPY(1,2,3,4)(1,1,1,5 § 2,1,5,6 § 0,5,-6,0 § 1,-5,4,2)[Aff]$\\
76 $\ProduitMatricesPY(1,1,1,5 § 2,1,5,6 § 0,5,-6,0 § 1,-5,4,2)(1 § 2 § 3 § 4)[Aff]$\\
77 $\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]$
78 \end{ShowCodeTeX}
79
80 \begin{ShowCodeTeX}
81 $\MatricePuissancePY(1,1 § 5,-2)(7)[Aff]$\\
82 $\MatricePuissancePY(1,1,-1 § 5,-2,1 § 0,5,2)(3)[Aff]$ \\
83 $\MatricePuissancePY(1,1,1,1 § 5,-2,1,5 § 0,5,2,-1 § 0,1,1,1)(5)[Aff]$
84 \end{ShowCodeTeX}
85
86 \section{Inverse d'une matrice, 2×2 ou 3×3 ou 4×4}
87
88 \begin{ShowCodeTeX}
89 L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
90 $A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2 § 3,4)$.
91 \end{ShowCodeTeX}
92
93 \begin{ShowCodeTeX}
94 L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
95 $A^{-1}=\MatriceInversePY*<cell-space-limits=2pt>(1,2 § 3,4)$.
96 \end{ShowCodeTeX}
97
98 \begin{ShowCodeTeX}
99 L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&6 \end{pNiceMatrix}$ est
100 $A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2 § 3,6)$.
101 \end{ShowCodeTeX}
102
103 \begin{ShowCodeTeX}
104 L'inverse de $A=\begin{pNiceMatrix} 1&2 \\ 3&4 \end{pNiceMatrix}$ est
105 $A^{-1}=\MatriceInversePY[d]<cell-space-limits=2pt>(1,2 § 3,4)$.
106 \end{ShowCodeTeX}
107
108 \begin{ShowCodeTeX}
109 L'inverse de $A=\begin{pNiceMatrix} 1&2&3\\4&5&6\\7&8&8 \end{pNiceMatrix}$ est
110 $A^{-1}=\MatriceInversePY<cell-space-limits=2pt>(1,2,3 § 4,5,6 § 7,8,8)$.
111 \end{ShowCodeTeX}
112
113 \begin{ShowCodeTeX}
114 L'inverse de $A=\begin{pNiceMatrix} 1&2&3\\4&5&6\\7&8&8 \end{pNiceMatrix}$ est
115 $A^{-1}=\MatriceInversePY*<cell-space-limits=2pt>(1,2,3 § 4,5,6 § 7,8,8)$.
116 \end{ShowCodeTeX}
117
118 \begin{ShowCodeTeX}
119 L'inverse de $A=\begin{pNiceMatrix} 1&2&3&4\\5&6&7&0\\1&1&1&1\\2&-3&-5&-6 \end{pNiceMatrix}$
120 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)$.
121 \end{ShowCodeTeX}
122
123 \section{Résolution d'un système, 2×2 ou 3×3 ou 4×4}
124
125 \begin{ShowCodeTeX}
126 La solution de $\systeme{-9x-8y=-8,3x-6y=-7}$ est $\mathcal{S}=%
127 \left\lbrace \SolutionSystemePY(-9,-8 § 3,-6)(-8,-7) \right\rbrace$.
128 \end{ShowCodeTeX}
129
130 \begin{ShowCodeTeX}
131 La solution de $\systeme{x+2y=-5,4x+8y=1}$ est $\mathcal{S}=%
132 \left\lbrace \SolutionSystemePY(1,2 § 4,8)(-5,1) \right\rbrace$.
133 \end{ShowCodeTeX}
134
135 \begin{ShowCodeTeX}
136 La solution de $\systeme{-9x-8y=-8,3x-6y=-7}$ est $\mathcal{S}=%
137 \left\lbrace \SolutionSystemePY[d](-9,-8 § 3,-6)(-8,-7) \right\rbrace$.
138 \end{ShowCodeTeX}
139
140 \begin{ShowCodeTeX}
141 La solution de $\systeme{x+y+z=-1,3x+2y-z=6,-x-y+2z=-5}$ est $\mathcal{S}=%
142 \left\lbrace \SolutionSystemePY(1,1,1 § 3,2,-1 § -1,-1,2)(-1,6,-5) \right\rbrace$.
143 \end{ShowCodeTeX}
144
145 \begin{ShowCodeTeX}
146 La solution de $\systeme{x+y+z=-1,3x+2y-z=-5,-x-y+2z=0}$ est donnée par $X=%
147 \SolutionSystemePY*[d]<cell-space-limits=2pt>(1,1,1 § 3,2,-1 § -1,-1,2)(-1,-5,0)[Matrice]$.
148 \end{ShowCodeTeX}
149
150 \begin{ShowCodeTeX}
151 La solution de $\systeme[xyzt]{y+z+t=1,x+z+t=-1,x+y+t=1,x+y+z=0}$ est $\mathcal{S}=%
152 \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$.
153 \end{ShowCodeTeX}
154
155 \begin{ShowCodeTeX}
156 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=
157 \SolutionSystemePY
158 [dec]<cell-space-limits=2pt>
159 (1,2,3,4 § 5,6,7,0 § 1,1,1,1 § -2,-3,-5,-6)(-10,0,4,7)
160 [Matrice]$
161 \end{ShowCodeTeX}
162
163 \section{État probabiliste d'un graphe probabiliste, 2×2 ou 3×3 ou 4×4}
164
165 \begin{ShowCodeTeX}
166 État initial : $P_0 = \AffEtatProb[t](1/3,2/3)$.
167
168 Matrice de transition :
169 $M=\AffMatrice[dec](0.75,0.25 § 0.9,0.1)$
170
171 État à l'instant 5 :
172 $P_5 \approx \EtatProbPY[dec=3](1/3,2/3)%
173 (0.75,0.25 § 0.9,0.1)
174 (5)$
175 \end{ShowCodeTeX}
176
177 \begin{ShowCodeTeX}
178 État initial : $P_0 = \AffEtatProb[dec](0.33,0.52,0.15)$.
179
180 Matrice de transition :
181 $M=\AffMatrice[dec]%
182 (0.1,0.2,0.7 § 0.25,0.25,0.5 § 0.15,0.75,0.1)$
183
184 État à l'instant 7 :
185 $P_7 \approx \EtatProbPY[dec=3]
186 (0.33,0.52,0.15)%
187 (0.1,0.2,0.7 § 0.25,0.25,0.5 § 0.15,0.75,0.1)
188 (7)$
189 \end{ShowCodeTeX}
190
191 \begin{ShowCodeTeX}
192 État initial : $P_0 = \AffEtatProb[dec](0.33,0.52,0.15,0)$.
193
194 Matrice de transition :
195 $M=\AffMatrice[dec]%
196 (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)$
197
198 État à l'instant 4 :
199 $P_4 \approx \EtatProbPY[dec=3]
200 (0.33,0.52,0.15,0)%
201 (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)%
202 (4)$
203 \end{ShowCodeTeX}
204
205 \section{État stable d'un graphe probabiliste, 2×2 ou 3×3 ou 4×4}
206
207 \begin{ShowCodeTeX}
208 L'état stable du gr. prob. de matrice
209 $M=\AffMatrice[dec](0.72,0.28 § 0.12,0.88)$
210
211 est $\Pi = \EtatStablePY[d](0.72,0.28 § 0.12,0.88)$
212 ou $\Pi = \EtatStablePY[dec](0.72,0.28 § 0.12,0.88)$.
213 \end{ShowCodeTeX}
214
215 \begin{ShowCodeTeX}
216 L'état stable du gr. prob. de matrice
217 $M=\AffMatrice[dec](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$
218
219 est $\Pi = \EtatStablePY[d](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$
220 ou $\Pi = \EtatStablePY[dec](0.9,0.03,0.07 § 0.30,0.43,0.27 § 0.14,0.07,0.79)$.
221 \end{ShowCodeTeX}
222
223 \begin{ShowCodeTeX}
224 L'état stable du gr. prob. de matrice
225 $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)$
226
227 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)$.
228 \end{ShowCodeTeX}
229
230 \end{document}