diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-29 21:18:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-29 21:18:41 +0000 |
commit | 9d7ae2927cf3d71ccecbbf4fe6833086d7823890 (patch) | |
tree | f4cae1879beabf67092879f222ae8885bd7bce90 /Master/texmf-dist/tex/latex | |
parent | 5341475399c47517a19a3a0e73e9a05912d00add (diff) |
proflycee (29jan24)
git-svn-id: svn://tug.org/texlive/trunk@69630 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
4 files changed, 523 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty b/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty index 3aea0ee3328..f7b6a4477b1 100644 --- a/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty +++ b/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty @@ -3,7 +3,8 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2024/01/21 3.01f Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2024/01/27 3.01g Aide pour l'utilisation de LaTeX en lycee] +% 3.01g Ajout de commandes internes, en phase de test (et non documentées à 100%...) % 3.01f PseudoCode avec piton (avec langage=minimal de FP ^^) + Suppression Terminal (doublon avec sim-os-menus) % 3.01e Mise ne conformité avec pyluatex/piton % 3.01d Ajout des commentaires en gris italique (via #) pour le pseudocode diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex index d0bd049bd44..2fb8b930c0a 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex @@ -126,8 +126,56 @@ {%sinon := expo 'croissante' \draw[thick,#2] ({-0.5*#3},{-0.325*#4}) to[out=1,in=-105] ({0.5*#3},{0.5*#4}); } - \draw[#2] ({0},{0}) node[inner sep=0pt,above=0pt,font=\scriptsize] {\textcircled{$+$}}; - + \draw[#2] ({0},{0}) node[inner sep=0pt,above=0pt,font=\scriptsize] {\textcircled{$+$}};. +} + +\NewDocumentCommand\schematdsexposol{ s m m m o }{%pour les expos avec solution (interne) + % * = étoilée -> a négatif + % #2 = couleur + % #3 = largeur + % #4 = hauteur + % #5 = racine + \IfBooleanTF{#1}%si étoile := expo 'décroissante' + {% + \draw[thick,#2] ({-0.35*#3},{0.5*#4}) to[out=-75,in=179] ($({0.5*#3},{-0.325*#4})+(2mm,0)$) ; + \filldraw[#2] ({-0.1925*#3},0) circle[radius=2pt] ; + \draw[#2] ({0.5*#3},{-0.1625*#4}) node[inner sep=0pt,left=2pt,font=\scriptsize] {\textcircled{$-$}} ; + \draw[#2] ({-0.5*#3},{0.25*#4}) node[inner sep=0pt,right=1pt,font=\scriptsize] {\textcircled{$+$}} ; + \draw[#2] ({-0.1925*#3},0) node[inner sep=0pt,below left=1pt,font=\scriptsize] {$\strut#5$} ; + } + {%sinon := expo 'croissante' + \draw[thick,#2] ({-0.5*#3},{-0.325*#4}) to[out=1,in=-105] ({0.35*#3},{0.5*#4}); + \filldraw[#2] ({0.1925*#3},0) circle[radius=2pt] ; + \draw[#2] ({0.5*#3},{0.25*#4}) node[inner sep=0pt,left=1pt,font=\scriptsize] {\textcircled{$+$}} ; + \draw[#2] ({-0.5*#3},{-0.1625*#4}) node[inner sep=0pt,right=2pt,font=\scriptsize] {\textcircled{$-$}} ; + \draw[#2] ({0.1925*#3},0) node[inner sep=0pt,above left=1pt,font=\scriptsize] {$\strut#5$} ; + } +} + +\NewDocumentCommand\schematdslnsol{ s m m m o }{%pour les ln avec solution (interne) + % * = étoilée -> a négatif + % #2 = couleur + % #3 = largeur + % #4 = hauteur + % #5 = racine + \IfBooleanTF{#1}%si étoile := ln 'décroissante' + {% + %\draw[thick,#2] ({-0.35*#3},{0.5*#4}) to[out=75,in=179] ($({0.5*#3},{0.325*#4})+(2mm,0)$) ; + %\filldraw[#2] ({-0.1925*#3},0) circle[radius=2pt] ; + %\draw[#2] ({-0.5*#3},{-0.25*#4}) node[inner sep=0pt,right=1pt,font=\scriptsize] {\textcircled{$-$}} ; + %\draw[#2] ({0.5*#3},{0.5*0.325*#4}) node[inner sep=0pt,left=1pt,font=\scriptsize] {\textcircled{$+$}} ; + %\draw[thick,#2] ({-0.35*#3},{0.5*#4}) to[out=-75,in=179] ($({0.5*#3},{-0.325*#4})+(2mm,0)$) ; + %\filldraw[#2] ({-0.1925*#3},0) circle[radius=2pt] ; + %\draw[#2] ({0.5*#3},{-0.1625*#4}) node[inner sep=0pt,left=2pt,font=\scriptsize] {\textcircled{$-$}} ; + %\draw[#2] ({-0.5*#3},{0.25*#4}) node[inner sep=0pt,right=1pt,font=\scriptsize] {\textcircled{$+$}} ; + } + {%sinon := ln 'croissante' + \draw[thick,#2] ({-0.35*#3},{-0.5*#4}) to[out=75,in=-175] ($({0.5*#3},{0.45*#4})+(2mm,0)$) ; + \filldraw[#2] ({-0.1975*#3},0) circle[radius=2pt] ; + \draw[#2] ({-0.5*#3},{-0.25*#4}) node[inner sep=0pt,right=1pt,font=\scriptsize] {\textcircled{$-$}} ; + \draw[#2] ({0.5*#3},{0.5*0.425*#4}) node[inner sep=0pt,left=1pt,font=\scriptsize] {\textcircled{$+$}} ; + \draw[#2] ({-0.1925*#3},0) node[inner sep=0pt,above left=1pt,font=\scriptsize] {$\strut#5$} ; + } } \NewDocumentCommand\schematdsparab{ m m m m m o }{%pour les paraboles (interne) @@ -205,6 +253,10 @@ \IfEq{\tdsparam}{pa-d-}{\def\xcode{-10}\def\xcodehautaxe{0}}{} \IfEq{\tdsparam}{expo+}{\def\xcode{20}\def\xcodehautaxe{-0.35}}{} \IfEq{\tdsparam}{expo-}{\def\xcode{-20}\def\xcodehautaxe{-0.35}}{} + \IfEq{\tdsparam}{exposol+}{\def\xcode{30}\def\xcodehautaxe{0}}{} + \IfEq{\tdsparam}{exposol-}{\def\xcode{-30}\def\xcodehautaxe{0}}{} + \IfEq{\tdsparam}{lnsol+}{\def\xcode{40}\def\xcodehautaxe{0}}{} + %\IfEq{\tdsparam}{lnsol-}{\def\xcode{-40}\def\xcodehautaxe{0}}{} %si commande étoilée := commande autonome \IfBooleanTF{#1}% {\begin{tikzpicture}[#3,>=latex]}{}% @@ -256,6 +308,22 @@ \ifnum\xcode=-20 \schematdsexpo*{\tdscouleur}{\tdslarg}{\tdshaut} \fi + %expo avec solution (croissante) code = 30 + \ifnum\xcode=30 + \schematdsexposol{\tdscouleur}{\tdslarg}{\tdshaut}[\tdsracine] + \fi + %expo avec solution (décroissante) code = -30 + \ifnum\xcode=-30 + \schematdsexposol*{\tdscouleur}{\tdslarg}{\tdshaut}[\tdsracine] + \fi + %ln avec solution (croissante) code = 40 + \ifnum\xcode=40 + \schematdslnsol{\tdscouleur}{\tdslarg}{\tdshaut}[\tdsracine] + \fi + %ln avec solution (décroissante) code = -40 + %\ifnum\xcode=-40 + % \schematdslnsol*{\tdscouleur}{\tdslarg}{\tdshaut}[\tdsracine] + %\fi \IfBooleanTF{#1}% {\end{tikzpicture}}{}% } diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex index 9b2d9eb6530..01cb4722c49 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex @@ -933,4 +933,310 @@ \IfBooleanT{#1}{~avec $0 \leqslant \num{\xintiiRem{#3}{#4}} < \xintifboolexpr{#4 < 0}{\lvert\num{#4}\rvert}{\num{#4}}$}% } +%====ADDITIONS POSÉES ? +\newlength{\colspecbinadd} +\setlength{\colspecbinadd}{2pt} + +\NewDocumentCommand\PosRetenue{ O{red} m }{% + %\tmptextcircled[#1]{#2}% + \textcolor{#1}{\scalebox{\addbinposescret}[\addbinposescret]{#2}}% +} + +\defKV[AddBinaire]{% + CouleurRetenue=\def\addbinposecol{#1},% + Espacement=\setlength{\colspecbinadd}{#1},% + Police=\def\addbinposefont{#1},% + EchelleRetenue=\def\addbinposescret{#1},% + Base=\def\addbinposebase{#1} +} + +\setKVdefault[AddBinaire]{% + CouleurRetenue=red,% + Espacement=2pt,% + Police=\normalsize\normalfont,% + EchelleRetenue=0.4,% + Base=dec,% + Egal=true +} + +\NewDocumentCommand\PoseAddition{ O{} m m }{% + \restoreKV[AddBinaire]% + \setKV[AddBinaire]{#1}% + %le résultat + \IfStrEq{\addbinposebase}{dec}% + {\xdef\tmpresultat{\xinteval{#2+#3}}}% + {}% + \IfStrEq{\addbinposebase}{bin}% + {\xdef\tmpresultat{\xintDecToBin{\xinteval{\xintBinToDec{#2}+\xintBinToDec{#3}}}}}% + {}% + \IfStrEq{\addbinposebase}{hex}% + {\xdef\tmpresultat{\xintDecToHex{\xinteval{\xintHexToDec{#2}+\xintHexToDec{#3}}}}}% + {}% + %\xdef\tmpresultat{\xintDecToBin{\xinteval{\xintBinToDec{#2}+\xintBinToDec{#3}}}}% + %les calculs + \StrLen{#2}[\longueurA]\StrLen{#3}[\longueurB]\StrLen{\tmpresultat}[\longueurC]% + \xdef\longueurMax{\xinteval{max(\longueurA,\longueurB,\longueurC)}}%\longueurMax + %le tableau + \xintifboolexpr{\longueurB > \longueurA}% + {% + \xdef\ArgLigneHaut{#3}\xdef\ArgLigneBas{#2}% + \xdef\addposeehaut{#3}\xdef\addposeebas{#2}% + }% + {% + \xdef\ArgLigneHaut{#2}\xdef\ArgLigneBas{#3}% + \xdef\addposeehaut{#2}\xdef\addposeebas{#3}% + }% + %création de la ligne du haut + \StrLen{\ArgLigneHaut}[\LgHaut]% + \StrChar{\ArgLigneHaut}{\LgHaut}[\LigneBinAdd]% + \foreach \i in {1,...,\inteval{\LgHaut-1}}% + {% + \xdef\tmpcoeff{\xinteval{\LgHaut-\i}}% + \StrChar{\ArgLigneHaut}{\tmpcoeff}[\TmpHaut]% + \xdef\LigneBinAdd{\TmpHaut & \LigneBinAdd}% + }% + \xintifboolexpr{\longueurMax > \LgHaut}% + {% + \foreach \i in {1,...,\inteval{\longueurMax-\LgHaut}}% + {\xdef\LigneBinAdd{& \LigneBinAdd}}% + }% + {}% + %création de la ligne du bas + \StrLen{\ArgLigneBas}[\LgBas]% + \StrChar{\ArgLigneBas}{\LgBas}[\LigneBinAddB]% + \foreach \i in {1,...,\inteval{\LgBas-1}}% + {% + \xdef\tmpcoeff{\xinteval{\LgBas-\i}}% + \StrChar{\ArgLigneBas}{\tmpcoeff}[\TmpBas]% + \xdef\LigneBinAddB{\TmpBas & \LigneBinAddB}% + }% + \xintifboolexpr{\longueurMax > \LgBas}% + {% + \foreach \i in {1,...,\inteval{\longueurMax-\LgBas}}% + {\xdef\LigneBinAddB{& \LigneBinAddB}}% + }% + {}% + %création de la ligne du résultat + \StrLen{\tmpresultat}[\LgRes]% + \StrChar{\tmpresultat}{\LgRes}[\LigneBinRes]% + \foreach \i in {1,...,\inteval{\LgRes-1}}% + {% + \xdef\tmpcoeff{\xinteval{\LgRes-\i}}% + \StrChar{\tmpresultat}{\tmpcoeff}[\TmpRes]% + \xdef\LigneBinRes{\TmpRes & \LigneBinRes}% + }% + %création des retenues... + \xdef\ArgBasZeros{\ArgLigneBas}% + \xintifboolexpr{\LgHaut > \LgBas}% + {% + \foreach \i in {1,...,\inteval{\LgHaut-\LgBas}}% + {\xdef\ArgBasZeros{0\ArgBasZeros}}% + }% + {}% + %\ArgBasZeros\par + \xdef\listeretenues{0}% + \xdef\longueurmax{\xinteval{max(\longueurA,\longueurB)}}%\longueurMax + \foreach \i in {1,...,\longueurmax}% + {% + \readlist*\lstretenues{\listeretenues}% + \xdef\tmpcoeff{\xinteval{\longueurmax-\i+1}}% + \itemtomacro\lstretenues[-\i]{\TmPNbR}% + \StrChar{\ArgLigneHaut}{\tmpcoeff}[\TmPNbH]% + \StrChar{\ArgBasZeros}{\tmpcoeff}[\TmPNbB]% + %cas de la base + \IfStrEq{\addbinposebase}{dec}% + {\xdef\tmpresultat{\xinteval{\TmPNbR+\TmPNbH+\TmPNbB}}}% + {}% + \IfStrEq{\addbinposebase}{bin}% + {\xdef\tmpresultat{\xintDecToBin{\xinteval{\xintBinToDec{\TmPNbR}+\xintBinToDec{\TmPNbH}+\xintBinToDec{\TmPNbB}}}}}% + {}% + \IfStrEq{\addbinposebase}{hex}% + {\xdef\tmpresultat{\xintDecToHex{\xinteval{\xintHexToDec{\TmPNbR}+\xintHexToDec{\TmPNbH}+\xintHexToDec{\TmPNbB}}}}}% + {}% + %suite + %\xdef\tmpresultat{\xintDecToBin{\xinteval{\xintBinToDec{\TmPNbR}+\xintBinToDec{\TmPNbH}+\xintBinToDec{\TmPNbB}}}}% + \StrLen{\tmpresultat}[\LgRetenue]% + \xintifboolexpr{\LgRetenue == 1}%si on met une retenue... + {% + \xdef\listeretenues{0,\listeretenues}% + }% + {% + \StrGobbleRight{\tmpresultat}{1}[\tmpretenue]% + \xdef\listeretenues{\tmpretenue,\listeretenues}% + }% + }% + %On compte le nombre de zéros dans la ligne des retenues + \StrCount{\listeretenues}{0}[\nbretenues]%\listeretenues\par\nbretenues\par% + \readlist*\lstretenues{\listeretenues}% + %\showitems*{\lstretenues}\par + \xdef\LigneBinAddRet{\xintifboolexpr{\lstretenues[-1] == 0}{}{\PosRetenue[\addbinposecol]{\lstretenues[-1]}}}% + \foreach \i in {2,...,\longueurMax}% + {% + \xdef\LigneBinAddRet{\xintifboolexpr{\lstretenues[-\i] == 0}{}{\PosRetenue[\addbinposecol]{\lstretenues[-\i]}} & \LigneBinAddRet}% + }% + %et on passe au tableau + \xdef\longueurcasesope{\xinteval{\longueurMax-1}}% + \xdef\longueurtotale{\xinteval{\longueurMax+1}}% + \setlength{\tabcolsep}{\colspecbinadd}% + %\begin{tabular}{@{\hskip0.5\colspecbinadd}c@{\hskip0.5\colspecbinadd}*{\longueurcasesope}{c@{\hskip\colspecbinadd}}c@{\hskip0.5\colspecbinadd}} + \begin{NiceTabular}{c*{\longueurMax}{c}} + \xintifboolexpr{\nbretenues > \longueurmax}{}{\RowStyle[cell-space-limits=1pt]{\addbinposefont} & \LigneBinAddRet \\} + \RowStyle[nb-rows=*,cell-space-limits=2pt]{\addbinposefont} + &\LigneBinAdd \\ + +&\LigneBinAddB \\ + \hline + \ifboolKV[AddBinaire]{Egal}{=}{}&\LigneBinRes \\ + \end{NiceTabular} + %\end{tabular}% +} + +\ifluatex + +\RequirePackage{lualinalg} + +\defKV[addbinlua]{% + CouleurRetenue=\def\addbinluacol{#1},% + Espacement=\def\addbinluaspace{#1},% + Police=\def\addbinluafonte{#1},% + Base=\def\addbinluabase{#1},% + EchelleRetenue=\def\addbinluascret{#1} +} + +\setKVdefault[addbinlua]{% + CouleurRetenue=red,% + Espacement=2pt,% + Police=\normalsize\normalfont,% + Egal=true,% + Base=dec,% + EchelleRetenue=0.4 +} + +\NewDocumentCommand\SommeElementsMatriceBin{ m m m m O{\poseretenue} }{% + %1=matrice + %2=colonne + %3=ligne début + %4=ligne arrivée + \xdef\tmpsomme{0}% + \foreach \lig in {#3,...,#4}{% + \xdef\tmpsomme{\xinteval{\tmpsomme+\xintBinToDec{\matrixGetElement{#1}{\lig}{#2}}}}%calcul intermédiaire en binaire + }% + \xdef#5{\xintDecToBin{\tmpsomme}}% +} + +\NewDocumentCommand\SommeElementsMatriceDec{ m m m m O{\poseretenue} }{% + %1=matrice + %2=colonne + %3=ligne début + %4=ligne arrivée + \xdef\tmpsomme{0}% + \foreach \lig in {#3,...,#4}{% + \xdef\tmpsomme{\xinteval{\tmpsomme+\matrixGetElement{#1}{\lig}{#2}}}%calcul intermédiaire en binaire + }% + \xdef#5{\tmpsomme}% +} + +\NewDocumentCommand\PoseAdditionLua{ O{} m }{% + \restoreKV[addbinlua]% + \setKV[addbinlua]{#1}% + \setsepchar{+}% + \readlist*\addbinlstoper{#2}% + \xdef\nboperandes{\addbinlstoperlen}% + \xdef\nboperandesmat{\xinteval{\addbinlstoperlen+1}}% + %le résultat du calcul en binaire + \xdef\tmpres{0}% + \foreach \i in {1,...,\addbinlstoperlen}{% + \itemtomacro\addbinlstoper[\i]{\tmpinteroper}% + \IfStrEq{\addbinluabase}{dec}% + {\xdef\tmpres{\xinteval{\tmpres+\tmpinteroper}}}% + {}% + \IfStrEq{\addbinluabase}{bin}% + {\xdef\tmpres{\xinteval{\tmpres+\xintBinToDec{\tmpinteroper}}}}% + {}% + %\xdef\tmpres{\xinteval{\tmpres+\xintBinToDec{\tmpinteroper}}}% + }% + \IfStrEq{\addbinluabase}{dec}% + {\xdef\tmpresultat{\tmpres}}% + {}% + \IfStrEq{\addbinluabase}{bin}% + {\xdef\tmpresultat{\xintDecToBin{\tmpres}}}% + {}% + %\xdef\tmpresultat{\xintDecToBin{\tmpres}}%\tmpresultat% + \StrLen{\tmpresultat}[\nbtotalchiffresres]%\nbtotalchiffresres% + \xdef\nblignesmatriceintertmp{\xinteval{1+\nboperandes}}% + \xdef\nblignesmatricetmp{\xinteval{2+\nboperandes}}% + \matrixNew{MATINTER}{\nblignesmatricetmp,\nbtotalchiffresres,'zero'}% + %création des lignes intermédiaires + \foreach \nblig [count=\xi] in {2,...,\nblignesmatriceintertmp}{% + \itemtomacro\addbinlstoper[\xi]{\tmpinteroper}%on extrait l'opérande + \StrLen{\tmpinteroper}[\nbchiiffres]%on extrait son nb de chiffres + \xdef\tmpoffset{\xinteval{\nbtotalchiffresres-\nbchiiffres+1}}%on calcule la position du 1er chiffre + \foreach \poschar [count=\xii] in {\tmpoffset,...,\nbtotalchiffresres}{% + \StrChar{\tmpinteroper}{\xii}[\tmpcoeffaddbin]% + \matrixSetElement{MATINTER}{\nblig}{\poschar}{\tmpcoeffaddbin}% + }% + }% + %création de la ligne résultat + \foreach \j in {1,...,\nbtotalchiffresres}{% + \StrChar{\tmpresultat}{\j}[\tmpcoeffaddbin]% + \matrixSetElement{MATINTER}{\nblignesmatricetmp}{\j}{\tmpcoeffaddbin}% + }% + %gestion des retenues, de la droite vers la gauche + \foreach \nbcol in {\nbtotalchiffresres,...,2}{% + \IfStrEq{\addbinluabase}{dec}% + {\SommeElementsMatriceDec{MATINTER}{\nbcol}{1}{\nboperandesmat}[\poseretenue]}% + {}% + \IfStrEq{\addbinluabase}{bin}% + {\SommeElementsMatriceBin{MATINTER}{\nbcol}{1}{\nboperandesmat}[\poseretenue]}% + {}% + %\SommeElementsMatriceBin{MATINTER}{\nbcol}{1}{\nboperandesmat}[\poseretenue]% + \xdef\nbcolmun{\xinteval{\nbcol-1}}% + \StrLen{\poseretenue}[\nbchiffresretenue]% + \xintifboolexpr{\nbchiffresretenue > 1}% + {\StrGobbleRight{\poseretenue}{1}[\RETENUE]}% + {\xdef\RETENUE{\poseretenue}}% + \matrixSetElement{MATINTER}{1}{\nbcolmun}{\RETENUE}% + }% + %ligne des retenues pour savoir si il y en a ! + \matrixSubmatrix{MATINTERRETENUE}{MATINTER}{1}{1}{1}{\nbtotalchiffresres}% + %création de la ligne des retenues + \xdef\LigneBinAddRet{}% + \foreach \i in {1,...,\nbtotalchiffresres}{% + \xintifboolexpr{\matrixGetElement{MATINTER}{1}{\i} == 0}% + {\xdef\LigneBinAddRet{\LigneBinAddRet &}}% + {\xdef\LigneBinAddRet{\LigneBinAddRet & \textcolor{\addbinluacol}{\scalebox{\addbinluascret}[\addbinluascret]{\matrixGetElement{MATINTER}{1}{\i}}}}}% + }% + %création des lignes intermédiaires + \xdef\LignesOperande{}% + \foreach \i in {1,...,\nboperandes}{% + \xdef\xxi{\xinteval{\i+1}}% + \itemtomacro\addbinlstoper[\i]{\tmpinteroper}%on extrait l'opérande + \StrLen{\tmpinteroper}[\nbchiiffres]%on extrait son nb de chiffres + \xdef\tmpoffset{\xinteval{\nbtotalchiffresres-\nbchiiffres}}%on calcule le nombre de cases vides + \xintifboolexpr{\i == 1}{}{\xdef\LignesOperande{\LignesOperande + }}% + \xintifboolexpr{\tmpoffset == 0}% + {}% + { + \foreach \k in {1,...,\tmpoffset}{% + \xdef\LignesOperande{\LignesOperande &}% + }% + }% + \foreach \j in {\inteval{\tmpoffset+1},...,\nbtotalchiffresres}{% + \xdef\LignesOperande{\LignesOperande & \matrixGetElement{MATINTER}{\xxi}{\j}}% + }% + \xdef\LignesOperande{\LignesOperande \\}% + }% + %et le tableau !! + \setlength{\tabcolsep}{\addbinluaspace}% + \begin{NiceTabular}{c*{\nbtotalchiffresres}{c}} + \xintifboolexpr{\matrixNormOne{MATINTERRETENUE} == 0}{}{\RowStyle[cell-space-limits=1pt]{\addbinluafonte} \LigneBinAddRet \\} + \RowStyle[nb-rows=*,cell-space-limits=2pt]{\addbinluafonte} + \LignesOperande + \hline + \ifboolKV[addbinlua]{Egal}{=}{} \xintFor* ##1 in {\xintSeq{1}{\nbtotalchiffresres}}\do{& \matrixGetElement{MATINTER}{\nblignesmatricetmp}{##1}} \\ + \end{NiceTabular}% + %\(\matrixPrint{MATINTER}\) +} + +\fi + \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-complexes.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-complexes.tex index fedb4bfcfc2..d8379269b32 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-complexes.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-complexes.tex @@ -27,12 +27,12 @@ \xintifboolexpr{\xinttmpreCalc == 0 'and' \xinttmpimCalc == 0}{0}{}% \xintifboolexpr{\xinttmpreCalc == 0 'and' \xinttmpimCalc == 1}{\i}{}% \xintifboolexpr{\xinttmpreCalc == 0 'and' \xinttmpimCalc == -1}{-\i}{}% - \xintifboolexpr{\xinttmpreCalc == 0 'and' abs(\xinttmpimCalc) != 1 'and' \xinttmpimCalc != 0}{\ConversionFraction[#1]{\tmpimCalc}\i}{}% - \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc < 0 'and' \xinttmpimCalc != -1}{\ConversionFraction[#1]{\tmpreCalc}-\ConversionFraction[#1]{-(\tmpimCalc)}\i}{}% - \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == -1}{\ConversionFraction[#1]{\tmpreCalc}-\i}{}% - \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == 1}{\ConversionFraction[#1]{\tmpreCalc}+\i}{}% - \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc > 0 'and' \xinttmpimCalc != 1}{\ConversionFraction[#1]{\tmpreCalc}+\ConversionFraction[#1]{\tmpimCalc}\i}{}% - \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == 0}{\ConversionFraction[#1]{\tmpreCalc}}{}% + \xintifboolexpr{\xinttmpreCalc == 0 'and' abs(\xinttmpimCalc) != 1 'and' \xinttmpimCalc != 0}{\ConversionFraction[#1]{\xinttmpimCalc}\i}{}% + \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc < 0 'and' \xinttmpimCalc != -1}{\ConversionFraction[#1]{\xinttmpreCalc}-\ConversionFraction[#1]{-(\xinttmpimCalc)}\i}{}% + \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == -1}{\ConversionFraction[#1]{\xinttmpreCalc}-\i}{}% + \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == 1}{\ConversionFraction[#1]{\xinttmpreCalc}+\i}{}% + \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc > 0 'and' \xinttmpimCalc != 1}{\ConversionFraction[#1]{\xinttmpreCalc}+\ConversionFraction[#1]{\xinttmpimCalc}\i}{}% + \xintifboolexpr{\xinttmpreCalc != 0 'and' \xinttmpimCalc == 0}{\ConversionFraction[#1]{\xinttmpreCalc}}{}% }% } @@ -619,4 +619,143 @@ }% } +\NewDocumentCommand\ExtractParamExprRac{ m O{\tmpCoeffA} O{\tmpCoeffB} O{\tmpCoeffC} O{\tmpCoeffD} }{% + \StrCount{#1}{sqrt}[\tmpnbrac]% + \xintifboolexpr{\tmpnbrac == 2}% + {% + \StrBetween{#1}{sqrt(}{)}[#3]% + \StrBetween[2,2]{#1}{sqrt(}{)}[#5]% + \StrBefore{#1}{sqrt}[#2]% + \StrBetween[1,2]{#1}{)}{sqrt}[#4]% + \StrDel{#2}{*}[#2]% + \IfEq{#2}{}{\xdef#2{1}}{}% + \IfEq{#2}{-}{\xdef#2{-1}}{}% + \StrDel{#4}{*}[#4]% + \StrDel{#4}{+}[#4]% + \IfEq{#4}{}{\xdef#4{1}}{}% + \IfEq{#4}{-}{\xdef#4{-1}}{}% + }% + {}% + \xintifboolexpr{\tmpnbrac == 0}% + {% + \xdef#2{#1}% + \xdef#3{1}% + \xdef#4{0}% + \xdef#5{1}% + }% + {}% + \xintifboolexpr{\tmpnbrac == 1}% + {% + \xdef#5{1}% + \StrBetween{#1}{sqrt(}{)}[#3]% + \StrBefore{#1}{sqrt}[#2]% + \StrDel{#2}{*}[#2]% + \IfEq{#2}{}{\xdef#2{1}}{}% + \IfEq{#2}{-}{\xdef#2{-1}}{}% + \StrBehind{#1}{)}[#4]% + \StrDel{#4}{+}[#4]% + \IfEq{#4}{}{\xdef#4{0}}{}% + }% + {}% +} + +\NewDocumentCommand\SimplCarreExprRacine{ O{} m }{% + \ExtractParamExprRac{#2}% + %si le produit des racines est un entier ? + \xintifboolexpr{isint(sqrt(\tmpCoeffB*\tmpCoeffD)) == 1}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffB)+(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffD)+2*(\tmpCoeffA)*(\tmpCoeffC)*sqrt(\tmpCoeffB*\tmpCoeffD)}% + }% + }% + {% + \xintifboolexpr{\tmpCoeffA > 0 'and' \tmpCoeffC > 0}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffB)+(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffD)}+% + \IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{4*(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffB)*(\tmpCoeffD)}% + }% + }% + {}% + \xintifboolexpr{\tmpCoeffA > 0 'and' \tmpCoeffC < 0}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffB)+(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffD)}-% + \IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{4*(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffB)*(\tmpCoeffD)}% + }% + }% + {}% + \xintifboolexpr{\tmpCoeffA < 0 'and' \tmpCoeffC > 0}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffB)+(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffD)}-% + \IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{4*(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffB)*(\tmpCoeffD)}% + }% + }% + {}% + \xintifboolexpr{\tmpCoeffA < 0 'and' \tmpCoeffC < 0}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffB)+(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffD)}+% + \IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{4*(\tmpCoeffA)*(\tmpCoeffA)*(\tmpCoeffC)*(\tmpCoeffC)*(\tmpCoeffB)*(\tmpCoeffD)}% + }% + }% + {}% + \xintifboolexpr{\tmpCoeffC == 0 'and' abs(\tmpCoeffA) != 1}% + {% + \ensuremath{% + \ConversionFraction[#1]{(\tmpCoeffA)*(\tmpCoeffA)}% + \IfEq{#1}{d}{\displaystyle}{}\xintifboolexpr{\tmpCoeffB != 1}{\SimplificationRacine{(\tmpCoeffB)*(\tmpCoeffB)}}{}% + }% + }% + {}% + \xintifboolexpr{\tmpCoeffC == 0 'and' abs(\tmpCoeffA) == 1}% + {% + \ensuremath{% + \IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{(\tmpCoeffB)*(\tmpCoeffB)}% + }% + }% + {}% + }% +} + +\NewDocumentCommand\CalcModuleCplx{ O{} m m }{% + \ExtractParamExprRac{#2}[\Crea][\Creb][\Crec][\Cred]% + \ExtractParamExprRac{#3}[\Cima][\Cimb][\Cimc][\Cimd]% + \xdef\TmpCoeffsDebut{(\Crea)*(\Crea)*(\Creb)+(\Crec)*(\Crec)*(\Cred)+(\Cima)*(\Cima)*(\Cimb)+(\Cimc)*(\Cimc)*(\Cimd)}% + \xdef\TmpCoeffsRacineA{4*(\Crea)*(\Crea)*(\Crec)*(\Crec)*(\Creb)*(\Cred)}% + \xdef\TmpCoeffsRacineB{4*(\Cima)*(\Cima)*(\Cimc)*(\Cimc)*(\Cimb)*(\Cimd)}% + %\xinteval{\TmpCoeffsDebut}/\xinteval{\TmpCoeffsRacineA}/\xinteval{\TmpCoeffsRacineB}/\xinteval{(\Crea)*(\Crec)}/\xinteval{(\Cima)*(\Cimc)}= + \xintifboolexpr{\TmpCoeffsRacineA == 0 'and' \TmpCoeffsRacineB == 0}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{\TmpCoeffsDebut}}% + }% + {}% + \xintifboolexpr{\TmpCoeffsRacineA == 0 'and' \TmpCoeffsRacineB != 0}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\sqrt{\SimplificationRacine{(\TmpCoeffsDebut)*(\TmpCoeffsDebut)}\xintifboolexpr{(\Cima)*(\Cimc) < 0}{-}{+}\SimplificationRacine{\TmpCoeffsRacineB}}}% + }% + {}% + \xintifboolexpr{\TmpCoeffsRacineA != 0 'and' \TmpCoeffsRacineB == 0}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\sqrt{\SimplificationRacine{(\TmpCoeffsDebut)*(\TmpCoeffsDebut)}\xintifboolexpr{(\Crea)*(\Crec) < 0}{-}{+}\SimplificationRacine{\TmpCoeffsRacineA}}}% + }% + {}% + \xintifboolexpr{\TmpCoeffsRacineA != 0 'and' \TmpCoeffsRacineB != 0 'and' (\Crea)*(\Crec) < 0 'and' (\Cima)*(\Cimc) > 0 'and' \TmpCoeffsRacineA == \TmpCoeffsRacineB}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{\TmpCoeffsDebut}}% + }% + {}% + \xintifboolexpr{\TmpCoeffsRacineA != 0 'and' \TmpCoeffsRacineB != 0 'and' (\Crea)*(\Crec) > 0 'and' (\Cima)*(\Cimc) < 0 'and' \TmpCoeffsRacineA == \TmpCoeffsRacineB}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\SimplificationRacine{\TmpCoeffsDebut}}% + }% + {}% + \xintifboolexpr{\TmpCoeffsRacineA != \TmpCoeffsRacineB}% + {% + \ensuremath{\IfEq{#1}{d}{\displaystyle}{}\sqrt{\SimplificationRacine{(\TmpCoeffsDebut)*(\TmpCoeffsDebut)}\xintifboolexpr{(\Crea)*(\Crec) < 0}{-}{+}\SimplificationRacine{\TmpCoeffsRacineA}\xintifboolexpr{(\Cima)*(\Cimc) < 0}{-}{+}\SimplificationRacine{\TmpCoeffsRacineB}}}% + }% + {}% +} + \endinput
\ No newline at end of file |