summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCFactorisation.tex
blob: 700fb9906b38210989dbab1a71e5767f69c2eb31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
\setKVdefault[Facto]{Aide=false,AideMul=false,Couleur=Crimson,NomExpression=A,Lettre=x,Details,Formel=false,VariableSup=false,ParenthesesFin=false,Finale=false}
\defKV[Facto]{Litteral=\setKV[Facto]{Details=false}}
\defKV[Facto]{AutreVariable=\setKV[Facto]{VariableSup}}
\defKV[Facto]{Resultat=\setKV[Facto]{Finale}}

\NewDocumentCommand\PfCEcrireFacteur{mm}{%
  \StrCount{#1}{+}[\PfCCountArgTroisPlus]%
  \StrCount{#1}{-}[\PfCCountArgTroisMoins]%
  \xdef\PfCCountArgTrois{\fpeval{\PfCCountArgTroisPlus+\PfCCountArgTroisMoins}}%
  \ensuremath{%
    \IfDecimal{#1}{%
      \ifboolKV[Facto]{Aide}{%
        \phantom{(}\print{#2}\phantom{)}%
      }{%
        \print{#2}%
      }%
    }{%
      \xintifboolexpr{\PfCCountArgTrois==0}{%
        \ifboolKV[Facto]{Aide}{%
          \phantom{(}\print{#2}\phantom{)}%
        }{%
          \print{#2}%
        }%
      }{%
        (\print{#2})%
      }%
    }%
  }%
}%
 
\NewDocumentCommand\Factorisation{sommm}{%
%  \directlua{dofile('poly_render_fix.lua')}
  \useKVdefault[Facto]%
  \setKV[Facto]{#2}%
  \colorlet{Csymbole}{\useKV[Facto]{Couleur}}%
  \IfBooleanTF{#1}{%
    \xdef\PfCFactoSymbole{-}%
  }{%
    \xdef\PfCFactoSymbole{+}%
  }%
  \xdef\PfCFactoNE{\useKV[Facto]{NomExpression}}%
  \ifx\bla#5\bla%
  % Cas a^2-b^2
  \begin{CAS}
    % La variable
    vars('\useKV[Facto]{Lettre}')
    % Les facteurs
    Ka=#3
    Kb=#4
    Kc=(#3)^2
    Kd=(#4)^2
    Ke=(#3)-(#4)
    Kf=(#3)+(#4)
    % Les dérivées pour savoir si ce sont des facteurs littéraux ou pas.
    PfCDDn=DD(Ka,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDm=DD(Kb,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDo=DD(Ke,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDp=DD(Kf,\useKV[Facto]{Lettre}):autosimplify()
    % opposé
    Ko=topoly(-Kb)
    % 
  \end{CAS}
  \setsepchar{,}\ignoreemptyitems
  \readlist\ListeElementDeriveeA{\fetch{PfCDDn}}
  \readlist\ListeElementDeriveeB{\fetch{PfCDDm}}
  \readlist\ListeElementDeriveeE{\fetch{PfCDDo}}
  \readlist\ListeElementDeriveeF{\fetch{PfCDDp}}
  \reademptyitems
  \xdef\TestCASA{\ListeElementDeriveeA[1]}
  \xdef\TestCASB{\ListeElementDeriveeB[1]}
  \ifboolKV[Facto]{Details}{%Version monome mais pas deux nombres
    \begin{align*}
      \PfCFactoNE&=\print{Kc:expand()}-\print{Kd:expand()}\\
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\xintifboolexpr{\TestCASA>1}{(\,}{}{\underbrace{\Fdash{$\print{Ka}$}}_{A}}\xintifboolexpr{\TestCASA>1}{\,)}{}^{\,2}-\xintifboolexpr{\TestCASB>1}{(\,}{}{\underbrace{\Fdash{$\print{Kb}$}}_{B}}\xintifboolexpr{\TestCASB>1}{\,)}{}^{\,2}}{\IfDecimal{#3}{\print{Ka}^2}{\print{Kc}}-\IfDecimal{#4}{\print{Kb}^2}{\print{Kd}}}\\
      \PfCFactoNE&=(\print{Ke})\times(\print{Kf})%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=(\print{Ke})(\print{Kf})}{}%
    \end{align*}
  }{%Avec au moins un des facteurs polynomes
    \begin{align*}
      \ifboolKV[Facto]{Aide}{\IfDecimal{#3}{\PfCFactoNE&=\print{Kc}-\print{Kd}}{\IfDecimal{#4}{\PfCFactoNE&=\print{Kc}-\print{Kd}}{\PfCFactoNE&={\underbrace{\Fdash{$(\print{Ka})$}}_{A}}^{\,2}-{\underbrace{\Fdash{$(\print{Kb})$}}_{B}}^{\,2}}}}{\PfCFactoNE&=\print{Kc}-\print{Kd}}\\
      \IfDecimal{#3}{\PfCFactoNE\uppercase{&}=\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$\phantom{(}\print{Ka}\phantom{)}$}}_{A}}^{\,2}}{\print{Ka}^2}-\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$(\print{Kb})$}}_{B}}^{\,2}}{\print{Kd}}\\}{\IfDecimal{#4}{\PfCFactoNE\uppercase{&}=\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$(\print{Ka})$}}_{A}}^{\,2}}{\print{Kc}}-\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$\phantom{(}\print{Kb}\phantom{)}$}}_{B}}^{\,2}}{\print{Kb}^2}\\}{}}
      \PfCFactoNE&=\left[\IfDecimal{#3}{\print{Ka}}{(\print{Ka})}-\IfDecimal{#4}{\print{Kb}}{(\print{Kb})}\right]\times\left[\IfDecimal{#3}{\print{Ka}}{(\print{Ka})}+\IfDecimal{#4}{\print{Kb}}{(\print{Kb})}\right]\\
      \PfCFactoNE&=\left[\print{Ka}\xintifboolexpr{\TestCASB<0}{+}{}\print{Ko}\right]\times\left[\print{Ka}\StrChar{#4}{1}[\PfCTestCaracUn]\StrCompare{\PfCTestCaracUn}{-}[\PfCTestCaracRetour]\xintifboolexpr{\PfCTestCaracRetour==0}{}{+}\print{Kb}\right]\\
      \PfCFactoNE&=\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Ke:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}\times\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Kf:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}%
                   \ifboolKV[Facto]{Finale}{\\\PfCFactoNE&=\useKV[Facto]{Resultat}}{\ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Ke:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Kf:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}}{}}%
    \end{align*}
  }
\else%k*a+-k*b=k(a+-b)
  \#3 #3 -- \#4 #4 -- \#5 #5
  \begin{CAS}
    % La variable
    vars('\useKV[Facto]{Lettre}'\ifboolKV[Facto]{VariableSup}{%
      ,'\useKV[Facto]{AutreVariable}'
    }{})
    % Les facteurs
    Kk=#3
    Ka=#4
    Kb=#5
    Kka=Kk*Ka
    Kkb=Kk*Kb
    % Les dérivées pour savoir si ce sont des facteurs littéraux ou pas.
    PfCDDn=DD(Ka,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDm=DD(Kb,\useKV[Facto]{Lettre}):autosimplify()
    % opposé
    Ko=topoly(-Kb)
    Ke=(#4)\PfCFactoSymbole(#5)
  \end{CAS}
  \setsepchar{,}\ignoreemptyitems
  \readlist\ListeElementDeriveeA{\fetch{PfCDDn}}
  \readlist\ListeElementDeriveeB{\fetch{PfCDDm}}
  \reademptyitems
  \xdef\TestCAS{\ListeElementDeriveeA[1]}
  \xdef\TestCASB{\ListeElementDeriveeB[1]}
  \ifboolKV[Facto]{Details}{%Version monome mais pas des nombres
    \begin{align*}
      \PfCFactoNE&=\print{Kka:expand()}\PfCFactoSymbole\print{Kkb:expand()}\\
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{Kk}\phantom{)}$}}_{k}}{\print{Kk}}\times\xintifboolexpr{\TestCAS<0}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$(\print{Ka}$}}_{a}}{(\print{Ka})}}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{Ka}\phantom{)}$}}_{a}}{\print{Ka}}}\PfCFactoSymbole\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{Kk}\phantom{)}$}}_{k}}{\print{Kk}}\times\xintifboolexpr{\TestCASB<0}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$(\print{Kb}$}}_{b}}{(\print{Kb})}}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{Kb}\phantom{)}$}}_{b}}{\print{Kb}}}\\
      \PfCFactoNE&=\print{Kk}\times(\print{Ka\PfCFactoSymbole Kb})%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\print{Kk}(\print{Ka\PfCFactoSymbole Kb})}{}%
    \end{align*}
  }{%Avec au moins un des facteurs polynomes
    \StrCompare{\PfCFactoSymbole}{-}[\PfCRetiensSigneFacteurDeux]%
    \StrChar{#5}{1}[\RetiensPremierCaractere]%en cas de deuxième terme écrit b-ax
    \begin{align*}
      \ifboolKV[Facto]{Aide}{\PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{Kk}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#4}{Ka}\PfCFactoSymbole\PfCEcrireFacteur{#3}{Kk}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#5}{Kb}\\\setKV[Facto]{Aide}}{}%
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{\PfCEcrireFacteur{#3}{Kk}}}_{k}\times\underbrace{\Fdash{\PfCEcrireFacteur{#4}{Ka}}}_{a}\PfCFactoSymbole\underbrace{\Fdash{\PfCEcrireFacteur{#3}{Kk}}}_{k}\times\underbrace{\Fdash{\PfCEcrireFacteur{#5}{Kb}}}_{b}}{\PfCEcrireFacteur{#3}{Kk}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#4}{Ka}\PfCFactoSymbole\PfCEcrireFacteur{#3}{Kk}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#5}{Kb}}\setKV[Facto]{Aide=false}\\
      \PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{Kk}\times\left[\PfCEcrireFacteur{#4}{Ka}\PfCFactoSymbole\PfCEcrireFacteur{#5}{Kb}\right]\\
      \PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{Kk}\times\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Ka}\xintifboolexpr{\PfCRetiensSigneFacteurDeux==1}{\xintifboolexpr{\TestCASB<0}{\IfDecimal{\RetiensPremierCaractere}{+}{}}{+}\print{Kb}}{\xintifboolexpr{\TestCASB<0}{+}{}\print{Ko}}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}\\
      \PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{Kk}\times\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Ke:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}%
                   \ifboolKV[Facto]{Finale}{\\\PfCFactoNE&=\useKV[Facto]{Resultat}}{\ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{Kk}\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{Ke:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}}{}}%
    \end{align*}
  }
  \fi
}%

\NewDocumentCommand\Factorisationold{sommm}{%
  \directlua{dofile('poly_render_fix.lua')}
  \useKVdefault[Facto]%
  \setKV[Facto]{#2}%
  \colorlet{Csymbole}{\useKV[Facto]{Couleur}}%
  \IfBooleanTF{#1}{%
    \xdef\PfCFactoSymbole{-}%
  }{%
    \xdef\PfCFactoSymbole{+}%
  }%
  \xdef\PfCFactoNE{\useKV[Facto]{NomExpression}}%
  \ifx\bla#5\bla%
  % Cas a^2-b^2
  \begin{CAS}
    % La variable
    vars('\useKV[Facto]{Lettre}')
    % Les facteurs
    a=#3
    b=#4
    % Les dérivées pour savoir si ce sont des facteurs littéraux ou pas.
    PfCDDn=DD(a,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDm=DD(b,\useKV[Facto]{Lettre}):autosimplify()
    % opposé
    o=topoly(-b)
    % 
    c=(#3)^2
    d=(#4)^2
    e=(#3)-(#4)
    f=(#3)+(#4)
  \end{CAS}
  \setsepchar{,}\ignoreemptyitems
  \readlist\ListeElementDeriveeA{\fetch{PfCDDn}}
  \readlist\ListeElementDeriveeB{\fetch{PfCDDm}}
  \reademptyitems
  \xdef\TestCASA{\ListeElementDeriveeA[1]}
  \xdef\TestCASB{\ListeElementDeriveeB[1]}
  \ifboolKV[Facto]{Details}{%Version monome mais pas deux nombres
    \begin{align*}
      \PfCFactoNE&=\print{c:expand()}-\print{d:expand()}\\
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\xintifboolexpr{\TestCASA>1}{(\,}{}{\underbrace{\Fdash{$\print{a}$}}_{A}}\xintifboolexpr{\TestCASA>1}{\,)}{}^{\,2}-\xintifboolexpr{\TestCASB>1}{(\,}{}{\underbrace{\Fdash{$\print{b}$}}_{B}}\xintifboolexpr{\TestCASB>1}{\,)}{}^{\,2}}{\print{c}-\print{d}}\\
      \PfCFactoNE&=(\print{e})\times(\print{f})%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=(\print{e})(\print{f})}{}%
    \end{align*}
  }{%Avec au moins un des facteurs polynomes
    \begin{align*}
      \ifboolKV[Facto]{Aide}{\IfDecimal{#3}{\PfCFactoNE&=\print{c}-\print{d}}{\IfDecimal{#4}{\PfCFactoNE&=\print{c}-\print{d}}{\PfCFactoNE&={\underbrace{\Fdash{$(\print{a})$}}_{A}}^{\,2}-{\underbrace{\Fdash{$(\print{b})$}}_{B}}^{\,2}}}}{\PfCFactoNE&=\print{c}-\print{d}}\\
      \IfDecimal{#3}{\PfCFactoNE\uppercase{&}=\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$\phantom{(}\print{a}\phantom{)}$}}_{A}}^{\,2}}{\print{a}^2}-\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$(\print{b})$}}_{B}}^{\,2}}{\print{d}}\\}{\IfDecimal{#4}{\PfCFactoNE\uppercase{&}=\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$(\print{a})$}}_{A}}^{\,2}}{\print{c}}-\ifboolKV[Facto]{Aide}{{\underbrace{\Fdash{$\phantom{(}\print{b}\phantom{)}$}}_{B}}^{\,2}}{\print{b}^2}\\}{}}
      \PfCFactoNE&=\left[\IfDecimal{#3}{\print{a}}{(\print{a})}-\IfDecimal{#4}{\print{b}}{(\print{b})}\right]\times\left[\IfDecimal{#3}{\print{a}}{(\print{a})}+\IfDecimal{#4}{\print{b}}{(\print{b})}\right]\\
      \PfCFactoNE&=\left[\print{a}\xintifboolexpr{\TestCASB<0}{+}{}\print{o}\right]\times\left[\print{a}%
                   \xintifboolexpr{\TestCASB<0}{\StrChar{\print{b}}{1}[\PfCTestCaracUn]\StrCompare*{\PfCTestCaracUn}{-}[\PfCTestCaracRetour]\xintifboolexpr{\PfCTestCaracRetour==0}{}{+}}{+}\print{b}\right]\\
      \PfCFactoNE&=\left[\print{e:expand():topolynomial()}\right]\times\left[\print{f:expand():topolynomial()}\right]%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\left[\print{e:expand():topolynomial()}\right]\left[\print{f:expand():topolynomial()}\right]}{}%
    \end{align*}
  }
  \else%k*a+-k*b=k(a+-b)
  \begin{CAS}
    % La variable
    vars('\useKV[Facto]{Lettre}'\ifboolKV[Facto]{VariableSup}{%
      ,'\useKV[Facto]{AutreVariable}'
    }{})
    % Les facteurs
    k=#3
    a=#4
    b=#5
    ka=k*a
    kb=k*b
    % Les dérivées pour savoir si ce sont des facteurs littéraux ou pas.
    PfCDDn=DD(a,\useKV[Facto]{Lettre}):autosimplify()
    PfCDDm=DD(b,\useKV[Facto]{Lettre}):autosimplify()
    % opposé
    o=topoly(-b)
    e=(#4)\PfCFactoSymbole(#5)
  \end{CAS}
  \setsepchar{,}\ignoreemptyitems
  \readlist\ListeElementDeriveeA{\fetch{PfCDDn}}
  \readlist\ListeElementDeriveeB{\fetch{PfCDDm}}
  \reademptyitems
  \xdef\TestCAS{\ListeElementDeriveeA[1]}
  \xdef\TestCASB{\ListeElementDeriveeB[1]}
  \ifboolKV[Facto]{Details}{%Version monome mais pas des nombres
    \begin{align*}
      \PfCFactoNE&=\print{ka:expand()}\PfCFactoSymbole\print{kb:expand()}\\
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{k}\phantom{)}$}}_{k}}{\print{k}}\times\xintifboolexpr{\TestCAS<0}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$(\print{a}$}}_{a}}{(\print{a})}}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{a}\phantom{)}$}}_{a}}{\print{a}}}\PfCFactoSymbole\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{k}\phantom{)}$}}_{k}}{\print{k}}\times\xintifboolexpr{\TestCASB<0}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$(\print{b}$}}_{b}}{(\print{b})}}{\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{$\phantom{(}\print{b}\phantom{)}$}}_{b}}{\print{b}}}\\
      \PfCFactoNE&=\print{k}\times(\print{a\PfCFactoSymbole b})%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\print{k}(\print{a\PfCFactoSymbole b})}{}%
    \end{align*}
  }{%Avec au moins un des facteurs polynomes
    \StrCompare{\PfCFactoSymbole}{-}[\PfCRetiensSigneFacteurDeux]
    \begin{align*}
      \ifboolKV[Facto]{Aide}{\PfCFactoNE&=\setKV[Facto]{Aide=false}\PfCEcrireFacteur{#3}{k}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#4}{a}\PfCFactoSymbole\PfCEcrireFacteur{#3}{k}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#5}{b}\\\setKV[Facto]{Aide}}{}%
      \PfCFactoNE&=\ifboolKV[Facto]{Aide}{\underbrace{\Fdash{\PfCEcrireFacteur{#3}{k}}}_{k}\times\underbrace{\Fdash{\PfCEcrireFacteur{#4}{a}}}_{a}\PfCFactoSymbole\underbrace{\Fdash{\PfCEcrireFacteur{#3}{k}}}_{k}\times\underbrace{\Fdash{\PfCEcrireFacteur{#5}{b}}}_{b}}{\PfCEcrireFacteur{#3}{k}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#4}{a}\PfCFactoSymbole\PfCEcrireFacteur{#3}{k}\ifboolKV[Facto]{AideMul}{\times}{}\PfCEcrireFacteur{#5}{b}}\\
      \PfCFactoNE&=\PfCEcrireFacteur{#3}{k}\times\left[\PfCEcrireFacteur{#4}{a}\PfCFactoSymbole\PfCEcrireFacteur{#5}{b}\right]\\
      \PfCFactoNE&=\PfCEcrireFacteur{#3}{k}\times\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{a}\xintifboolexpr{\PfCRetiensSigneFacteurDeux==1}{\xintifboolexpr{\TestCASB<0}{}{+}\print{b}}{\xintifboolexpr{\TestCASB<0}{+}{}\print{o}}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}\\
      \PfCFactoNE&=\PfCEcrireFacteur{#3}{k}\times\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{e:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}%
                   \ifboolKV[Facto]{Formel}{\\\PfCFactoNE&=\PfCEcrireFacteur{#3}{k}\ifboolKV[Facto]{ParenthesesFin}{\left(}{\left[}\print{e:expand():topolynomial()}\ifboolKV[Facto]{ParenthesesFin}{\right)}{\right]}}{}%
    \end{align*}
  }
  \fi
}%