diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-04 19:53:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-04 19:53:24 +0000 |
commit | 0f26f9b08a67574b58941d4658c16372f46f087e (patch) | |
tree | e2663c556a4bf8a9b31a20d1e6504c6f31360e1c /Master/texmf-dist/tex/latex/profcollege | |
parent | 0873b12963d49655a15e9f87f8d493eebd0aaa49 (diff) |
profcollege (4jul23)
git-svn-id: svn://tug.org/texlive/trunk@67545 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/profcollege')
25 files changed, 6750 insertions, 588 deletions
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex b/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex new file mode 100644 index 00000000000..fbf80943d41 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex @@ -0,0 +1,227 @@ +%%% +% Automatismes +%%% +\NewDocumentCommand\ChoixAleaMixold{mmmm}{% + \ChoixAlea{1}{2}{\Autograine}% + \ifnum\Autograine=1\relax% + \ifnum#3=\useKV[Automatismes]{ValeurMin}\relax% + \xdef#4{\fpeval{randint(#3+1,#2)}}% + \else% + \xdef#4{\fpeval{randint(#1,#3-1)}}% + \fi% + \else% + \ifnum#3=\useKV[Automatismes]{ValeurMax}\relax% + \xdef#4{\fpeval{randint(#1,#3-1)}}% + \else% + \xdef#4{\fpeval{randint(#3+1,#2)}}% + \fi% + \fi% +}% + +\NewDocumentCommand\ChoixAleaMix{mmmm}{% + \xintifboolexpr{#1==0 || #1==#3}{% + \xdef\PfCListeNombreMix{\fpeval{#1+1}}% + \xdef\PfCAutoDebutCompte{2}% + }{% + \xdef\PfCListeNombreMix{#1}% + \xdef\PfCAutoDebutCompte{1}% + }% + \xintFor* ##1 in{\xintSeq{\PfCAutoDebutCompte}{\fpeval{#2-#1}}}\do{% + \xintifboolexpr{\fpeval{#1+##1}==0 || \fpeval{#1+##1}==#3}{}{% + \xdef\PfCListeNombreMix{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreMix}{1}% + \xdef#4{\faa}% +}% + +\newcounter{PfCAutoNbcpt}% + +\NewDocumentCommand\ChoixNombreUn{om}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Fractions}{% + \xdef\PfCAutoNumUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutoNumUn}{\PfCAutomatismesPremierTerme}% + }{% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + }% +}% + +\NewDocumentCommand\ChoixNombreDeux{om}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Fractions}{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{+}{% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}% + \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}% + }{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}% + \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}% + }{% + \xdef\PfCAutoNumDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{0}{\PfCAutomatismesDeuxiemeTerme}% + }% + }% + }{% + \ifboolKV[Automatismes]{Relatifs}{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}% + }{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + }% + }{% + % Entiers + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{% + \xdef\PfCAutoRetiensDif{\fpeval{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]-\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}}% + \ifnum\PfCAutoRetiensDif<0\relax% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \xdef\PfCAutoNombreDeux{\fpeval{\PfCAutoNombreUn+\PfCAutoRetiensDif}}% + \else% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \fi + }{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}% + }{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + }% + }% + }% + }% +}% + +\NewDocumentCommand\SoustractionPositive{omm}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Relatifs}{% + \PfCNum{#2}-\PfCNum{#3}% + }{% + \ifnum#2>#3\relax% + \num{#2}-\num{#3}% + \else% + \num{#3}-\num{#2}% + \fi% + }% +}% + +\setKVdefault[Automatismes]{Questions=10,ValeurMin=1,ValeurMax=15,Entiers,Relatifs=false,Fractions=false,Stretch=1.5,Graines=false,Priorites=false}% +\defKV[Automatismes]{Graine=\setKV[Automatismes]{Graines}}% + +\newcommand\PfCTabstrut{\rule{0pt}{2.4ex}}% Top strut + +\NewDocumentCommand\Automatismes{o m}{% + \setcounter{PfCAutoNbcpt}{0}% + \useKVdefault[Automatismes]% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Graines}{\PfCGraineAlea{\useKV[Automatismes]{Graine}}}{}% + \xdef\PfCAutomatismesEtages{\fpeval{\useKV[Automatismes]{Questions}}}% + % On définit deux listes de nombres + \xdef\PfCListeNombreUn{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreUn{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreUn}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeUn{\faa}% + %%% la deuxième + \xdef\PfCListeNombreDeux{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreDeux{\PfCListeNombreDeux,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreDeux}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeDeux{\faa}% + \setcounter{PfCAutoNbcpt}{0}% + \renewcommand{\arraystretch}{\useKV[Automatismes]{Stretch}}% + \ifboolKV[Automatismes]{Priorites}{% + %On définit une troisième liste + \xdef\PfCListeNombreTrois{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreTrois{\PfCListeNombreTrois,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreTrois}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeTrois{\faa}% +% La liste un est \showitems\PfCListeNombreMelangeUn\\ +% La liste deux est \showitems\PfCListeNombreMelangeDeux\\ +% La liste trois est \showitems\PfCListeNombreMelangeTrois\\ + \begin{NiceTabular}{|ccc|}[hlines]% + \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{% + % On mélange les opérations + \MelangeListe{+,-}{1}% + \xdef\PfCAutoFoo{\faa ,*}% + \MelangeListe{\PfCAutoFoo}{2}% + \ignoreemptyitems% + \readlist*\PfCAutomatismesListeOperations{\faa}% + \reademptyitems% + % Il faut positiver les soustractions pour les 6eme + \ChoixAlea{1}{2}{\PfCChoixParen}% + \ensuremath{% + \IfStrEq{\PfCAutomatismesListeOperations[1]}{*}{% + \xintifboolexpr{\PfCChoixParen==1}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\left(% + \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeDeux[##1]}{\PfCListeNombreMelangeTrois[##1]}}{\PfCNum{\PfCListeNombreMelangeDeux[##1]}+\PfCNum{\PfCListeNombreMelangeTrois[##1]}}% + \right)% + }{% + \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{% + \ifboolKV[Automatismes]{Relatifs}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{\xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]*\PfCListeNombreMelangeDeux[##1]\PfCAutomatismesListeOperations[2]\PfCListeNombreMelangeTrois[##1]}>0}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{\num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}% + }% + } + }{% + \num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}% + % }% + }% + }% + }% + {% + \xintifboolexpr{\PfCChoixParen==1}{% + \left(\IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeUn[##1]}{\PfCListeNombreMelangeDeux[##1]}}{\PfCNum{\PfCListeNombreMelangeUn[##1]}+\PfCNum{\PfCListeNombreMelangeDeux[##1]}}\right)\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{% + \ifboolKV[Automatismes]{Relatifs}{% + \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}% + }{% + \xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]\PfCAutomatismesListeOperations[1]\PfCListeNombreMelangeDeux[##1]*\PfCListeNombreMelangeTrois[##1]}>0}{% + \num{\PfCListeNombreMelangeUn[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}}{% + \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}}% + }% + }% + }% + }% + &=&\pointilles[1cm]\\ + }% + \end{NiceTabular}% + }{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCAutomatismesListeOperations{#2}% + \reademptyitems% + \begin{NiceTabular}{|ccccc|}[hlines] + \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{% + \stepcounter{PfCAutoNbcpt}% + \xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{% + \ChoixNombreUn[#1]{1}\ChoixNombreDeux[#1]{1}% + }{% + \ChoixNombreUn[#1]{##1}\ChoixNombreDeux[#1]{##1}% + }% + \Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumUn}}{\PfCBstrut\num{\PfCAutomatismesPremierTerme}}$}{\num{\PfCAutoNombreUn}}}% + &\xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{% + \StrSubstitute{\PfCAutomatismesListeOperations[1]}{*}{\times}[\PfCCBAffiche]% + }{% + \StrSubstitute{\PfCAutomatismesListeOperations[##1]}{*}{\times}[\PfCCBAffiche]% + }% + \StrSubstitute{\PfCCBAffiche}{/}{\div}[\PfCCBAffiche]% + $\PfCCBAffiche$% + &\Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumDeux}}{\PfCBstrut\num{\PfCAutomatismesDeuxiemeTerme}}$}{\PfCNum{\PfCAutoNombreDeux}}}% + &=&\pointilles[1cm]\\ + }% + \end{NiceTabular}% + }% +}%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex index 9156779cd73..fdfa7cd0a57 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex @@ -1,17 +1,17 @@ %%% % Cartographie %%% -\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2022/texmf-dist/metapost/profcollege/datastest/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2} +\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2023/texmf-dist/metapost/profcollege/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2} \defKV[Cartographie]{EchelleCarte=\setKV[Cartographie]{Carte}} \defKV[Cartographie]{Pays=\setKV[Cartographie]{PaysSeul}} \defKV[Cartographie]{Villes=\setKV[Cartographie]{VillesSup}} \newcommand\Cartographie[3][]{% - \ifluatex - \useKVdefault[Cartographie] - \setKV[Cartographie]{#1} + \ifluatex% + \useKVdefault[Cartographie]% + \setKV[Cartographie]{#1}% + \mplibforcehmode% \ifboolKV[Cartographie]{Projection}{% - \mplibforcehmode \begin{mplibcode} input PfCMonde; string arborescence; @@ -131,7 +131,7 @@ fi; \end{mplibcode} }{% - \mplibforcehmode +% \mplibforcehmode \begin{mplibcode} input PfCMonde; string arborescence; @@ -169,7 +169,7 @@ phi:=#3; zoom(echelle(#2,#3,\useKV[Cartographie]{EchelleCarte})); fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond; - lecturep(arborescence&\useKV[Cartographie]{Pays}&".dat",couleurfond);% + lecturep(arborescence&"PfC"&\useKV[Cartographie]{Pays}&".dat",couleurfond);% trace feuillet withpen pencircle scaled 2; if Echelle=true: draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1)); @@ -201,6 +201,7 @@ closefrom nomfichiermul; fi; else: + draw(0,0)--(50,50); mappemonde(#2,#3); fi; \end{mplibcode} diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex b/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex index e330d761aaa..c832caf8923 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex @@ -23,5 +23,5 @@ \xintifboolexpr{\PfCListeSymboleDobblelen==\PfCDobbleTotalSymboles}{% \dobble{\PfCDobbleNiveau}% }{% - Pour un dooble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}% + Pour un dobble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex b/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex new file mode 100644 index 00000000000..a7d4622f5f3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex @@ -0,0 +1,148 @@ +%%% +% QCM +%%% +\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=R\'eponse,NomV=Vrai,NomF=Faux,Alph=false,AlphT=false,VF=false,Depart=1,Alterne=false,Noms={A/B/C},Multiple=false,Parties={Yeux,Nez,Bouche}}% +\newlength{\LargeurQCM}% +\newlength{\PfCLargeurQCM}% +\newcounter{QuestionQCM}% +\newcounter{TitreQCM}% +\ifdef{\QCM}{% + \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}% + \newcommand\QCMPfC[2][]{% + \useKVdefault[ClesQCM]% + \setKV[ClesQCM]{#1}% + \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% + \setcounter{TitreQCM}{0} + \setsepchar[*]{§*&}\ignoreemptyitems% + \readlist*\ListeQCM{#2}% + \ifboolKV[ClesQCM]{Multiple}{% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% + \setsepchar[*]{/}% + \readlist*\ListeNomsMul{\ListeNom}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \cline{2-\NBcases}% + \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ListeNomsMul[##2]}% + \\ + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}% + }\\ + }% + \hline% + \end{tabular}% + }{% + \ifboolKV[ClesQCM]{VF}{% + \setKV[ClesQCM]{Reponses=2}% + \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% + \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \cline{2-\NBcases}% + \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\ + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}% + }\\ + }% + \hline% + \end{tabular} + }{% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% + \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}% + \\ + }{} + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]% + }\\ + }% + \hline% + \end{tabular}% + }% + }% + \renewcommand{\arraystretch}{1}% + }% +}{% + \NewDocumentCommand\QCM{om}{% + \useKVdefault[ClesQCM]% + \setKV[ClesQCM]{#1}% + \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% + \setcounter{TitreQCM}{0} + \setsepchar[*]{,*&}\ignoreemptyitems% + \readlist*\ListeQCM{#2}% + \ifboolKV[ClesQCM]{Multiple}{% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% + \setsepchar[*]{/}% + \readlist*\ListeNomsMul{\ListeNom}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \cline{2-\NBcases}% + \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ListeNomsMul[##2]}% + \\ + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}% + }\\ + }% + \hline% + \end{tabular}% + \renewcommand{\arraystretch}{1}% + }{% + \ifboolKV[ClesQCM]{VF}{% + \setKV[ClesQCM]{Reponses=2}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% + \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \cline{2-\NBcases}% + \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\ + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}% + }\\ + }% + \hline% + \end{tabular} + }{% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% + \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% + \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}% + \\ + }{} + \hline% + \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% + \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% + &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]% + }\\ + }% + \hline% + \end{tabular}% + }% + }% + \renewcommand{\arraystretch}{1}% + }% +}%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex b/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex index bd0cb572044..62337537958 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex @@ -6,6 +6,7 @@ \newlength{\PfCLargeurQCM}% \newcounter{QuestionQCM}% \newcounter{TitreQCM}% +% \ifdef{\QCM}{% \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}% \newcommand\QCMPfC[2][]{% @@ -13,12 +14,12 @@ \setKV[ClesQCM]{#1}% \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% \setcounter{TitreQCM}{0} - \setsepchar[*]{§*&}\ignoreemptyitems% + \setsepchar[*]{,*&}\ignoreemptyitems% \readlist*\ListeQCM{#2}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \ifboolKV[ClesQCM]{Multiple}{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% \setsepchar[*]{/}% \readlist*\ListeNomsMul{\ListeNom}% @@ -35,13 +36,13 @@ }% \hline% \end{tabular}% + \renewcommand{\arraystretch}{1}% }{% \ifboolKV[ClesQCM]{VF}{% \setKV[ClesQCM]{Reponses=2}% +% \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% \cline{2-\NBcases}% @@ -55,9 +56,9 @@ \hline% \end{tabular} }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + %\renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + %\xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% @@ -75,7 +76,7 @@ }% }% \renewcommand{\arraystretch}{1}% - }% + } }{% \newcommand\QCM[2][]{% \useKVdefault[ClesQCM]% @@ -84,10 +85,10 @@ \setcounter{TitreQCM}{0} \setsepchar[*]{,*&}\ignoreemptyitems% \readlist*\ListeQCM{#2}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \ifboolKV[ClesQCM]{Multiple}{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% \setsepchar[*]{/}% \readlist*\ListeNomsMul{\ListeNom}% @@ -108,7 +109,7 @@ }{% \ifboolKV[ClesQCM]{VF}{% \setKV[ClesQCM]{Reponses=2}% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% +% \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% @@ -124,9 +125,9 @@ \hline% \end{tabular} }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + %\renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% + %\xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex b/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex index d532e10b2f3..c4b19598fb1 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex @@ -191,9 +191,9 @@ }% }% -\NewDocumentCommand\Lg{o m}{% +\NewDocumentCommand\Lg{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{nm}{% \DeclareSIUnit{\Tempo}{\nano\meter}% }{% @@ -226,18 +226,27 @@ }% }% }% - }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }% }% -\NewDocumentCommand\Masse{o m}{% +\NewDocumentCommand\Masse{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{ng}{% \DeclareSIUnit{\Tempo}{\nano\gram}% }{\ifboolKV[Unites]{ug}{% @@ -271,17 +280,26 @@ }% }% }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% + }{% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% }{% \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% \pointilles[\PfCLgUnites]\,\si{\Tempo}% }% + } }% -\NewDocumentCommand\Capa{o m}{% +\NewDocumentCommand\Capa{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{kL}{% \DeclareSIUnit{\Tempo}{\kilo\liter}% }{\ifboolKV[Unites]{hL}{% @@ -302,17 +320,26 @@ }% }% }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% + }{% \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \SI{#3}{\Tempo}% }{% \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% \pointilles[\PfCLgUnites]\,\si{\Tempo}% }% + }% }% -\NewDocumentCommand\Aire{o m}{% +\NewDocumentCommand\Aire{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{ha}{% \DeclareSIUnit{\Tempo}{\hectare}% }{% @@ -354,17 +381,26 @@ }% }% }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }% }% -\NewDocumentCommand\Vol{o m}{% +\NewDocumentCommand\Vol{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{nm}{% \DeclareSIUnit{\Tempo}{\nano\meter}% }{% @@ -397,12 +433,21 @@ }% }% }% - }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\cubic\Tempo}% + }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\cubic\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\cubic\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + }% }% }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex b/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex index 3c29cfcae34..b9ff48e1765 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex @@ -1,7 +1,7 @@ %%% % Fonction Affine %%% -\setKVdefault[ClesAffine]{Nom=f,Variable=x,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false%: inutile ? +\setKVdefault[ClesAffine]{Nom=f,Variable=x,CoefDir=a,OrdoOrig=b,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false%: inutile ? \newcommand\FonctionAffine[5][]{% % #1 nombre ou abscisse premier point @@ -58,20 +58,20 @@ }% }{% \ifboolKV[ClesAffine]{Retrouve}{% - On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=a\useKV[ClesAffine]{Variable}+b\] + On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\useKV[ClesAffine]{CoefDir}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}\] Or, $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$ et $\useKV[ClesAffine]{Nom}(\num{#4})=\num{#5}$. Par cons\'equent, d'apr\`es la propri\'et\'e des accroissements : \begin{align*} - a&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\ - a&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\ - a&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\ - \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\a&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}% + \useKV[ClesAffine]{CoefDir}&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\ + \useKV[ClesAffine]{CoefDir}&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\ + \useKV[ClesAffine]{CoefDir}&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\ + \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\\useKV[ClesAffine]{CoefDir}&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}% \end{align*} - La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+b$. + La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}$. \\De plus, comme $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$, alors : \begin{align*} - \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+b&=\num{#3}\\ - \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+b&=\num{#3}\\ - b&=\num{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} + \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\ + \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\ + \useKV[ClesAffine]{OrdoOrig}&=\num{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} \end{align*} \xdef\OrdOrigine{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} La fonction affine $\useKV[ClesAffine]{Nom}$ cherch\'ee est : diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex b/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex index f9530be658b..a36720d06a8 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex @@ -39,7 +39,8 @@ \Rangement[Seul]{\faa}% \PfCListeRgtRecup \setsepchar{,}% % Liste des nombres - \readlist*\ListeDesNombres{\PfCListeRgtRecup} + % \readlist*\ListeDesNombres{\PfCListeRgtRecup} + \readlist*\ListeDesNombres{\PfCRetiensRangement} }{% \setsepchar{,}% % Liste des nombres diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex b/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex index 48ac74aef3c..da5dfc85e7f 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex @@ -1,10 +1,18 @@ %%% % Mentalo %%% -\NewDocumentCommand\PfCNum{m}{% +\NewDocumentCommand\PfCNumold{m}{% \xintifboolexpr{#1<0}{(\num{#1})}{\num{#1}}% }% +\NewDocumentCommand\PfCNum{m}{% + \ifnum#1<0\relax% + (\num{#1})% + \else% + \num{#1}% + \fi% +}% + \setKVdefault[Mentalo]{Questions=10,ValeurMin=1,ValeurMax=15} \NewDocumentCommand\Mentalo{o m}{% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex b/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex index 8c72ca696e4..1493a2fcd8e 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex @@ -104,7 +104,7 @@ if unknown Sequence[cptnblignes][k]: else: nbpas:=nbpas+1; - label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*5mm-2.5mm,u*(-cptnblignes+0.5))); + label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*0.5*u-0.25*u,u*(-cptnblignes+0.5))); fi; endfor; endfor; @@ -130,7 +130,7 @@ if unknown SequenceCol[cptnbcolonnes][k]: else: nbpas:=nbpas+1; - label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*5mm+2.5mm)); + label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*0.5*u+0.25*u)); fi; endfor; endfor; diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex b/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex index 65ec863b111..bb21fbb6ae7 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex @@ -1,7 +1,7 @@ %%% % Fonction %%% -\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false} +\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Splines=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false} \defKV[ClesFonction]{Traces=\setKV[ClesFonction]{Codes}}% \newtoks\toklistePtsFn%pour la discipline @@ -38,6 +38,80 @@ \toklistePtsFn{}% \setsepchar[*]{§*/}%\ignoreemptyitems% \readlist*\ListePoints{#2}% + \ifboolKV[ClesFonction]{Splines}{% + \xdef\PfCFooListePoints{}% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),(\ListePoints[\compteurcnt,1],\ListePoints[\compteurcnt,4]),}% + }% + \MPSpline{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}% + }{% + \ifboolKV[ClesFonction]{Catmull}{% + \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% + }% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\ListePointslen,2],\ListePoints[\ListePointslen,3]),}% + \MPCatmull{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}% + }{% + \xdef\PfCFooListePoints{} + \ifboolKV[ClesFonction]{Tangentes}{% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints \ListePoints[\compteurcnt,1],(\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),\ListePoints[\compteurcnt,4],}% + }% + }{% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% + }% + }% + \MPCourbeNew{\PfCFooListePoints}% + }% + }% + }{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\ListeFonction{#2}% + \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% + \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% + \StrSubstitute{\tempa}{*}{}[\tempab]% + \ifboolKV[ClesFonction]{Ecriture}{% + \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}% + }{}% + \ifboolKV[ClesFonction]{Definition}{% + \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}% + }{}% + \ifboolKV[ClesFonction]{Tableau}{% + \buildtabfonction% + }{}% + \reademptyitems% + }% + }% +}% + +\NewDocumentCommand\Fonctionold{o m}{% + \useKVdefault[ClesFonction]% + \setKV[ClesFonction]{#1}% + \ifboolKV[ClesFonction]{Trace}{% + \useKVdefault[TraceG]% + \setKV[TraceG]{#1}% + \tokPfCListeDesFonctions{}% + \tokPfCListeDesNomsFonctions{}% + \xdef\PfCFooFn{\useKV[ClesFonction]{Calcul}} + \xdef\PfCFooNomFn{\useKV[TraceG]{NomCourbe}} + \ifx\bla\PfCFooFn\bla% + \else + \readlist*\ListeDesFonctions{\PfCFooFn} + \foreachitem\compteur\in\ListeDesFonctions{\expandafter\UpdatePfCListeDesFonctions\compteur\nil}% + \fi + \ifx\bla\PfCFooNomFn\bla + \else + \readlist*\ListeDesNomsFonctions{\PfCFooNomFn} + \foreachitem\compteur\in\ListeDesNomsFonctions{\expandafter\UpdatePfCListeDesNomsFonctions\compteur\nil}% + \fi + \TraceMultiGraphique{\the\tokPfCListeDesFonctions}{\the\tokPfCListeDesNomsFonctions}% + }{% + \ifboolKV[ClesFonction]{Points}{% + \toklistePtsFn{}% + \setsepchar[*]{§*/}%\ignoreemptyitems% + \readlist*\ListePoints{#2}% \ifboolKV[ClesFonction]{Catmull}{% \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}% \foreachitem\compteur\in\ListePoints{% @@ -60,7 +134,7 @@ }% }{% \setsepchar{,}\ignoreemptyitems% - \readlist*\ListeFonction{#2}% + \roeadlist*\ListeFonction{#2}% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% \StrSubstitute{\tempa}{*}{}[\tempab]% @@ -78,6 +152,274 @@ }% }% +\def\MPSplineCode{% + boolean PointsCourbe,Code,Prolonge; + PointsCourbe=\useKV[ClesFonction]{PointsCourbe}; + Code=\useKV[ClesFonction]{Codes}; + Prolonge:=\useKV[ClesFonction]{Prolonge}; + color CoulTrace; + CoulTrace:=\useKV[ClesFonction]{CouleurTrace}; + Epaisseur:=\useKV[ClesFonction]{Epaisseur}; + % + vardef EffectuerTraces= + \useKV[ClesFonction]{Traces}; + enddef; +% + def enplace= + xscaled X.u yscaled Y.u + enddef; + % + vardef placepoint(expr q,r)= + (q,r)*cm enplace + enddef; + % + nbspline=0; + % + nbpoints=50; + % + vardef SplineCubique(expr xzero,yzero,xuno,yuno,dzero,duno)= + nbspline:=nbspline+1; + a[nbspline]*(xzero**3)+b[nbspline]*(xzero**2)+c[nbspline]*xzero+d[nbspline]=yzero; + a[nbspline]*(xuno**3)+b[nbspline]*(xuno**2)+c[nbspline]*xuno+d[nbspline]=yuno; + a[nbspline]*(3*(xzero**2))+b[nbspline]*(2*xzero)+c[nbspline]=dzero; + a[nbspline]*(3*(xuno**2))+b[nbspline]*(2*xuno)+c[nbspline]=duno; + % + numeric xx[],yy[]; + for k=1 upto nbpoints-1: + xx[k]=xzero+(k/nbpoints)*(xuno-xzero); + yy[k]=a[nbspline]*(xx[k]**3)+b[nbspline]*(xx[k]**2)+c[nbspline]*xx[k]+d[nbspline]; + endfor; + save $; + picture $; + $=image( + draw placepoint(xzero,yzero) for k=1 upto nbpoints-1: + --placepoint(xx[k],yy[k]) + endfor --placepoint(xuno,yuno); + ); + $ + enddef; +} + +\def\MPSpline#1#2#3#4#5{% + % #1 la liste des points + % #2: pas en x + % #3: pas en y + % #4: unit\'e en x + % #5: unit\'e en y + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPSplineCode; + + x.u:=#2; + y.u:=#3; + X.u:=#4; + Y.u:=#5; + + pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d + n=0; + for p_=#1: + n:=n+1; + if (n mod 2)=1: + Xn[(n div 2)+1]=p_; + Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_)); + else: + Dn[(n div 2)]=p_ + fi; + endfor; + N:=n div 2; + MinX=999; + MaxX=-999; + MinY=999; + MaxY=-999; + if Prolonge: + debutbalai=2; + finbalai=N-1; + else: + debutbalai=1; + finbalai=N; + fi; + for k=debutbalai upto finbalai: + if xpart(Xn[k])<MinX: + MinX:=xpart(Xn[k]); + fi; + if xpart(Xn[k])>MaxX: + MaxX:=xpart(Xn[k]); + fi; + if ypart(Xn[k])<MinY: + MinY:=ypart(Xn[k]); + fi; + if ypart(Xn[k])>MaxY: + MaxY:=ypart(Xn[k]); + fi; + endfor; + if MaxY<1: + MaxY:=2; + fi; + if MinY>-1: + MinY:=-2; + fi; + if MinY<0: + if MinY<>ceiling(MinY): + MinY:=ceiling(MinY)-1; + fi; + fi; + if MinX<0: + if MinX<>ceiling(MinX): + MinX:=ceiling(MinX)-1; + fi; + fi; + if MaxY<>ceiling(MaxY): + MaxY:=ceiling(MaxY); + fi; + if MaxX<>ceiling(MaxX): + MaxX:=ceiling(MaxX); + fi; + if MaxX<1: + MaxX:=1; + fi; + if MaxY<1: + MaxY:=1; + fi; + % + path cadreexterieur; + cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle); + for l=1 upto N-1: + draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace; + endfor; + clip currentpicture to cadreexterieur; + picture RetiensCourbe; + RetiensCourbe=currentpicture; + currentpicture:=nullpicture; + for k=MinY-1 step y.u until MaxY+1: + draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white; + endfor; + for k=MinX-1 step x.u until MaxX+1: + draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white; + endfor; + if PointsCourbe: + for k=debutbalai upto finbalai: + fill cercles(Fn[k],0.5mm); + endfor; + fi; + drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm); + drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0); + % + draw RetiensCourbe; + label.llft(btex O etex,(0,0)); + dotlabel.bot(btex 1 etex,cm*X.u*(1,0)); + dotlabel.lft(btex 1 etex,cm*Y.u*(0,1)); + if Code: + EffectuerTraces; + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPSplineCode;}] + x.u:=#2; + y.u:=#3; + X.u:=#4; + Y.u:=#5; + + pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d + n=0; + for p_=#1: + n:=n+1; + if (n mod 2)=1: + Xn[(n div 2)+1]=p_; + Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_)); + else: + Dn[(n div 2)]=p_ + fi; + endfor; + N:=n div 2; + MinX=999; + MaxX=-999; + MinY=999; + MaxY=-999; + if Prolonge: + debutbalai=2; + finbalai=N-1; + else: + debutbalai=1; + finbalai=N; + fi; + for k=debutbalai upto finbalai: + if xpart(Xn[k])<MinX: + MinX:=xpart(Xn[k]); + fi; + if xpart(Xn[k])>MaxX: + MaxX:=xpart(Xn[k]); + fi; + if ypart(Xn[k])<MinY: + MinY:=ypart(Xn[k]); + fi; + if ypart(Xn[k])>MaxY: + MaxY:=ypart(Xn[k]); + fi; + endfor; + if MaxY<1: + MaxY:=2; + fi; + if MinY>-1: + MinY:=-2; + fi; + if MinY<0: + if MinY<>ceiling(MinY): + MinY:=ceiling(MinY)-1; + fi; + fi; + if MinX<0: + if MinX<>ceiling(MinX): + MinX:=ceiling(MinX)-1; + fi; + fi; + if MaxY<>ceiling(MaxY): + MaxY:=ceiling(MaxY); + fi; + if MaxX<>ceiling(MaxX): + MaxX:=ceiling(MaxX); + fi; + if MaxX<1: + MaxX:=1; + fi; + if MaxY<1: + MaxY:=1; + fi; + % + path cadreexterieur; + cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle); + for l=1 upto N-1: + draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace; + endfor; + clip currentpicture to cadreexterieur; + picture RetiensCourbe; + RetiensCourbe=currentpicture; + currentpicture:=nullpicture; + for k=MinY-1 step y.u until MaxY+1: + draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white; + endfor; + for k=MinX-1 step x.u until MaxX+1: + draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white; + endfor; + if PointsCourbe: + for k=debutbalai upto finbalai: + fill cercles(Fn[k],0.5mm); + endfor; + fi; + drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm); + drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0); + % + draw RetiensCourbe; + label.llft(btex O etex,(0,0)); + dotlabel.bot(btex 1 etex,cm*X.u*(1,0)); + dotlabel.lft(btex 1 etex,cm*Y.u*(0,1)); + if Code: + EffectuerTraces; + fi; + \end{mpost} + \fi +} + \def\PfCTraceMGCode{% nbcourbe=\ListeDesFonctionslen; % diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex b/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex new file mode 100644 index 00000000000..309d5aaa9f7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex @@ -0,0 +1,399 @@ +%%% +% Number Hive +%%% +\setKVdefault[NumberHive]{Negatif=false,Produit=false,Niveau=8,Double=false,ListeCouleurs={Cornsilk,LightSteelBlue},CouleurCase=false,Jeton=false,Graines=false,Aide=false,UniteHexa=6mm}% +\defKV[NumberHive]{Cases=\setKV[NumberHive]{CouleurCase}}% +\defKV[NumberHive]{Jetons=\setKV[NumberHive]{Jeton}}% +\defKV[NumberHive]{Graine=\setKV[NumberHive]{Graines}}% + +\newtoks\toklistenumberhive% +\newtoks\toklistecasescoloreesNH% + +\def\UpdatetoksNHive#1\nil{\addtotok\toklistenumberhive{"#1",}}% +\def\UpdatetoksCCNHive#1\nil{\addtotok\toklistecasescoloreesNH{#1,}}% + +\NewDocumentCommand\NumberHive{o}{% + \useKVdefault[NumberHive]% + \setKV[NumberHive]{#1}% + \toklistenumberhive{}% + \toklistecasescoloreesNH{}% + \ifboolKV[NumberHive]{CouleurCase}{% + \xdef\PfCFooNH{\useKV[NumberHive]{Cases}}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\ListeCasesColoreesNH{\PfCFooNH}% + \reademptyitems% + \foreachitem\compteur\in\ListeCasesColoreesNH{\expandafter\UpdatetoksCCNHive\compteur\nil}% + }{}% + \xdef\ListeAvantCouleurs{\useKV[NumberHive]{ListeCouleurs}}% + \ifboolKV[NumberHive]{Graines}{\PfCGraineAlea{\useKV[NumberHive]{Graine}}}{}% + \ifboolKV[NumberHive]{Produit}{% + \xdef\PfCNHListe{1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,15,21,27,30,33,36,28,32,40,44,48,25,35,45,50,55,60,42,54,66,72,56,63,70,77,84,64,72,80,88,96,81,90,99,108,100,110,120,121,132,144}% + \ifboolKV[NumberHive]{Double}{% + \MelangeListe{\PfCNHListe}{59}% + }{% + \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}% + \MelangeListe{\PfCNHListe}{46}% + }% + }{% + \ifboolKV[NumberHive]{Negatif}{% + \xdef\PfCNHListe{-12,-11,-10,-9,-8,-7,-5,-4,-3,-2,-1,0,1,2,3,4,5,7,8,9,10,11,12}% + }{% + \xdef\PfCNHListe{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}% + }% + \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}% + \MelangeListe{\PfCNHListe}{46}% + }% + \setsepchar{,}% + \readlist*\ListeCompoNH{\faa}% + \foreachitem\compteur\in\ListeCompoNH{\expandafter\UpdatetoksNHive\compteur\nil}% + \begin{tikzpicture} + \node[xshift=1cm,yshift=-1cm,rotate=45] at (0,0) {\includegraphics[scale=0.1]{LogoNumberHive.png}}; + \node[anchor=north west] at (0,0) {\BuildNumberHiveAdditif{\the\toklistenumberhive}{\useKV[NumberHive]{Niveau}}{\useKV[NumberHive]{Jetons}}{\ListeAvantCouleurs}{\the\toklistecasescoloreesNH}}; + \end{tikzpicture} +}% + +\NewDocumentCommand\BuildNumberHiveAdditif{mmmmm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide; + Double=\useKV[NumberHive]{Double}; + Produit=\useKV[NumberHive]{Produit}; + Negatif=\useKV[NumberHive]{Negatif}; + CouleurCase=\useKV[NumberHive]{CouleurCase}; + Jeton=\useKV[NumberHive]{Jeton}; + Aide=\useKV[NumberHive]{Aide}; + UniteHexa=\useKV[NumberHive]{UniteHexa}; + + numeric JetonNegatif[]; + JetonNegatif[1]=-6; + JetonNegatif[2]=-5; + JetonNegatif[3]=-4; + JetonNegatif[4]=-3; + JetonNegatif[5]=-2; + JetonNegatif[6]=-1; + JetonNegatif[7]=1; + JetonNegatif[8]=2; + JetonNegatif[9]=3; + JetonNegatif[10]=4; + JetonNegatif[11]=5; + JetonNegatif[12]=6; + + color C[]; + nb=0; + + vardef RecupCouleurs(text t)= + for p_=t: + nb:=nb+1; + C[nb]=p_; + endfor; + enddef; + + RecupCouleurs(#4); + + pair bu,bv; + bu=(1,0); + bv=(0,1); + vardef unithexa= + (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle + enddef; + + pair A[]; + numeric numcase; + + vardef PlacerAncres= + numcase:=0; + if Double: + for n=5 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %dernières lignes + for n=#2+2 upto #2+5: + for k=(n-#2) upto #2+1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + %% + else: + for n=3 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %ligne n + for k=1 upto #2-2: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30))); + endfor; + fi; + NbTotalCases=numcase; + enddef; + + vardef PlacerCasesColorees(text t)= + rang:=0; + for p_=t: + rang:=rang+1; + fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi; + endfor; + enddef; + + vardef TracerHexagones= + for k=1 upto NbTotalCases: + trace (unithexa scaled UniteHexa) shifted A[k]; + if Aide: + label.top(TEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa)); + fi; + endfor; + enddef; + + vardef PlacerNombres(text t)= + nbcase:=0; + for p_=t: + if nbcase<numcase: + nbcase:=nbcase+1; + label(TEX("\num{"&p_&"}"),A[nbcase]); + fi; + endfor; + enddef; + + vardef PlaceJeton(expr ja,jb)= + drawoptions(withpen pencircle scaled 1.15); + trace cercles(BPlateau[ja],0.75*UniteHexa); + trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa); + drawoptions(); + enddef; + + pair BPlateau[]; + pair Decal; + + vardef Plateau= + picture PGauche; + PGauche=image( + NomCase:=0; + if Double: + Decalage:=10; + else: + Decalage:=5; + fi; + for l=0 upto 2: + for k=3 downto 0:% + NomCase:=NomCase+1; + Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+UniteHexa))); + BPlateau[NomCase]=(0,0) shifted Decal; + fill ((unithexa scaled UniteHexa) shifted Decal) withcolor 0.75white; + trace ((unithexa scaled UniteHexa)) shifted Decal; + if Negatif: + label(TEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal); + else: + label(TEX(decimal(NomCase)),(0,0) shifted Decal); + fi; + endfor; + endfor; + ); + draw PGauche; + draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0); + if Jeton: + PlaceJeton(#3); + fi; + if Produit: + label(TEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa)))); + else: + label(TEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa)))); + fi; + enddef; + + PlacerAncres; + if CouleurCase: + PlacerCasesColorees(#5); + fi; + TracerHexagones; + PlacerNombres(#1); + Plateau; + \end{mplibcode} + \else% + \begin{mpost}[mpsettings={boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide; + Double=\useKV[NumberHive]{Double}; + Produit=\useKV[NumberHive]{Produit}; + Negatif=\useKV[NumberHive]{Negatif}; + CouleurCase=\useKV[NumberHive]{CouleurCase}; + Jeton=\useKV[NumberHive]{Jeton}; + Aide=\useKV[NumberHive]{Aide}; + UniteHexa=\useKV[NumberHive]{UniteHexa}; + }] + numeric JetonNegatif[]; + JetonNegatif[1]=-6; + JetonNegatif[2]=-5; + JetonNegatif[3]=-4; + JetonNegatif[4]=-3; + JetonNegatif[5]=-2; + JetonNegatif[6]=-1; + JetonNegatif[7]=1; + JetonNegatif[8]=2; + JetonNegatif[9]=3; + JetonNegatif[10]=4; + JetonNegatif[11]=5; + JetonNegatif[12]=6; + + color C[]; + nb=0; + + vardef RecupCouleurs(text t)= + for p_=t: + nb:=nb+1; + C[nb]=p_; + endfor; + enddef; + + RecupCouleurs(#4); + + pair bu,bv; + bu=(1,0); + bv=(0,1); + vardef unithexa= + (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle + enddef; + + pair A[]; + numeric numcase; + + vardef PlacerAncres= + numcase:=0; + if Double: + for n=5 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %dernières lignes + for n=#2+2 upto #2+5: + for k=(n-#2) upto #2+1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + %% + else: + for n=3 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %ligne n + for k=1 upto #2-2: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30))); + endfor; + fi; + NbTotalCases=numcase; + enddef; + + vardef PlacerCasesColorees(text t)= + rang:=0; + for p_=t: + rang:=rang+1; + fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi; + endfor; + enddef; + + vardef TracerHexagones= + for k=1 upto NbTotalCases: + trace (unithexa scaled UniteHexa) shifted A[k]; + if Aide: + label.top(LATEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa)); + fi; + endfor; + enddef; + + vardef PlacerNombres(text t)= + nbcase:=0; + for p_=t: + if nbcase<numcase: + nbcase:=nbcase+1; + label(LATEX("\num{"&p_&"}"),A[nbcase]); + fi; + endfor; + enddef; + + vardef PlaceJeton(expr ja,jb)= + drawoptions(withpen pencircle scaled 1.15); + trace cercles(BPlateau[ja],0.75*UniteHexa); + trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa); + drawoptions(); + enddef; + + pair BPlateau[]; + pair Decal; + + vardef Plateau= + picture PGauche; + PGauche=image( + NomCase:=0; + if Double: + Decalage:=10; + else: + Decalage:=5; + fi; + for l=0 upto 2: + for k=3 downto 0:% + NomCase:=NomCase+1; + Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+4*3mm))); + BPlateau[NomCase]=(0,0) shifted Decal; + fill ((unithexa scaled UniteHexa) shifted Decal) withcolor 0.75white; + trace ((unithexa scaled UniteHexa)) shifted Decal; + if Negatif: + label(LATEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal); + else: + label(LATEX(decimal(NomCase)),(0,0) shifted Decal); + fi; + endfor; + endfor; + ); + draw PGauche; + draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0); + if Jeton: + PlaceJeton(#3); + fi; + if Produit: + label(LATEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm)))); + else: + label(LATEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm)))); + fi; + enddef; + + PlacerAncres; + if CouleurCase: + PlacerCasesColorees(#5); + fi; + TracerHexagones; + PlacerNombres(#1); + Plateau; + \end{mpost} + \fi +}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex index 245afb0593b..2d25df1b990 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex @@ -21,6 +21,8 @@ Basej={u*(0,0.5)}, Quadrilatere=false, Escher=false, + Einstein=false, + Vampire=false, Rayon=1, Epaisseur=1, Position=0.5, @@ -1189,9 +1191,137 @@ vardef pavagescar(expr chemin,tour,coul)= \fi% }% +\def\MPEinsteinHatCode{ + boolean After; + After:=\useKV[Pavage]{After}; + % + def TraceFill(expr o,coul)= + fill o withcolor coul; + trace o;% withpen pencircle scaled 2; + enddef; + % + def TraceHache(expr o,coul,ang)= + trace hachurage(o,ang,0.2,0) withcolor coul; + trace o;% withpen pencircle scaled 2; + enddef; + % + vardef EffectuerTraces= + \useKV[Pavage]{Traces} + enddef; + % + path Hat; + pair O[],A[],B[],C[],D[],E[],F[]; + Rayon=\useKV[Pavage]{Rayon}*u; + O1=u*(3,3); + O3=pointarc(cercles(O1,Rayon),300); + O2=rotation(O3,O1,-60); + O4=CentreCercleC(O1,O2,O3); + O5=symetrie(O1,iso(O2,O3)); + Rayonbis=abs(O1-CentreCercleC(O1,O2,O3)); + draw polygone(O1,O2,O3) withcolor 0.7white; + path cc[]; + cc1=cercles(O1,Rayonbis); + cc2=cercles(O2,Rayonbis); + cc3=cercles(O3,Rayonbis); + drawoptions(dashed evenly withcolor 0.7white); + trace cc1;trace cc2;trace cc3; + drawoptions(); + for k=1 upto 3: + A[k]=pointarc(cc[k],30+0); + B[k]=pointarc(cc[k],30+60); + C[k]=pointarc(cc[k],30+2*60); + D[k]=pointarc(cc[k],30+3*60); + E[k]=pointarc(cc[k],30+4*60); + F[k]=pointarc(cc[k],30+5*60); + endfor; + drawoptions(dashed evenly); + trace polygone(A1,B1,C1,D1,E1,F1); + trace polygone(A2,B2,C2,D2,E2,F2); + trace polygone(A3,B3,C3,D3,E3,F3); + drawoptions(); + Hat=polygone(O1,iso(C1,D1),D1,iso(D1,E1),O2,iso(E2,F2),F2,iso(D3,E3),O3,iso(F3,A3),A3,B3,iso(B3,C3)); + color Coul[]; + Coul1=Cyan;%; + Coul2=0.5[Blue,white]; + Coul3=Cornsilk; + Coul4=0.5[Crimson,white]; + Coul5=0.5[Purple,white]; + Coul6=LightGreen; + % + vardef TileGen(expr aHat,bHat,ech)= + pair H[]; + H0=iso(F2,E2); + H1-H0=Rayonbis*(aHat/ech)*unitvector(E2-F2); + H2-H1=Rayonbis*(aHat/ech)*unitvector(D2-E2); + H3-H2=Rayonbis*(bHat/ech)*unitvector(O2-iso(E2,D2)); + H4-H3=Rayonbis*(bHat/ech)*unitvector(iso(B2,C2)-O2); + H5-H4=Rayonbis*(aHat/ech)*unitvector(B2-C2); + H6-H5=Rayonbis*(aHat/ech)*unitvector(C1-D1); + H7-H6=Rayonbis*(bHat/ech)*unitvector(O1-iso(C1,D1)); + H8-H7=Rayonbis*(bHat/ech)*unitvector(iso(E1,F1)-O1); + H9-H8=Rayonbis*(aHat/ech)*unitvector(F2-E2); + H10-H9=Rayonbis*(aHat/ech)*unitvector(A3-B3); + H11-H10=Rayonbis*(bHat/ech)*unitvector(O3-iso(A3,B3)); + H12-H11=Rayonbis*(bHat/ech)*unitvector(iso(C3,D3)-O3); + H13-H12=Rayonbis*(aHat/ech)*unitvector(F2-A2); + H14=iso(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13); + save $; + path $; + $=polygone(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13); + $ + enddef; +% + vardef VampireGen(expr ech)= + pair Vp[]; + Vp0=iso(F2,E2); + Vp1-Vp0=Rayonbis*(1/ech)*unitvector(E2-F2); + Vp2-Vp1=Rayonbis*(1/ech)*unitvector(D2-E2); + Vp3-Vp2=Rayonbis*(1/ech)*unitvector(O2-iso(E2,D2)); + Vp4-Vp3=Rayonbis*(1/ech)*unitvector(iso(B2,C2)-O2); + Vp5-Vp4=Rayonbis*(1/ech)*unitvector(B2-C2); + Vp6-Vp5=Rayonbis*(1/ech)*unitvector(C1-D1); + Vp7-Vp6=Rayonbis*(1/ech)*unitvector(O1-iso(C1,D1)); + Vp8-Vp7=Rayonbis*(1/ech)*unitvector(iso(E1,F1)-O1); + Vp9-Vp8=Rayonbis*(1/ech)*unitvector(F2-E2); + Vp10-Vp9=Rayonbis*(1/ech)*unitvector(A3-B3); + Vp11-Vp10=Rayonbis*(1/ech)*unitvector(O3-iso(A3,B3)); + Vp12-Vp11=Rayonbis*(1/ech)*unitvector(iso(C3,D3)-O3); + Vp13-Vp12=Rayonbis*(1/ech)*unitvector(F2-A2); + Vp14=Vp0; + Vp15=iso(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13); + save $; + path $; + $=polygone(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13); + $ + enddef; +} + +\def\MPEinstein{%Pentoma : https://www.pentoma.de/the_hat/ + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPEinsteinHatCode + if After: + EffectuerTraces; + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPEinsteinHatCode} + if After: + EffectuerTraces; + fi; + \end{mpost} + \fi +}% + \NewDocumentCommand\Pavage{o}{% \useKVdefault[Pavage]% \setKV[Pavage]{#1}% + \ifboolKV[Pavage]{Einstein}{% + \ifboolKV[Pavage]{Vampire}{}{% + \MPEinstein% + }% + }{% \ifboolKV[Pavage]{Regulier}{% \MPRegulier% }{% @@ -1213,4 +1343,5 @@ vardef pavagescar(expr chemin,tour,coul)= }% }% }% + }% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex index b72e4d5a5de..4a7f3c6de3d 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex @@ -3,6 +3,8 @@ %%% \setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,CouleurTab=gray!15,Vertical=false,Simple=false}% +\tikzstyle{FlechePropor}=[-stealth] + \def\Updatetoksmath#1/#2\nil{\addtotok\tabtoksa{}\addtotok\tabtoksb{}}% \def\updatetokspropor#1/#2\nil{\addtotok\tabtoksa{&\num{#1}}\addtotok\tabtoksb{&\num{#2}}} \def\Buildtabpropor{% @@ -108,9 +110,9 @@ \newcommand\FlechesPH[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% + \draw[FlechePropor,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% \else% - \draw[-stealth,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% + \draw[FlechePropor,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% \fi% \end{tikzpicture}% }% @@ -118,11 +120,11 @@ \newcommand\FlechesPB[3]{% \ifnum\number#1<\number#2\relax% \begin{tikzpicture}[remember picture,overlay]% - \draw[-stealth,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% + \draw[FlechePropor,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% \end{tikzpicture}% \else% \begin{tikzpicture}[remember picture,overlay]% - \draw[-stealth,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% + \draw[FlechePropor,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% \end{tikzpicture}% \fi% }% @@ -130,9 +132,9 @@ \newcommand\FlechesPG[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);% + \draw[FlechePropor,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);% \else% - \draw[-stealth,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);% + \draw[FlechePropor,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);% \fi% \end{tikzpicture}% }% @@ -140,9 +142,9 @@ \newcommand\FlechesPD[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \else% - \draw[-stealth,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \fi% \end{tikzpicture}% }% @@ -167,7 +169,7 @@ \draw[out=-30,in=-150,gray] (aux3) to (aux4); }% \draw[gray] (aux2) -- (aux3); - \draw[-stealth,gray] (aux4) -- (aux1); + \draw[FlechePropor,gray] (aux4) -- (aux1); \end{tikzpicture}% }% @@ -191,7 +193,7 @@ \draw[out=30,in=150,gray] (aux1) to (aux2); }% \draw[gray] (aux4) -- (aux1); - \draw[-stealth,gray] (aux2) -- (aux3); + \draw[FlechePropor,gray] (aux2) -- (aux3); \end{tikzpicture}% }% @@ -215,7 +217,7 @@ \draw[out=-30,in=30,gray] (aux3) to (aux4); }% \draw[gray] (aux2) -- (aux3); - \draw[-stealth,gray] (aux4) -- (aux1); + \draw[FlechePropor,gray] (aux4) -- (aux1); \end{tikzpicture}% }% @@ -239,7 +241,7 @@ \draw[out=-150,in=150,gray] (aux1) to (aux2); }% \draw[gray] (aux4) -- (aux1); - \draw[-stealth,gray] (aux2) -- (aux3); + \draw[FlechePropor,gray] (aux2) -- (aux3); \end{tikzpicture}% }% @@ -248,9 +250,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporG-#1)!0.5!(ProporG-#2)$) {};% \node[circle,draw,inner sep=0pt] [left of=MilieuH] (aux) {#4} ;% \coordinate[left of=aux] (aux1);% - \draw[-stealth] (ProporG-#1) -| (aux);% - \draw[-stealth] (ProporG-#2) -| (aux);% - \draw[-stealth] (aux) -- (aux1) |- (ProporG-#3);% + \draw[FlechePropor] (ProporG-#1) -| (aux);% + \draw[FlechePropor] (ProporG-#2) -| (aux);% + \draw[FlechePropor] (aux) -- (aux1) |- (ProporG-#3);% \end{tikzpicture}% }% @@ -259,9 +261,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporD-#1)!0.5!(ProporD-#2)$) {};% \node[circle,draw,inner sep=0pt] [right of=MilieuH] (aux) {#4} ;% \coordinate[right of=aux] (aux1);% - \draw[-stealth] (ProporD-#1) -| (aux);% - \draw[-stealth] (ProporD-#2) -| (aux);% - \draw[-stealth] (aux) -- (aux1) |- (ProporD-#3);% + \draw[FlechePropor] (ProporD-#1) -| (aux);% + \draw[FlechePropor] (ProporD-#2) -| (aux);% + \draw[FlechePropor] (aux) -- (aux1) |- (ProporD-#3);% \end{tikzpicture}% }% @@ -285,7 +287,7 @@ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};% \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);% \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);% - \draw[-stealth,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);% + \draw[FlechePropor,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);% \end{tikzpicture}% }% @@ -295,7 +297,7 @@ \node[] (Noeud2) at ($(ProporHD)!0.9!(ProporBD)$) {};% \coordinate[left of=Noeud1,node distance=#1] (noeud1);% \coordinate[left of=Noeud2,node distance=#1] (noeud2);% - \draw[-stealth,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);% + \draw[FlechePropor,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);% \end{tikzpicture}% }% @@ -305,7 +307,7 @@ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};% \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);% \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);% - \draw[-stealth,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);% + \draw[FlechePropor,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);% \end{tikzpicture}% }% @@ -314,9 +316,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporH-#1)!0.5!(ProporH-#2)$) {};% \node[circle,draw,inner sep=0pt] [above of=MilieuH] (aux) {#4} ;% \coordinate[above of=aux] (aux1);% - \draw[-stealth] (ProporH-#1) |- (aux);% - \draw[-stealth] (ProporH-#2) |- (aux);% - \draw[-stealth] (aux) -- (aux1) -| (ProporH-#3);% + \draw[FlechePropor] (ProporH-#1) |- (aux);% + \draw[FlechePropor] (ProporH-#2) |- (aux);% + \draw[FlechePropor] (aux) -- (aux1) -| (ProporH-#3);% \end{tikzpicture}% }% @@ -325,8 +327,8 @@ \node[inner sep=0pt] (MilieuB) at ($(ProporB-#1)!0.5!(ProporB-#2)$) {};% \node[circle,draw,inner sep=0pt] [below of=MilieuB] (aux) {#4};% \coordinate[below of=aux,node distance=3mm] (aux1);% - \draw[-stealth] (ProporB-#1) |- (aux);% - \draw[-stealth] (ProporB-#2) |- (aux);% - \draw[-stealth] (aux) -- (aux1) -| (ProporB-#3);% + \draw[FlechePropor] (ProporB-#1) |- (aux);% + \draw[FlechePropor] (ProporB-#2) |- (aux);% + \draw[FlechePropor] (aux) -- (aux1) -| (ProporB-#3);% \end{tikzpicture}% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex index 6ec347c5dc7..3e17ac010ef 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex @@ -1,5 +1,3 @@ - - %%% % Pyramide de calculs %%% @@ -179,9 +177,10 @@ label(TEX(p_),B[Nbeb]); fi; endfor; + fi; \end{mplibcode} \else - \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide;Vide=\useKV[ClesPyramide]{Vide};boolean Inverse;Inverse=\useKV[ClesPyramide]{Inverse};color CaseCouleur; CaseCouleur:=\useKV[ClesPyramide]{Couleur};boolean Double;Double=\useKV[ClesPyramide]{Double}; color CouleurNombre;CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}] + \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide,Inverse,Double;Vide=\useKV[ClesPyramide]{Vide};Inverse=\useKV[ClesPyramide]{Inverse};Double=\useKV[ClesPyramide]{Double};color CaseCouleur;CouleurNombre; CaseCouleur:=\useKV[ClesPyramide]{Couleur};CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}] pair A[][],B[]; path Case[]; Nbeb:=0; @@ -205,7 +204,7 @@ endfor; endfor; else: - if \useKV[ClesPyramide]{Inverse}: + if Inverse: change:=-1; else: change=1; @@ -220,7 +219,7 @@ endfor; endfor; fi; - if \useKV[ClesPyramide]{Vide}: + if Vide: else: Nbeb:=0; for p_=#1: @@ -237,6 +236,7 @@ label(LATEX(p_),B[Nbeb]); fi; endfor; + fi; \end{mpost} \fi }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex index 5606728dd92..4af4528b81e 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex @@ -281,8 +281,8 @@ \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\ \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% - \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfInteger{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2-#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }{%\else @@ -295,7 +295,7 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }{% @@ -307,7 +307,7 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}% - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex b/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex index 436511bcf58..e248c044013 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex @@ -1,13 +1,130 @@ %%% % Rangement des nombres %%% -\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false} +\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false}% \dtlexpandnewvalue% \DTLgnewdb{mtnumedb}% \DTLgnewdb{mtRGTdb}% Pb de doublon avec mtdb de Mediane -\newcommand\Rangement[2][]{% +%\begin{document} + +\NewDocumentCommand\RangementListe{m}{% + \readlist*\ListeRgt{#1}% + \xdef\Foo{\ListeRgt[1]} + \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{% + \xdef\Foo{\Foo,\ListeRgt[##1]} + }% + \xdef\Fooa{\Foo}% + \xdef\PfCRetiensRangement{}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\ListeRgtlen-1}}}\do{% + \xdef\Element{\fpeval{min(\Fooa)}}% + \xintifboolexpr{##1>1}{% + \xdef\PfCRetiensRangement{\PfCRetiensRangement,\Element}% + }{% + \xdef\PfCRetiensRangement{\Element}% + }% + \readlist*\RetiensListe{\Fooa}% + % La liste des rangements vaut \RetiensRangement.\par + % La retiensliste vaut \showitems\RetiensListe[]\par + \xdef\Fooi{}% + \foreachitem\rgt\in\RetiensListe{% + % \rgtcnt~\RetiensListe[\rgtcnt] et \Element% + \xintifboolexpr{\RetiensListe[\rgtcnt]==\Element}{}{% + \xdef\Fooi{\Fooi,\RetiensListe[\rgtcnt]} + }% + % La liste Fooi est \Fooi\par + }% + \readlist*\ListeTempo{\Fooi}% + \xintifboolexpr{\ListeTempolen>1}{% + \xdef\Fooa{\ListeTempo[1]}% + \xintFor* ##2 in{\xintSeq{2}{\ListeTempolen}}\do{% + \xdef\Fooa{\Fooa,\ListeTempo[##2]}% + }% + }{% + % \xdef\Fooa{\ListeTempo[1]}% + \xdef\PfCRetiensRangement{\PfCRetiensRangement,\ListeTempo[1]} + }% + % La liste Fooa vaut \Fooa\par + }% +}% + +\NewDocumentCommand\Rangement{om}{% + \useKVdefault[ClesRgt]% + \setKV[ClesRgt]{#1}% + \ignoreemptyitems% + \readlist*\ListeRgt{#2}% + % \showitems\ListeRgt[]\par% + \ifboolKV[ClesRgt]{Fraction}{% + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeRgt{#2}% + % on cherche le d\'enominateur commun + \ppcm=1\relax + \foreachitem\x\in\ListeRgt{% + \PPCM{\fpeval{\ListeRgt[\xcnt,2]}}{\fpeval{\the\ppcm}}% + }% + % + \xdef\FooFraction{\fpeval{\ListeRgt[1,1]*\the\ppcm/\ListeRgt[1,2]}}% + \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{% + \xdef\FooFraction{\FooFraction,\fpeval{\ListeRgt[##1,1]*\the\ppcm/\ListeRgt[##1,2]}}% + }% + \RangementListe{\FooFraction}% + \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement}% + %%%%%%%%% + \ifboolKV[ClesRgt]{Decroissant}{% + \ifboolKV[ClesRgt]{Details}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\frac{\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}}{\num{\the\ppcm}} + }% + }% + }{% + \ensuremath{ + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\qeqslant}}\Simplification{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}{\the\ppcm}}% + }% + }% + }{% + \ifboolKV[ClesRgt]{Details}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\frac{\num{\PfCListeFinaleRgt[##1]}}{\num{\the\ppcm}}% + }% + }% + }{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\Simplification{\PfCListeFinaleRgt[##1]}{\the\ppcm}% + }% + }% + }% + }% %%%%%%%%%%%%% + }{% + \RangementListe{#2}% + % + % \PfCRetiensRangement% + \ifboolKV[ClesRgt]{Seul}{}{% + \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement} + % \par \showitems\PfCListeFinaleRgt[] -- La longueur de la liste est \PfCListeFinaleRgtlen + \ifboolKV[ClesRgt]{Decroissant}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}% + }% + }% + }{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PfCListeFinaleRgtlen}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\num{\PfCListeFinaleRgt[##1]}% + }% + }% + }% + }% + }% + \reademptyitems + } + +\NewDocumentCommand\Rangementold{om}{% \useKVdefault[ClesRgt]% \setKV[ClesRgt]{#1}% \ifboolKV[ClesRgt]{Fraction}{% @@ -20,21 +137,21 @@ }% % On cr\'ee la liste des rangements. \DTLcleardb{mtnumedb}% -% % on les trie pour les ranger par ordre croissant + % % on les trie pour les ranger par ordre croissant \foreachitem\x\in\ListeRgt{% \DTLnewrow{mtnumedb}% \xdef\toto{\fpeval{\ListeRgt[\xcnt,1]*\the\ppcm/\ListeRgt[\xcnt,2]}}% \DTLnewdbentry{mtnumedb}{numeric}{\toto}% }% -% % On trie + % % On trie \ifboolKV[ClesRgt]{Decroissant}{% -% % On trie la liste + % % On trie la liste \dtlsort{numeric=descending}{mtnumedb}{\dtlicompare}% \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{% \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% - } + }% }{% -% % On trie la liste + % % On trie la liste \dtlsort{numeric}{mtnumedb}{\dtlicompare}% \ifboolKV[ClesRgt]{Details}{% \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% @@ -47,27 +164,29 @@ \readlist*\ListeRgt{#2}% % on cr\'ee la base de donn\'ees des valeurs \DTLcleardb{mtRGTdb}% -% % on les trie pour les ranger par ordre croissant - \foreachitem\x\in\ListeRgt{% + % % on les trie pour les ranger par ordre croissant + \foreachitem\xcompteur\in\ListeRgt{% + % Les nombres sont \showitems\ListeRgt[] \DTLnewrow{mtRGTdb}% - \itemtomacro\ListeRgt[\xcnt]\y% - \DTLnewdbentry{mtRGTdb}{numeric}{\y}% + \itemtomacro\ListeRgt[\xcompteurcnt]\ycompteur% + \DTLnewdbentry{mtRGTdb}{numeric}{\ycompteur}% }% -% % + \DTLdisplaydb[]{mtRGTdb}% + % % \ifboolKV[ClesRgt]{Seul}{% - \xdef\PfCListeRgtRecup{}% + \xdef\PfCListeRgtRecup{}% \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% \DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\xdef\PfCListeRgtRecup{\PfCListeRgtRecup \numeroDonnee\DTLiflastrow{}{,}}}% }{% - \ifboolKV[ClesRgt]{Decroissant}{% - % On trie la liste - \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}% - \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% - }{% -% % On trie la liste - \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% - \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% + \ifboolKV[ClesRgt]{Decroissant}{% + % On trie la liste + \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}% + \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% + }{% + % % On trie la liste + \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% + \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% + }% }% }% -}% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex b/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex index 20259f4a868..96c2d6512df 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex @@ -86,9 +86,10 @@ ObjetEquateur3("R=5"); ObjetGreenwich4("R=5"); fi; - AffichagePfC2; + AffichagePfC2; % AffichageObjet2; if \useKV[ClesReperage]{Axes}: + TraceAxes; drawoptions(withpen pencircle scaled 1.05 withcolor CouleurE); AffichageEquateur3; drawoptions(withpen pencircle scaled 1 withcolor CouleurG); @@ -1533,7 +1534,7 @@ pointe(unitp*(valeur[n]-ValeurOrigine,0)); elseif ACoord=2: if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; @@ -1552,9 +1553,9 @@ elseif AffichageCoord=2: if p_<>"": if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: - label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; pointe(unitp*(valeur[n],0)); fi; diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex b/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex index 35bbeb74f56..ef0829af903 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex @@ -239,7 +239,7 @@ nombresommets=\useKV[ClesSolides]{SommetsPyramide}; color PfCOutColor,DecalageSommet; PfCOutColor=\useKV[ClesSolides]{Couleur}; - DecalageSommet=if Reguliere:(0,0,0) else: #3 fi; + DecalageSommet=#3;%if Reguliere:(0,0,0) else: #3 fi; Figure(-10u,-10u,10u,10u); Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance); @@ -567,6 +567,8 @@ color A,B,C,D,E,F,G,H; color Sommet[]; trace Pave(A,B,C,D,E,F,G,H)(#3); + picture Depart; + Depart=currentpicture; currentpicture:=nullpicture; Sommet1=A; Sommet2=B; @@ -613,6 +615,7 @@ % trace polygone(MSection1,MSection2,MSection3,MSection4); color dcer,ccer; % 1er cote -> ok + DotLabel("",RetiensDefSection[4]); dcer:=Oeil-RetiensDefSection[4]; ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]); draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi; @@ -673,7 +676,8 @@ %trace polygone(MSection1,MSection2,MSection3,MSection4); fi; - trace Pave(A,B,C,D,E,F,G,H)(#3); + % trace Pave(A,B,C,D,E,F,G,H)(#3); + trace Depart; DefinirSommetsSection(#4); diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex index 8f63507b5b7..75913cc0252 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex @@ -10,26 +10,33 @@ \newcommand\DonneeMax{}% \newcommand\DonneeMin{}% \newcommand\EffectifMax{}% +\newcommand\PfCArticleMediane{la}% \setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,% FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,% Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,% -Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% -Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% +Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,MoyenneA,Somme,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% +Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% % Pour les diags batons -EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,% +EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,% % Pour les diags circulaires -Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,% +Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,ListeHachures={60},LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,DebutAngle=0,% %Pour les représentations Representation=false,% %Pour les barres horizontales -Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dispo +Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo +% Pour les histogrammes +Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% }% -%compl\'ements +% compl\'ements +%\defKV[ClesStat]{ListeHachures=\setKV[ClesStat]{Hachures}}% +\defKV[ClesStat]{Unite=\setKV[ClesStat]{Concret}}% \defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}% \defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}% \defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}% \defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}% +\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}% +\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}% % La construction du tableau \def\addtotok#1#2{#1\expandafter{\the#1#2}}% \newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc% @@ -37,12 +44,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis % \newcounter{PfCCompteLignes}% % -\def\BuildtabStat{% %%Tableau sans total +\def\BuildtabStat{% %%Tableau sans/avec total \setcounter{PfCCompteLignes}{0}% \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}% \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \ifboolKV[ClesStat]{Total}{% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% @@ -84,7 +91,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis }% \end{NiceTabular}% }{% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% @@ -194,12 +200,14 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis }% \def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% +\def\UpdateHach#1\nil{\addtotok\toklisteanglehachure{#1,}}% \def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% % Pour construire le diagramme circulaire qualitatif \def\buildgraphcq#1{% \newtoks\toklistepointq\toklistepointq{}% \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklisteanglehachure\toklisteanglehachure{}% \newtoks\toklistelegende\toklistelegende{}% \ifboolKV[ClesStat]{LegendeVide}{% \xdef\foo{\useKV[ClesStat]{LegendesVides}}% @@ -212,7 +220,10 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% + \xdef\ListeAvantHachures{\useKV[ClesStat]{ListeHachures}}% + \readlist*\ListeHachure{\ListeAvantHachures}% + \foreachitem\valeurangle\in\ListeHachure{\expandafter\UpdateHach\valeurangle\nil}% + \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}{\the\toklisteanglehachure}% }% %% calcul des fr\'equences @@ -231,6 +242,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis %% calcul des ECC \newcount\CompteurECC% \newcount\CompteurECCTotal% +\newcount\CompteurECCC% +\newcount\CompteurECCCTotal% \newcommand\CalculECC[1]{% \xdef\TotalECC{0}% @@ -451,7 +464,16 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis unitey:=\useKV[ClesStat]{Unitey}*cm; xpartorigine:=\useKV[ClesStat]{Origine}; AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; - boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour; + boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date; + GrandNombrex=\useKV[ClesStat]{GrandNombrex}; + GrandNombrey=\useKV[ClesStat]{GrandNombrey}; + if GrandNombrex: + GrandNombreA=\useKV[ClesStat]{GrandNombreA}; + fi; + if GrandNombrey: + GrandNombreO=\useKV[ClesStat]{GrandNombreO}; + fi; + Date:=\useKV[ClesStat]{Date}; Rotation=\useKV[ClesStat]{AbscisseRotation}; Lecture:=\useKV[ClesStat]{Lecture}; LectureFine:=\useKV[ClesStat]{LectureFine}; @@ -541,16 +563,28 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis if pair p_: l:=l+1; if Rotation: + if Date: + label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]); + else: label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); + fi; else : + if Date: + label.bot(TEX(decimal(xpart(p_))),A[l]); + else: label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); fi; + fi; if Reponses: if DonneesSup: Test(l); if Retour=false: + if GrandNombrey: + label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + else: label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); fi; + fi; else: if Tiret: trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); @@ -627,20 +661,36 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis for k=0 step Pasy until ((maxy+1*Pasy)): if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); + else: label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); else: dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); fi; + fi; endfor; fi; if Lecture: for k=0 step Pasy until Pasy: if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); + else: label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); else: dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); fi; + fi; endfor; fi; drawarrow (0,0)--unitex*(maxx+1,0); @@ -796,6 +846,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis ang[0]:=0; path cc; cc=(fullcircle scaled (2*Rayon)); + % vardef AfficheLegende(text t)= picture ResultatLegende; ResultatLegende=image( @@ -806,12 +857,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis draw 0.95[O,C[n]]--1.05[O,C[n]]; C[n]:=1.05[O,C[n]]; Test(n); - if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.urt(TEX(p_),D[n]);fi; fi; - if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): D[n]=C[n]-(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.ulft(TEX(p_),D[n]);fi; @@ -821,7 +872,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis draw C[n]--D[n]; if Retour=false:label.llft(TEX(p_),D[n]);fi; fi; - if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.lrt(TEX(p_),D[n]);fi; @@ -842,12 +893,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis draw 0.95[O,C[n]]--1.05[O,C[n]]; C[n]:=1.05[O,C[n]]; Test(n); - if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): + if (xpart(C[n])>xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.urt(LATEX(p_),D[n]);fi; fi; - if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): D[n]=C[n]-(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.ulft(LATEX(p_),D[n]);fi; @@ -871,19 +922,22 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis } % la construction du graphique qualitatif -\def\NewMPStatCirculaireQ#1#2#3#4{% +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4#5{% %#1 : la liste des données %#2 : 360 ou 180 %#3 : liste des couleurs %#4 : liste des légendes à effacer. + %#5 : liste des angles des hachures \ifluatex \mplibforcehmode \begin{mplibcode} \NewMPStatCirculaireCodeQ + DebutAngle=\useKV[ClesStat]{DebutAngle}; if Inverse=false: - A[0]=point(0) of cc; + A[0]=point(0+DebutAngle) of cc; else: - A[0]=point(180) of cc; + A[0]=point(180+DebutAngle) of cc; fi; % on r\'ecup\`ere les couleurs color Col[]; @@ -892,6 +946,13 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis n:=n+1; Col[n]=p_; endfor; + % on r\'ecup\`ere les angles d'hachures + numeric anglehach[]; + n:=0; + for p_=#5: + n:=n+1; + anglehach[n]=p_; + endfor; vardef toto(text t)= n:=0; for p_=t: @@ -920,8 +981,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis else: draw Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) - else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if - (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi else: anglehach[n] fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; fi; if ACompleter=false: @@ -1027,6 +1088,13 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis n:=n+1; Col[n]=p_; endfor; + % on r\'ecup\`ere les angles d'hachures + numeric anglehach[]; + n:=0; + for p_=#5: + n:=n+1; + anglehach[n]=p_; + endfor; if Inverse=false: A[0]=point(0) of cc; else: @@ -1060,8 +1128,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis else: draw Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) - else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if - (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi else: anglehach[n] fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; fi; if ACompleter=false: @@ -1166,477 +1234,905 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \DTLgnewdb{mtdbEE}% \DTLgnewdb{mtdbEEqual}% % + +% Pour les classes +% Pour construire l'histogramme +\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}} +\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}} + +\NewDocumentCommand\buildgraphhisto{}{% + \newtoks\toklisteelmtsclasse% + \newtoks\toklistedonhisto% + \newtoks\toklistecouleur% + \newtoks\toklistelegende% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}% + \ifboolKV[ClesStat]{ECC}{% + \toklistedonhisto{}% + \xdef\PfCFooECC{\ListeDepart[1,3]}% + \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{% + \xdef\PfCFooRetiens{0}% + \xintFor* ##2 in{\xintSeq{1}{##1}}\do{% + \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}% + }% + \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}% + }% + \readlist*\PfCListeECC{\PfCFooECC}% + \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}% + }{}% + \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}% + \foreachitem\compteur\in\ListeDepart{% + \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}} + }% + \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}} + % Pour les couleurs + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + % + \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}% +} + +%% calcul des fr\'equences +\newcommand\CalculFrequenceClasses[1]{% + \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} +} + +\newcommand\CalculECCClasses[1]{% + \xdef\TotalECCC{0}% + \CompteurECCC=1% + \CompteurECCCTotal=\numexpr#1+1% + \whiledo{\CompteurECCC < \CompteurECCCTotal}{% + \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}% + \CompteurECCC=\numexpr\CompteurECCC+1% + }% + \num{\TotalECCC}% +} + +\NewDocumentCommand\buildtabclasses{}{% + \setcounter{PfCCompteLignes}{0}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% + \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines] + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body + \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$ + }\\ + \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}% + }\\ + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\ + }{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% +% % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% +% % On retrace le tableau +% % Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% +% % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular} +}% + +\NewDocumentCommand\MPBuildHisto{mmmm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + maxx:=-infinity; + minx:=infinity; + maxy:=-infinity; + miny:=0; + unitex:=\useKV[ClesStat]{Unitex}*cm; + unitey:=\useKV[ClesStat]{Unitey}*cm; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + UniteAire=\useKV[ClesStat]{UniteAire}; + Ecarthachures=\useKV[ClesStat]{EcartHachures}; + Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC; + ECC=\useKV[ClesStat]{ECC}; + Mediane=\useKV[ClesStat]{Mediane}; + MemeAmpli=\useKV[ClesStat]{MemeAmpli}; + Hachures:=\useKV[ClesStat]{Hachures}; + % + Lecture:=\useKV[ClesStat]{Lecture}; + LectureFine:=\useKV[ClesStat]{LectureFine}; + Tiret=\useKV[ClesStat]{Tiret}; + AideLecture:=\useKV[ClesStat]{AideLecture}; + DonneesSup:=\useKV[ClesStat]{DonneesSup}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + Retour=false; + % Test affichage + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + %Affichage ou pas des légendes + vardef AfficheLegende(text t)= + l=0; + for p_=t: + l:=l+1; + if DonneesSup: + Test(l); + if Retour=false: + label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l])); + fi; + fi; + endfor; + enddef; + % on r\'ecup\`ere les couleurs + Depart=\useKV[ClesStat]{DepartHisto}; + color Col[],CoulDefaut; + CoulDefaut=white; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + % + numeric X[]; + numeric ecartabs[]; + vardef RecupValeursAbscisses(text t)= + p:=0; + for p_=t: + p:=p+1; + X[p]:=p_; + if X[p]<minx: + minx:=X[p]; + fi; + if X[p]>maxx: + maxx:=X[p]; + fi; + endfor; + X[0]=X[1]; + TotalAbscisses=p; + enddef; + numeric Y[],Z[]; + numeric EffectifTotal[]; + numeric EffectifTotalA[]; + vardef RecupValeursDonnees(text t)= + p:=0; + EffectifTotal[0]:=0; + EffectifTotalA[0]:=0; + for p_=t: + p:=p+1; + EffectifTotal[p]:=p_; + EffectifTotalA[p]:=EffectifTotalA[p-1]+p_; + Y[p]:=p_; + Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx)); + R[p]=ceiling(Z[p]); + if R[p]>maxy: + maxy:=R[p]; + fi; + endfor; + NbDonnees:=p; + enddef; + %On affiche la médiane dans le cas des ECC + vardef AfficheMedianeECC(text t)= + YMed:=Z[NbDonnees]/2; + DemiDonnees:=EffectifTotal[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotal[p]>DemiDonnees; + endfor; + path MedHor,MedLineaire,MedVer; + MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]); + MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed)); + MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor); + draw MedLineaire; + draw MedHor; + draw MedVer; + enddef; + % On affiche la médiane dans le cas non ECC + vardef AfficheMediane(text t)= + DemiDonnees:=EffectifTotalA[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotalA[p]>DemiDonnees; + endfor; + path MedVer; + numeric CoefLineaire,pMed; + pMed=p; + CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p]; + MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]); + draw MedVer dashed evenly; + enddef; + % On commence le tracé : on récupère les informations + RecupValeursAbscisses(#1); + RecupValeursDonnees(#2); + % on définit une grille + vardef Grille= + if MemeAmpli: + Ajout:=1; + else: + Ajout:=3; + fi; + drawoptions(withcolor 0.7white); + for k=0 upto ((maxx-minx)/Pasx+2): + trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red; + endfor; + for k=0 upto (maxy+Ajout): + trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue; + endfor; + drawoptions(); + enddef; + % Fin Grille + % On trace les rectangles + vardef AfficheRectangles= + if Hachures: + Grille; + for k=2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + else: + for k=2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi; + endfor; + Grille; + for k=2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + fi; + enddef; + % Affichage final + if ECC: + AfficheRectangles; + if Mediane: + AfficheMedianeECC(#2); + fi; + else: + if Mediane: + AfficheMediane(#2); + if Hachures: + Grille; + %Partie gauche + for k=2 step 2 until (2*pMed-2): + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0); + draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])); + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1); + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + else: + %Partie gauche + for k=2 step 2 until (2*pMed-2): + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ; + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + Grille; + %Partie Gauche + for k=2 step 2 until (2*pMed-2): + trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx)))); + for k=2*pMed+2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + fi; + draw MedVer withpen pencircle scaled 2; + else: + AfficheRectangles; + fi; + fi; + %Affichage ou pas des axes, de la médiane + if MemeAmpli: + drawarrow (0,0)--unitey*(0,maxy+1); + EcartAmpli:=(X[2]-X[1])/Pasx; + if AideLecture: + for k=2 step 2 until TotalAbscisses: + trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly; + endfor; + fi; + if LectureFine: + for k=0 upto ((maxy+1)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + if Lecture: + for k=0 upto 1: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + else:%Pas même ampli : on n'affiche pas l'axe vertical + trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0); + trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))); + label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5))); +% if Mediane: +% AfficheMediane(#2); +% fi; + fi; + % On trace l'axe des abscisses + drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0); + %On labelise l'axe des abscisses + dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0)); + for k=2 step 2 until TotalAbscisses: + dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0)); + endfor; + label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0)); + %On affiche les données sup ou pas. + AfficheLegende(#2); + \end{mplibcode} + \fi +} +% + \newcommand\Stat[2][]{% \useKVdefault[ClesStat]% \setKV[ClesStat]{#1}% - \ifboolKV[ClesStat]{Representation}{% - \setKV[TraceG]{Xmin=0,Ymin=0}% - \setKV[TraceG]{#1}% - \readlist*\ListePointsPlaces{#2}% - \newtoks\toklistepoint% - \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% - \MPPlacePoint[#1]{\the\toklistepoint}% + \ifboolKV[ClesStat]{UneMediane}{\renewcommand{\PfCArticleMediane}{une}}{\renewcommand{\PfCArticleMediane}{la}}% + \setsepchar[*]{,*/}% + \readlist*\ListeAvantUtilisation{#2}% + \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}% + \ifboolKV[ClesStat]{Classes}{% + \setsepchar[*]{,*/}% + \readlist*\ListeDepart{#2}% + \xdef\EffectifTotal{0}% + \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}% + }% + \ifboolKV[ClesStat]{Histogramme}{% + \buildgraphhisto% + }{% + \ifboolKV[ClesStat]{Tableau}{% + \buildtabclasses% + }{}% + }% }{% - \ifboolKV[ClesStat]{Liste}{% - \setsepchar{,}\ignoreemptyitems% - \readlist*\Liste{#2}% - \xdef\foo{}% - \setsepchar[*]{,*/}\ignoreemptyitems% - \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% - \xdef\foo{\foo 1/\Liste[##1],}% - }% - \readlist*\ListeComplete{\foo}% - \setKV[ClesStat]{Qualitatif}% + \setsepchar{,}% + \ifboolKV[ClesStat]{Representation}{% + \setKV[TraceG]{Xmin=0,Ymin=0}% + \setKV[TraceG]{#1}% + \readlist*\ListePointsPlaces{#2}% + \newtoks\toklistepoint% + \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% + \MPPlacePoint[#1]{\the\toklistepoint}% }{% - \ifboolKV[ClesStat]{Sondage}{% + \ifboolKV[ClesStat]{Liste}{% \setsepchar{,}\ignoreemptyitems% \readlist*\Liste{#2}% - % "liste vide" - \newtoks\tabtoksEEa% - \tabtoksEEa{}% - % - % "liste vide" - \newtoks\tabtoksEEb% - \tabtoksEEb{}% - % - \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide - % - \newcount\cmptEE% - \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif - \PasNumEE=0\relax% - \DTLcleardb{mtdbEE}% - % on range les resultats du sondage par ordre croissant. - \foreachitem\x\in\Liste{% - \DTLnewrow{mtdbEE}% - \DTLnewdbentry{mtdbEE}{Numeric}{\x}% + \xdef\foo{}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% + \xdef\foo{\foo 1/\Liste[##1],}% }% - \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% - \DTLforeach{mtdbEE}{\nba=Numeric}{% - \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% - \cmptEE=0\relax% - \foreachitem\nbb\in\ListeSansDoublonsEE{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \ifthenelse{\equal{\the\cmptEE}{0}}{% - \expandafter\AjoutListEEb\nba\nil% - \xdef\listEEa{\the\tabtoksEEb}% - \ignoreemptyitems% - \setsepchar{,}% - \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements - %%% identiques de Liste - }{}% - }% - \foreachitem\nba\in\ListeSansDoublonsEE{% - \cmptEE=0\relax% - \DTLforeach{mtdbEE}{\nbb=Numeric}{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \expandafter\AjoutListEEab\nba\nil% - \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements - %%% identiques de Liste - }% - \xdef\listEEb{\the\tabtoksEEa} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEEb% - % - \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% + \readlist*\ListeComplete{\foo}% + \setKV[ClesStat]{Qualitatif}% }{% - \ifboolKV[ClesStat]{Qualitatif}{% - % % on lit la liste \'ecrite sous la forme valeur/effectif - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% + \ifboolKV[ClesStat]{Sondage}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#2}% % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% - }% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% - }% - \xdef\listEE{\the\tabtoksEE} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }{% Dans le qualitatif, on trie d'abord les valeurs. - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% + \newtoks\tabtoksEEa% + \tabtoksEEa{}% + % % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + \newtoks\tabtoksEEb% + \tabtoksEEb{}% + % + \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide + % + \newcount\cmptEE% + \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif + \PasNumEE=0\relax% + \DTLcleardb{mtdbEE}% + % on range les resultats du sondage par ordre croissant. + \foreachitem\x\in\Liste{% + \DTLnewrow{mtdbEE}% + \DTLnewdbentry{mtdbEE}{Numeric}{\x}% + }% + \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% + \DTLforeach{mtdbEE}{\nba=Numeric}{% + \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% + \cmptEE=0\relax% + \foreachitem\nbb\in\ListeSansDoublonsEE{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \ifthenelse{\equal{\the\cmptEE}{0}}{% + \expandafter\AjoutListEEb\nba\nil% + \xdef\listEEa{\the\tabtoksEEb}% + \ignoreemptyitems% + \setsepchar{,}% + \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements + %%% identiques de Liste + }{}% }% - \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% + \foreachitem\nba\in\ListeSansDoublonsEE{% + \cmptEE=0\relax% + \DTLforeach{mtdbEE}{\nbb=Numeric}{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \expandafter\AjoutListEEab\nba\nil% + \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements + %%% identiques de Liste }% - \xdef\listEE{\the\tabtoksEE} + \xdef\listEEb{\the\tabtoksEEa} \ignoreemptyitems% \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }}}% - % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif - \DTLcleardb{mtdb}% - % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr - \foreachitem\x\in\ListeComplete{% - \DTLnewrow{mtdb}% - \itemtomacro\ListeComplete[\xcnt,2]\y% - \DTLnewdbentry{mtdb}{Numeric}{\y}% - }% - \dtlsort{Numeric}{mtdb}{\dtlicompare}% - % % on r\'einitialise les valeurs des crit\`eres de position et de - % dispersion - \renewcommand\NbDonnees{}% - \renewcommand\SommeDonnees{}% - \renewcommand\EffectifTotal{}% - \renewcommand\Moyenne{}% - \renewcommand\Etendue{}% - \renewcommand\Mediane{}% - \renewcommand\DonneeMax{0}% - \renewcommand\EffectifMax{0}% - \renewcommand\DonneeMin{999999999}% - \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif - % Calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \ifboolKV[ClesStat]{EffectifTotal}{% - \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est - \num{\ListeCompletelen}.\par}{% - \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + \readlist*\ListeComplete\listEEb% + % + \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% + }{% + \ifboolKV[ClesStat]{Qualitatif}{% + % % on lit la liste \'ecrite sous la forme valeur/effectif + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }{% Dans le qualitatif, on trie d'abord les valeurs. + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }}}% + % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif + \DTLcleardb{mtdb}% + % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr + \foreachitem\x\in\ListeComplete{% + \DTLnewrow{mtdb}% + \itemtomacro\ListeComplete[\xcnt,2]\y% + \DTLnewdbentry{mtdb}{Numeric}{\y}% + }% + \dtlsort{Numeric}{mtdb}{\dtlicompare}% + % % on r\'einitialise les valeurs des crit\`eres de position et de + % dispersion + \renewcommand\NbDonnees{}% + \renewcommand\SommeDonnees{}% + \renewcommand\EffectifTotal{}% + \renewcommand\Moyenne{}% + \renewcommand\Etendue{}% + \renewcommand\Mediane{}% + \renewcommand\DonneeMax{0}% + \renewcommand\EffectifMax{0}% + \renewcommand\DonneeMin{999999999}% + \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif + % Calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \ifboolKV[ClesStat]{EffectifTotal}{% + \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est + \num{\ListeCompletelen}.\par}{% + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in + {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} + }{}% + \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% + \ifboolKV[ClesStat]{Moyenne}{% + \ifboolKV[ClesStat]{Liste}{% + \ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie est :% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]% + }% + }{}% + \ifboolKV[ClesStat]{MoyenneA}{% + \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% + Donc la moyenne de la s\'erie est \'egale \`a :% + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} + \ifboolKV[ClesStat]{ValeurExacte}{}{% + \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% + \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% + \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% + \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + }% + \]% + }{}% + }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,2]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,2]}% + }{}% + }% + \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% + \ifboolKV[ClesStat]{Etendue}{% + \ifboolKV[ClesStat]{Liste}{% + L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % celui de la mediane + %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% + \newcount\Recapmed% + \newcount\Recapmeda% + \ifodd\number\ListeCompletelen%odd impair + \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% + \else% + \Recapmed=\fpeval{\ListeCompletelen/2}\relax% + \Recapmeda=\numexpr\Recapmed+1\relax% + \fi% + \newcount\Recapk% + \Recapk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% + \ifnum\Recapk=\Recapmed% + \ifodd\number\ListeCompletelen% + \xdef\Mediane{\numeroDonnee}% + \else% + \xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\Recapk=\Recapmeda% + \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% + \fi% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + \ifboolKV[ClesStat]{Liste}{% + On range les donn\'ees par ordre croissant :% + \nbdonnees=0% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% + }{% + \medskip% + \begin{center} + \begin{minipage}{0.9\linewidth} + \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; + }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} + \end{minipage} + \end{center}% + \medskip% + }% + \newcount\med% + \newcount\meda% + \ifodd\number\ListeCompletelen%odd impair + \med=\fpeval{(\ListeCompletelen+1)/2}\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ + \else% pair + \med=\fpeval{\ListeCompletelen/2}\relax% + \meda=\numexpr\med+1\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ + \fi% + \newcount\k% + \k=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% + \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi + \ifodd\number\ListeCompletelen% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \xdef\Mediane{\numeroDonnee}% + \else% + La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\k=\meda + La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}$\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\numeroDonnee}}{2}=}{}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% + %%%%%%% + }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\numeroDonnee}% + \fi% + }% + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% + \fi% + \newcount\PfCQtroisk% + \PfCQtroisk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi + \xdef\QuartileTrois{\numeroDonnee}% + \fi% + }% + % Construction du tableau + \ifboolKV[ClesStat]{Tableau}{% + \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% + % Construction du graphique + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% + \ifboolKV[ClesStat]{Barre}{% + \buildgraphbarhor% + }{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraphq[#1]% + }% + }% + }% + }% + }{}% + }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif + % % on effectue les calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,1]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,1]}% + }{}% + }% + % \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% + \ifboolKV[ClesStat]{EffectifTotal}{% L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} - }{}% - \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% - \ifboolKV[ClesStat]{Moyenne}{% - \ifboolKV[ClesStat]{Liste}{% - La somme des donn\'ees de la s\'erie est :% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] + }{}% + \ifboolKV[ClesStat]{Moyenne}{% + \ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie est :% \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]}{% + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }{% \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]% + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }% + }{}% + \ifboolKV[ClesStat]{MoyenneA}{\ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% + \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% + \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]} + }=\num{\EffectifTotal} + \]% + }% }% - \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% \ifboolKV[ClesStat]{ValeurExacte}{}{% - \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% + \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% - \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% }% \]% - }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,2]}% + }{}% }{}% - \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,2]}% - }{}% - }% - \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% - \ifboolKV[ClesStat]{Etendue}{% - \ifboolKV[ClesStat]{Liste}{% - L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % celui de la mediane - %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% - \newcount\Recapmed% - \newcount\Recapmeda% - \ifodd\number\ListeCompletelen%odd impair - \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% - \else% - \Recapmed=\fpeval{\ListeCompletelen/2}\relax% - \Recapmeda=\numexpr\Recapmed+1\relax% - \fi% - \newcount\Recapk% - \Recapk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% - \ifnum\Recapk=\Recapmed% - \ifodd\number\ListeCompletelen% - \xdef\Mediane{\numeroDonnee}% - \else% - \xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\Recapk=\Recapmeda% - \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% + % % Affichage des r\'eponses. + % %% pour l'\'etendue + \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% + % pour la m\'ediane + %%% Recuperation Mediane + \newcount\Recupmed% + \newcount\Recupmeda% + \ifodd\number\EffectifTotal%odd impair + \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% + \else% pair + \Recupmed=\fpeval{\EffectifTotal/2}\relax% + \Recupmeda=\numexpr\Recupmed+1\relax% \fi% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - \ifboolKV[ClesStat]{Liste}{% - On range les donn\'ees par ordre croissant :% - \nbdonnees=0% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% - }{% - \medskip% - \begin{center} - \begin{minipage}{0.9\linewidth} - \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; - }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} - \end{minipage} - \end{center}% - \medskip% + \newcount\Recupk% + \Recupk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \Recupk=\numexpr\Recupk+1\relax% + \ifnum\Recupk=\Recupmed% + \ifodd\number\EffectifTotal% + \xdef\Mediane{\ListeComplete[##1,1]}% + \else% + \xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\Recupk=\Recupmeda% + \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% + \fi% }% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + \newcount\med% \newcount\meda% - \ifodd\number\ListeCompletelen%odd impair - \med=\fpeval{(\ListeCompletelen+1)/2}\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ + \ifodd\number\EffectifTotal%odd impair + \med=\fpeval{(\EffectifTotal+1)/2}\relax% + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % \else% pair - \med=\fpeval{\ListeCompletelen/2}\relax% + \med=\fpeval{\EffectifTotal/2}\relax% \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % \fi% \newcount\k% \k=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% - \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi - \ifodd\number\ListeCompletelen% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \xdef\Mediane{\numeroDonnee}% - \else% - La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\k=\meda - La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \fi% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \k=\numexpr\k+1\relax% + \ifnum\k=\med% + \ifodd\number\EffectifTotal% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \else% + La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\k=\meda% + La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est $\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\ListeComplete[##1,1]}}2=}{}\xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% }% - %%%%%%% - }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\numeroDonnee}% - \fi% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi - \xdef\QuartileTrois{\numeroDonnee}% - \fi% - }% - % Construction du tableau - \ifboolKV[ClesStat]{Tableau}{% - \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% - % Construction du graphique - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% - \ifboolKV[ClesStat]{Barre}{% - \buildgraphbarhor% - }{\ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraphq[#1]}}}% - }}{}% - }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif - % % on effectue les calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,1]}% - }{}% - \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,1]}% }{}% - }% - % \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% - \ifboolKV[ClesStat]{EffectifTotal}{% - L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in - {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] - }{}% - \ifboolKV[ClesStat]{Moyenne}{% - La somme des donn\'ees de la s\'erie est :% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }% - \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% - \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% - \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]} - }=\num{\EffectifTotal} - \]% - }% - }% - Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% - \ifboolKV[ClesStat]{ValeurExacte}{}{% - \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% - \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% - \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% - \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\EffectifTotal/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\ListeComplete[##1,1]}% + \fi% }% - \]% - }{}% - % % Affichage des r\'eponses. - % %% pour l'\'etendue - \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% - % pour la m\'ediane - %%% Recuperation Mediane - \newcount\Recupmed% - \newcount\Recupmeda% - \ifodd\number\EffectifTotal%odd impair - \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% - \else% pair - \Recupmed=\fpeval{\EffectifTotal/2}\relax% - \Recupmeda=\numexpr\Recupmed+1\relax% - \fi% - \newcount\Recupk% - \Recupk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \Recupk=\numexpr\Recupk+1\relax% - \ifnum\Recupk=\Recupmed% - \ifodd\number\EffectifTotal% - \xdef\Mediane{\ListeComplete[##1,1]}% - \else% - \xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\Recupk=\Recupmeda% - \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% - \fi% }% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - - \newcount\med% - \newcount\meda% - \ifodd\number\EffectifTotal%odd impair - \med=\fpeval{(\EffectifTotal+1)/2}\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % - \else% pair - \med=\fpeval{\EffectifTotal/2}\relax% - \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% \fi% - \newcount\k% - \k=0% + \newcount\PfCQtroisk% + \PfCQtroisk=0% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \k=\numexpr\k+1\relax% - \ifnum\k=\med% - \ifodd\number\EffectifTotal% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \else% - La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\k=\meda% - La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois% + \xdef\QuartileTrois{\ListeComplete[##1,1]}% \fi% }% }% - }{}% - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\EffectifTotal/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\ListeComplete[##1,1]}% - \fi% - }% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois% - \xdef\QuartileTrois{\ListeComplete[##1,1]}% - \fi% - }% + % Construction de tableau + \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% + % Construction du graphique ?? + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraph[#1]% + }% + }% + }{}% }% - % Construction de tableau - \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% - % Construction du graphique ?? - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraph[#1]}} - }{}% }% }% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex new file mode 100644 index 00000000000..ca8be38394b --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex @@ -0,0 +1,2106 @@ +%%% +% Statistiques +%%% +\newcommand\NbDonnees{}% +\newcommand\SommeDonnees{}% +\newcommand\EffectifTotal{}% +\newcommand\Moyenne{}% +\newcommand\Etendue{}% +\newcommand\Mediane{}% +\newcommand\DonneeMax{}% +\newcommand\DonneeMin{}% +\newcommand\EffectifMax{}% + +\setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,% +FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,% +Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,% +Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% +Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% +% Pour les diags batons +EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,% +% Pour les diags circulaires +Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,% +%Pour les représentations +Representation=false,% +%Pour les barres horizontales +Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo +% Pour les histogrammes +Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% +}% +%compl\'ements +\defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}% +\defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}% +\defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}% +\defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}% +\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}% +\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}% +% La construction du tableau +\def\addtotok#1#2{#1\expandafter{\the#1#2}}% +\newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc% +\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}% +% +\newcounter{PfCCompteLignes}% +% +\def\BuildtabStat{% %%Tableau sans/avec total + \setcounter{PfCCompteLignes}{0}% + \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}% + \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% + \ifboolKV[ClesStat]{Total}{% + \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body% + \the\tabtoksa&Total\\% + \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\% + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}% + \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}% + \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% + % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% + % On retrace le tableau + %Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% + % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular}% + }{% + \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body% + \the\tabtoksa\\% + \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\% + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}% + \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}% + \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% + % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% + % On retrace le tableau + %Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% + % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular}% + }% +}% + +% Pour construire le diagramme en barres horizontales +\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}% + +\newcommand\buildgraphbarhor{% + \newtoks\toklistenomhor% + \newtoks\toklistedonhor% + \newtoks\toklisteaffhor% + \newtoks\toklistecouleur% + \xdef\PfCfooStat{}% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}% + }% + \xdef\DivMax{\fpeval{max(\PfCfooStat)}}% + \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}% + \xdef\DivMax{\fpeval{10**\ExposantDivMax}}% + \xdef\PfCfooStat{}% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}% + }% + \readlist*\ListeCompleteDiagHor{\PfCfooStat}% + \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}% +}% + +% Pour construire le diagramme en bâtons +\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}% +\newcommand\buildgraph[1][]{% + \newtoks\toklistepoint\toklistepoint{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende} +}% + +% Pour construire le diagramme en bâtons qualitatif +\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}% +\newcommand\buildgraphq[1][]{% + \newtoks\toklistepointq\toklistepointq{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}% +}% + +\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% +\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% + +% Pour construire le diagramme circulaire qualitatif +\def\buildgraphcq#1{% + \newtoks\toklistepointq\toklistepointq{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + % + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% +}% + +%% calcul des fr\'equences +\newcommand\CalculFrequence[1]{% + \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} +} + +%% calcul des angles +\newcommand\CalculAngle[1]{% + \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)} +} +\newcommand\CalculSemiAngle[1]{% + \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)} +} + +%% calcul des ECC +\newcount\CompteurECC% +\newcount\CompteurECCTotal% +\newcount\CompteurECCC% +\newcount\CompteurECCCTotal% + +\newcommand\CalculECC[1]{% + \xdef\TotalECC{0}% + \CompteurECC=1% + \CompteurECCTotal=\numexpr#1+1% + \whiledo{\CompteurECC < \CompteurECCTotal}{% + \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}% + \CompteurECC=\numexpr\CompteurECC+1% + }% + \num{\TotalECC}% +} + +\def\NewMPDiagBarreHorCode{% + Longueur:=\useKV[ClesStat]{Longueur}; + Hauteur:=\useKV[ClesStat]{Hauteur}; + Ecart:=\useKV[ClesStat]{EcartBarre}; + ExposantDivMax:=\ExposantDivMax; + ecarthachures=\useKV[ClesStat]{EcartHachures}; + epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide; + Hachures=\useKV[ClesStat]{Hachures}; + Bicolore=\useKV[ClesStat]{Bicolore}; + Grille=\useKV[ClesStat]{Grille}; + AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + vardef CalculNombreDonneesEtDonneeMax(text t)= + nbdon:=0;%nombre de données + DonneeMax:=0;%donnée DonneeMaximale + for p_=t: + nbdon:=nbdon+1; + if p_>DonneeMax: + DonneeMax:=p_; + fi; + endfor; + enddef; + vardef ListeDonnees(text t)= + n:=0; + for p_=t: + n:=n+1; + Donnees[n]:=p_; + endfor; + enddef; + vardef RecuperationCouleurs(text t)= + color Col[]; + n:=0; + for p_=t: + n:=n+1; + Col[n]=p_; + endfor; + enddef; +} + +% Construction d'un diagramme en barres horizontal +\newcommand\NewMPDiagBarreHor[4]{% + % #1 Liste des noms + % #2 Liste des valeurs associées + % #3 Liste des valeurs à afficher (si pb calcul MP) + % #4 Liste des couleurs + \ifluatex% + \mplibforcehmode% + \begin{mplibcode}% + \NewMPDiagBarreHorCode% + vardef TraceDiag= + if Grille: + pair Zz[];%Pour déterminer "le dernier point" + Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz2=(0,(Hauteur+Ecart)); + Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; + if ExposantDivMax=0: + for k=1 upto DonneeMax+1: + trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + else: + for k=1 upto (floor(DonneeMax*10+2)): + trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + fi; + if ExposantDivMax=0: + for k=1 upto (DonneeMax+1): + label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); + endfor; + else: + if ExposantDivMax<5: + for k=1 upto (floor(DonneeMax*10+2)): + label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); + endfor; + else: + dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); + fi; + fi; + fi; + for k=0 upto nbdon-1: + path RectangleDonnee; + RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); + if Hachures: + fill RectangleDonnee withcolor white; + trace Hachurage(RectangleDonnee,60 if + (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures; + else: + remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; + fi; + trace RectangleDonnee; + endfor; + if Grille: + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; + fi; + enddef; + vardef AffichageNom(text t)= + k:=0; + for p_=t: + label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + vardef AffichageDonnees(text t)= + k:=0; + for p_=t: + label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + CalculNombreDonneesEtDonneeMax(#2); + ListeDonnees(#2); + RecuperationCouleurs(#4); + TraceDiag; + if LegendeVide=false: + AffichageNom(#1); + fi; + if AffichageDonnee: + AffichageDonnees(#3); + fi; + \end{mplibcode} + \else% + \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}] + vardef TraceDiag= + if Grille: + pair Zz[];%Pour déterminer "le dernier point" + Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz2=(0,(Hauteur+Ecart)); + Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; + if ExposantDivMax=0: + for k=1 upto DonneeMax+1: + trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + else: + for k=1 upto (floor(DonneeMax*10+2)): + trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + fi; + if ExposantDivMax=0: + for k=1 upto (DonneeMax+1): + label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); + endfor; + else: + if ExposantDivMax<5: + for k=1 upto (floor(DonneeMax*10+2)): + label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); + endfor; + else: + dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); + fi; + fi; + fi; + for k=0 upto nbdon-1: + path RectangleDonnee; + RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); + if Hachures: + fill RectangleDonnee withcolor white; + trace Hachurage(RectangleDonnee,60 if + (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures; + else: + remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; + fi; + trace RectangleDonnee; + endfor; + if Grille: + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; + fi; + enddef; + vardef AffichageNom(text t)= + k:=0; + for p_=t: + label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + vardef AffichageDonnees(text t)= + k:=0; + for p_=t: + label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + CalculNombreDonneesEtDonneeMax(#2); + ListeDonnees(#2); + RecuperationCouleurs(#4); + TraceDiag; + if LegendeVide=false: + AffichageNom(#1); + fi; + if AffichageDonnee: + AffichageDonnees(#3); + fi; + \end{mpost} + \fi% +}% + +\def\MPStatNewCode{% + maxx:=0; + maxy:=0; + unitex:=\useKV[ClesStat]{Unitex}*cm; + unitey:=\useKV[ClesStat]{Unitey}*cm; + xpartorigine:=\useKV[ClesStat]{Origine}; + AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; + boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date; + GrandNombrex=\useKV[ClesStat]{GrandNombrex}; + GrandNombrey=\useKV[ClesStat]{GrandNombrey}; + if GrandNombrex: + GrandNombreA=\useKV[ClesStat]{GrandNombreA}; + fi; + if GrandNombrey: + GrandNombreO=\useKV[ClesStat]{GrandNombreO}; + fi; + Date:=\useKV[ClesStat]{Date}; + Rotation=\useKV[ClesStat]{AbscisseRotation}; + Lecture:=\useKV[ClesStat]{Lecture}; + LectureFine:=\useKV[ClesStat]{LectureFine}; + AideLecture:=\useKV[ClesStat]{AideLecture}; + DonneesSup:=\useKV[ClesStat]{DonneesSup}; + Reponses:=\useKV[ClesStat]{Reponses}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; + Qualitatif=\useKV[ClesStat]{Qualitatif}; + Tiret=\useKV[ClesStat]{Tiret}; + Retour=false; + color CoulDefaut; + CoulDefaut=\useKV[ClesStat]{CouleurDefaut}; + Depart=\useKV[ClesStat]{Depart}; + % + pair A[],B[],P[]; + vardef toto(text t)=%points quantitatif + n:=0; + for p_=t: + if pair p_: + n:=n+1; + P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); + if xpart(p_)>maxx: + maxx:=xpart(p_)-(xpartorigine); + fi; + if ypart(p_)>maxy: + maxy:=ypart(p_); + fi; + A[n]=unitex*(xpart(p_)-(xpartorigine),0); + B[n]=unitey*(0,ypart(p_)); + fi; + endfor; + enddef; + vardef tutu(text t)=%points qualitatif + n:=0; + for p_=t: + if numeric p_: + P[n]=((n)*unitex,unitey*(p_-Depart)); + B[n]=(0,unitey*(p_-Depart)); + if p_>maxy: + maxy:=p_; + fi; + else: + n:=n+1; + A[n]=unitex*(n,0); + fi; + endfor; + maxy:=maxy-Depart; + maxx:=n; + enddef; +} + +% Construction du graphique en bâtons +\newcommand\MPStatNew[3]{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPStatNewCode + % + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#3: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + % + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#2: + n:=n+1; + if color p_: + Col[n]=p_; + else: + Col[n]=CoulDefaut; + fi; + endfor; + vardef tata(text t)=%affichage quantitatif + l=0; + for p_=t: + if pair p_: + l:=l+1; + if Rotation: + if Date: + label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]); + else: + label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); + fi; + else : + if Date: + label.bot(TEX(decimal(xpart(p_))),A[l]); + else: + label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); + fi; + fi; + if Reponses: + if DonneesSup: + Test(l); + if Retour=false: + if GrandNombrey: + label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + else: + label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + fi; + fi; + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]); + fi; + fi; + fi; + fi; + endfor; + enddef; + vardef titi(text t)=%affichage qualitatif + l:=0; + for p_=t: + if numeric p_: + if Reponses: + if DonneesSup: + Test(l); + if Retour=false: + label.top(TEX("\num{"&decimal(p_)&"}"),P[l]); + fi; + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + fi; + fi; + fi; + else: + l:=l+1; + if Rotation: + if AngleRotation<>0: + picture TEXTELABEL; + TEXTELABEL=image( + labeloffset:=labeloffset*2; + label.lft(TEX(p_),A[l]); + labeloffset:=labeloffset/2; + ); + trace rotation(TEXTELABEL,A[l],AngleRotation); + else : + label.bot(TEX(p_),A[l]); + fi; + fi; + fi; + endfor; + enddef; + if Qualitatif: tutu(#1); else: toto(#1); fi; + boolean Grille; + Grille:=\useKV[ClesStat]{Grille}; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + if Grille: + drawoptions(withcolor 0.75white); + for k=0 step Pasx until ((maxx+1)): + trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); + endfor; + for k=0 step Pasy until ((maxy+2*Pasy)): + trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); + endfor; + drawoptions(); + fi; + if epaisseurbatons<>0: + for k=1 upto n: + fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; + if AideLecture: + draw B[k]--P[k] dashed evenly; + fi; + endfor; + fi; + if LectureFine: + for k=0 step Pasy until ((maxy+1*Pasy)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); + else: + label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); + fi; + fi; + endfor; + fi; + if Lecture: + for k=0 step Pasy until Pasy: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); + else: + label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + fi; + endfor; + fi; + drawarrow (0,0)--unitex*(maxx+1,0); + drawarrow (0,0)--unitey*(0,maxy+2*Pasy); + label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); + label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); + if Qualitatif: titi(#1); else:tata(#1); fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPStatNewCode}] + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#2: + n:=n+1; + if color p_: + Col[n]=p_; + else: + Col[n]=CoulDefaut; + fi; + endfor; + % + vardef tata(text t)=%affichage quantitatif + l=0; + for p_=t: + if pair p_: + l:=l+1; + if Rotation: + label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); + else : + label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]); + fi; + if Reponses: + if DonneesSup: + label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]); + fi; + fi; + fi; + fi; + endfor; + enddef; + vardef titi(text t)=%affichage qualitatif + l:=0; + for p_=t: + if numeric p_: + if Reponses: + if DonneesSup: + label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]); + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + fi; + fi; + fi; + else: + l:=l+1; + if Rotation: + if AngleRotation<>0: + picture TEXTELABEL; + TEXTELABEL=image( + labeloffset:=labeloffset*2; + label.lft(LATEX(p_),A[l]); + labeloffset:=labeloffset/2; + ); + trace rotation(TEXTELABEL,A[l],AngleRotation); + else : + label.bot(LATEX(p_),A[l]); + fi; + fi; + fi; + endfor; + enddef; + if Qualitatif: tutu(#1); else: toto(#1); fi; + boolean Grille; + Grille:=\useKV[ClesStat]{Grille}; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + if Grille: + drawoptions(withcolor 0.75white); + for k=0 step Pasx until ((maxx+1)): + trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); + endfor; + for k=0 step Pasy until ((maxy+2*Pasy)): + trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); + endfor; + drawoptions(); + fi; + if epaisseurbatons<>0: + for k=1 upto n: + fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; + if AideLecture: + draw B[k]--P[k] dashed evenly; + fi; + endfor; + fi; + if LectureFine: + for k=0 step Pasy until ((maxy+1*Pasy)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + else: + dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + if Lecture: + for k=0 step Pasy until Pasy: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + else: + dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + drawarrow (0,0)--unitex*(maxx+1,0); + drawarrow (0,0)--unitey*(0,maxy+2*Pasy); + label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); + label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); + if Qualitatif: titi(#1); else:tata(#1); fi; + \end{mpost} + \fi +} + +\def\NewMPStatCirculaireCodeQ{% + Rayon:=\useKV[ClesStat]{Rayon}; + ecarthachures=\useKV[ClesStat]{EcartHachures}; + epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter; + AffichageAngle=\useKV[ClesStat]{AffichageAngle}; + AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; + Hachures=\useKV[ClesStat]{Hachures}; + Inverse=\useKV[ClesStat]{LectureInverse}; + Legende=\useKV[ClesStat]{Legende}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + Retour=false; + ACompleter=\useKV[ClesStat]{ACompleter}; + % + pair A[],O,B[],C[],D[]; + O=(0,0); + n:=0; + numeric total[],ang[]; + total[0]=0; + ang[0]:=0; + path cc; + cc=(fullcircle scaled (2*Rayon)); + vardef AfficheLegende(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(TEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; + vardef AfficheLegendePDF(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(LATEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; +} + +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4{% + %#1 : la liste des données + %#2 : 360 ou 180 + %#3 : liste des couleurs + %#4 : liste des légendes à effacer. + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \NewMPStatCirculaireCodeQ + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + vardef toto(text t)= + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + total[n]:=total[n-1]+p_; + fi; + endfor; + N=n; + for k=1 upto N: + ang[k]=(#2/total[N])*total[k]; + endfor; + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + if Inverse=false: + A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); + else: + A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); + fi; + %hachure ou pas ? + if Hachures=false: + fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: + arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; + else: + draw + Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) + else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; + fi; + if ACompleter=false: + draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; + fi; + % Affichage des angles associ\'es + if AffichageAngle: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fi; + elseif AffichageDonnee: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&"")); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&""))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); + fi; + fi; + fi; + % + fi; + endfor; + if #2=360: + draw cc if Hachures: withpen pencircle scaled2 fi; + else: + draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; + fi; + n:=0; + enddef; + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + Figure(-10u,-10u,10u,10u); + toto(#1); + if Legende: + n:=0; + draw AfficheLegende(#1); + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}] + pair A[],O,B[],C[],D[]; + O=(0,0); + n:=0; + numeric total[],ang[]; + total[0]=0; + ang[0]:=0; + path cc; + cc=(fullcircle scaled (2*Rayon)); + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + vardef toto(text t)= + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + total[n]:=total[n-1]+p_; + fi; + endfor; + N=n; + for k=1 upto N: + ang[k]=(#2/total[N])*total[k]; + endfor; + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + if Inverse=false: + A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); + else: + A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); + fi; + %hachure ou pas ? + if Hachures=false: + fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: + arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; + else: + draw + Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) + else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; + fi; + if ACompleter=false: + draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; + fi; + % Affichage des angles associ\'es + if AffichageAngle: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fi; + elseif AffichageDonnee: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&"")); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&""))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); + fi; + fi; + fi; + % + fi; + endfor; + if #2=360: + draw cc if Hachures: withpen pencircle scaled2 fi; + else: + draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; + fi; + enddef; + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + Figure(-10u,-10u,10u,10u); + toto(#1); + if Legende: + n:=0; + draw AfficheLegendePDF(#1); + fi; + \end{mpost} + \fi +}% + +%Pour la m\'ediane. +\DTLgnewdb{mtdb}% +\dtlexpandnewvalue% +\newcount\nbdonnees% +% +\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}% +\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}% +\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}% +\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}% +\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}% + +\DTLgnewdb{mtdbEE}% +\DTLgnewdb{mtdbEEqual}% +% + +% Pour les classes +% Pour construire l'histogramme +\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}} +\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}} + +\NewDocumentCommand\buildgraphhisto{}{% + \newtoks\toklisteelmtsclasse% + \newtoks\toklistedonhisto% + \newtoks\toklistecouleur% + \newtoks\toklistelegende% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}% + \ifboolKV[ClesStat]{ECC}{% + \toklistedonhisto{}% + \xdef\PfCFooECC{\ListeDepart[1,3]}% + \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{% + \xdef\PfCFooRetiens{0}% + \xintFor* ##2 in{\xintSeq{1}{##1}}\do{% + \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}% + }% + \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}% + }% + \readlist*\PfCListeECC{\PfCFooECC}% + \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}% + }{}% + \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}% + \foreachitem\compteur\in\ListeDepart{% + \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}} + }% + \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}} + % Pour les couleurs + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + % + \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}% +} + +%% calcul des fr\'equences +\newcommand\CalculFrequenceClasses[1]{% + \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} +} + +\newcommand\CalculECCClasses[1]{% + \xdef\TotalECCC{0}% + \CompteurECCC=1% + \CompteurECCCTotal=\numexpr#1+1% + \whiledo{\CompteurECCC < \CompteurECCCTotal}{% + \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}% + \CompteurECCC=\numexpr\CompteurECCC+1% + }% + \num{\TotalECCC}% +} + +\NewDocumentCommand\buildtabclasses{}{% + \setcounter{PfCCompteLignes}{0}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% + \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines] + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body + \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$ + }\\ + \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}% + }\\ + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\ + }{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% +% % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% +% % On retrace le tableau +% % Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% +% % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular} +}% + +\NewDocumentCommand\MPBuildHisto{mmmm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + maxx:=-infinity; + minx:=infinity; + maxy:=-infinity; + miny:=0; + unitex:=\useKV[ClesStat]{Unitex}*cm; + unitey:=\useKV[ClesStat]{Unitey}*cm; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + UniteAire=\useKV[ClesStat]{UniteAire}; + Ecarthachures=\useKV[ClesStat]{EcartHachures}; + Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC; + ECC=\useKV[ClesStat]{ECC}; + Mediane=\useKV[ClesStat]{Mediane}; + MemeAmpli=\useKV[ClesStat]{MemeAmpli}; + Hachures:=\useKV[ClesStat]{Hachures}; + % + Lecture:=\useKV[ClesStat]{Lecture}; + LectureFine:=\useKV[ClesStat]{LectureFine}; + Tiret=\useKV[ClesStat]{Tiret}; + AideLecture:=\useKV[ClesStat]{AideLecture}; + DonneesSup:=\useKV[ClesStat]{DonneesSup}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + Retour=false; + % Test affichage + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + %Affichage ou pas des légendes + vardef AfficheLegende(text t)= + l=0; + for p_=t: + l:=l+1; + if DonneesSup: + Test(l); + if Retour=false: + label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l])); + fi; + fi; + endfor; + enddef; + % on r\'ecup\`ere les couleurs + Depart=\useKV[ClesStat]{DepartHisto}; + color Col[],CoulDefaut; + CoulDefaut=white; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + % + numeric X[]; + numeric ecartabs[]; + vardef RecupValeursAbscisses(text t)= + p:=0; + for p_=t: + p:=p+1; + X[p]:=p_; + if X[p]<minx: + minx:=X[p]; + fi; + if X[p]>maxx: + maxx:=X[p]; + fi; + endfor; + X[0]=X[1]; + TotalAbscisses=p; + enddef; + numeric Y[],Z[]; + numeric EffectifTotal[]; + numeric EffectifTotalA[]; + vardef RecupValeursDonnees(text t)= + p:=0; + EffectifTotal[0]:=0; + EffectifTotalA[0]:=0; + for p_=t: + p:=p+1; + EffectifTotal[p]:=p_; + EffectifTotalA[p]:=EffectifTotalA[p-1]+p_; + Y[p]:=p_; + Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx)); + R[p]=ceiling(Z[p]); + if R[p]>maxy: + maxy:=R[p]; + fi; + endfor; + NbDonnees:=p; + enddef; + %On affiche la médiane dans le cas des ECC + vardef AfficheMedianeECC(text t)= + YMed:=Z[NbDonnees]/2; + DemiDonnees:=EffectifTotal[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotal[p]>DemiDonnees; + endfor; + path MedHor,MedLineaire,MedVer; + MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]); + MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed)); + MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor); + draw MedLineaire; + draw MedHor; + draw MedVer; + enddef; + % On affiche la médiane dans le cas non ECC + vardef AfficheMediane(text t)= + DemiDonnees:=EffectifTotalA[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotalA[p]>DemiDonnees; + endfor; + path MedVer; + numeric CoefLineaire,pMed; + pMed=p; + CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p]; + MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]); + draw MedVer dashed evenly; + enddef; + % On commence le tracé : on récupère les informations + RecupValeursAbscisses(#1); + RecupValeursDonnees(#2); + % on définit une grille + vardef Grille= + if MemeAmpli: + Ajout:=1; + else: + Ajout:=3; + fi; + drawoptions(withcolor 0.7white); + for k=0 upto ((maxx-minx)/Pasx+2): + trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red; + endfor; + for k=0 upto (maxy+Ajout): + trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue; + endfor; + drawoptions(); + enddef; + % Fin Grille + % On trace les rectangles + vardef AfficheRectangles= + if Hachures: + Grille; + for k=2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + else: + for k=2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi; + endfor; + Grille; + for k=2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + fi; + enddef; + % Affichage final + if ECC: + AfficheRectangles; + if Mediane: + AfficheMedianeECC(#2); + fi; + else: + if Mediane: + AfficheMediane(#2); + if Hachures: + Grille; + %Partie gauche + for k=2 step 2 until (2*pMed-2): + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0); + draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])); + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1); + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + else: + %Partie gauche + for k=2 step 2 until (2*pMed-2): + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ; + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + Grille; + %Partie Gauche + for k=2 step 2 until (2*pMed-2): + trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx)))); + for k=2*pMed+2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + fi; + draw MedVer withpen pencircle scaled 2; + else: + AfficheRectangles; + fi; + fi; + %Affichage ou pas des axes, de la médiane + if MemeAmpli: + drawarrow (0,0)--unitey*(0,maxy+1); + EcartAmpli:=(X[2]-X[1])/Pasx; + if AideLecture: + for k=2 step 2 until TotalAbscisses: + trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly; + endfor; + fi; + if LectureFine: + for k=0 upto ((maxy+1)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + if Lecture: + for k=0 upto 1: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + else:%Pas même ampli : on n'affiche pas l'axe vertical + trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0); + trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))); + label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5))); +% if Mediane: +% AfficheMediane(#2); +% fi; + fi; + % On trace l'axe des abscisses + drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0); + %On labelise l'axe des abscisses + dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0)); + for k=2 step 2 until TotalAbscisses: + dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0)); + endfor; + label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0)); + %On affiche les données sup ou pas. + AfficheLegende(#2); + \end{mplibcode} + \fi +} +% + +\newcommand\Stat[2][]{% + \useKVdefault[ClesStat]% + \setKV[ClesStat]{#1}% + \setsepchar[*]{,*/}% + \readlist*\ListeAvantUtilisation{#2}% + \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}% + \ifboolKV[ClesStat]{Classes}{% + \setsepchar[*]{,*/}% + \readlist*\ListeDepart{#2}% + \xdef\EffectifTotal{0}% + \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}% + }% + \ifboolKV[ClesStat]{Histogramme}{% + \buildgraphhisto% + }{% + \ifboolKV[ClesStat]{Tableau}{% + \buildtabclasses% + }{}% + }% + }{% + \setsepchar{,}% + \ifboolKV[ClesStat]{Representation}{% + \setKV[TraceG]{Xmin=0,Ymin=0}% + \setKV[TraceG]{#1}% + \readlist*\ListePointsPlaces{#2}% + \newtoks\toklistepoint% + \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% + \MPPlacePoint[#1]{\the\toklistepoint}% + }{% + \ifboolKV[ClesStat]{Liste}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#2}% + \xdef\foo{}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% + \xdef\foo{\foo 1/\Liste[##1],}% + }% + \readlist*\ListeComplete{\foo}% + \setKV[ClesStat]{Qualitatif}% + }{% + \ifboolKV[ClesStat]{Sondage}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#2}% + % "liste vide" + \newtoks\tabtoksEEa% + \tabtoksEEa{}% + % + % "liste vide" + \newtoks\tabtoksEEb% + \tabtoksEEb{}% + % + \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide + % + \newcount\cmptEE% + \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif + \PasNumEE=0\relax% + \DTLcleardb{mtdbEE}% + % on range les resultats du sondage par ordre croissant. + \foreachitem\x\in\Liste{% + \DTLnewrow{mtdbEE}% + \DTLnewdbentry{mtdbEE}{Numeric}{\x}% + }% + \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% + \DTLforeach{mtdbEE}{\nba=Numeric}{% + \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% + \cmptEE=0\relax% + \foreachitem\nbb\in\ListeSansDoublonsEE{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \ifthenelse{\equal{\the\cmptEE}{0}}{% + \expandafter\AjoutListEEb\nba\nil% + \xdef\listEEa{\the\tabtoksEEb}% + \ignoreemptyitems% + \setsepchar{,}% + \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements + %%% identiques de Liste + }{}% + }% + \foreachitem\nba\in\ListeSansDoublonsEE{% + \cmptEE=0\relax% + \DTLforeach{mtdbEE}{\nbb=Numeric}{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \expandafter\AjoutListEEab\nba\nil% + \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements + %%% identiques de Liste + }% + \xdef\listEEb{\the\tabtoksEEa} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEEb% + % + \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% + }{% + \ifboolKV[ClesStat]{Qualitatif}{% + % % on lit la liste \'ecrite sous la forme valeur/effectif + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }{% Dans le qualitatif, on trie d'abord les valeurs. + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }}}% + % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif + \DTLcleardb{mtdb}% + % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr + \foreachitem\x\in\ListeComplete{% + \DTLnewrow{mtdb}% + \itemtomacro\ListeComplete[\xcnt,2]\y% + \DTLnewdbentry{mtdb}{Numeric}{\y}% + }% + \dtlsort{Numeric}{mtdb}{\dtlicompare}% + % % on r\'einitialise les valeurs des crit\`eres de position et de + % dispersion + \renewcommand\NbDonnees{}% + \renewcommand\SommeDonnees{}% + \renewcommand\EffectifTotal{}% + \renewcommand\Moyenne{}% + \renewcommand\Etendue{}% + \renewcommand\Mediane{}% + \renewcommand\DonneeMax{0}% + \renewcommand\EffectifMax{0}% + \renewcommand\DonneeMin{999999999}% + \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif + % Calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \ifboolKV[ClesStat]{EffectifTotal}{% + \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est + \num{\ListeCompletelen}.\par}{% + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in + {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} + }{}% + \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% + \ifboolKV[ClesStat]{Moyenne}{% + \ifboolKV[ClesStat]{Liste}{% + La somme des donn\'ees de la s\'erie est :% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]% + }% + \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% + Donc la moyenne de la s\'erie est \'egale \`a :% + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} + \ifboolKV[ClesStat]{ValeurExacte}{}{% + \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% + \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% + \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% + \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + }% + \]% + }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,2]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,2]}% + }{}% + }% + \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% + \ifboolKV[ClesStat]{Etendue}{% + \ifboolKV[ClesStat]{Liste}{% + L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % celui de la mediane + %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% + \newcount\Recapmed% + \newcount\Recapmeda% + \ifodd\number\ListeCompletelen%odd impair + \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% + \else% + \Recapmed=\fpeval{\ListeCompletelen/2}\relax% + \Recapmeda=\numexpr\Recapmed+1\relax% + \fi% + \newcount\Recapk% + \Recapk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% + \ifnum\Recapk=\Recapmed% + \ifodd\number\ListeCompletelen% + \xdef\Mediane{\numeroDonnee}% + \else% + \xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\Recapk=\Recapmeda% + \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% + \fi% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + \ifboolKV[ClesStat]{Liste}{% + On range les donn\'ees par ordre croissant :% + \nbdonnees=0% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% + }{% + \medskip% + \begin{center} + \begin{minipage}{0.9\linewidth} + \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; + }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} + \end{minipage} + \end{center}% + \medskip% + }% + \newcount\med% + \newcount\meda% + \ifodd\number\ListeCompletelen%odd impair + \med=\fpeval{(\ListeCompletelen+1)/2}\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ + \else% pair + \med=\fpeval{\ListeCompletelen/2}\relax% + \meda=\numexpr\med+1\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ + \fi% + \newcount\k% + \k=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% + \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi + \ifodd\number\ListeCompletelen% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \xdef\Mediane{\numeroDonnee}% + \else% + La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\k=\meda + La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% + %%%%%%% + }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\numeroDonnee}% + \fi% + }% + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% + \fi% + \newcount\PfCQtroisk% + \PfCQtroisk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi + \xdef\QuartileTrois{\numeroDonnee}% + \fi% + }% + % Construction du tableau + \ifboolKV[ClesStat]{Tableau}{% + \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% + % Construction du graphique + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% + \ifboolKV[ClesStat]{Barre}{% + \buildgraphbarhor% + }{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraphq[#1]% + }% + }% + }% + }% + }{}% + }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif + % % on effectue les calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,1]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,1]}% + }{}% + }% + % \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% + \ifboolKV[ClesStat]{EffectifTotal}{% + L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in + {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] + }{}% + \ifboolKV[ClesStat]{Moyenne}{% + La somme des donn\'ees de la s\'erie est :% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[ + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }{% + \[ + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }% + \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% + \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% + \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]} + }=\num{\EffectifTotal} + \]% + }% + }% + Donc la moyenne de la s\'erie est \'egale \`a :% + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% + \ifboolKV[ClesStat]{ValeurExacte}{}{% + \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% + \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% + \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% + \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + }% + \]% + }{}% + % % Affichage des r\'eponses. + % %% pour l'\'etendue + \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% + % pour la m\'ediane + %%% Recuperation Mediane + \newcount\Recupmed% + \newcount\Recupmeda% + \ifodd\number\EffectifTotal%odd impair + \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% + \else% pair + \Recupmed=\fpeval{\EffectifTotal/2}\relax% + \Recupmeda=\numexpr\Recupmed+1\relax% + \fi% + \newcount\Recupk% + \Recupk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \Recupk=\numexpr\Recupk+1\relax% + \ifnum\Recupk=\Recupmed% + \ifodd\number\EffectifTotal% + \xdef\Mediane{\ListeComplete[##1,1]}% + \else% + \xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\Recupk=\Recupmeda% + \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% + \fi% + }% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + + \newcount\med% + \newcount\meda% + \ifodd\number\EffectifTotal%odd impair + \med=\fpeval{(\EffectifTotal+1)/2}\relax% + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % + \else% pair + \med=\fpeval{\EffectifTotal/2}\relax% + \meda=\numexpr\med+1\relax% + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % + \fi% + \newcount\k% + \k=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \k=\numexpr\k+1\relax% + \ifnum\k=\med% + \ifodd\number\EffectifTotal% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \else% + La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\k=\meda% + La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% + }% + }{}% + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\EffectifTotal/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\ListeComplete[##1,1]}% + \fi% + }% + }% + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% + \fi% + \newcount\PfCQtroisk% + \PfCQtroisk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois% + \xdef\QuartileTrois{\ListeComplete[##1,1]}% + \fi% + }% + }% + % Construction de tableau + \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% + % Construction du graphique ?? + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraph[#1]% + }% + }% + }{}% + }% + }% + }% +}%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex new file mode 100644 index 00000000000..72a33f9dd4e --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex @@ -0,0 +1,2109 @@ +%%% +% Statistiques +%%% +\newcommand\NbDonnees{}% +\newcommand\SommeDonnees{}% +\newcommand\EffectifTotal{}% +\newcommand\Moyenne{}% +\newcommand\Etendue{}% +\newcommand\Mediane{}% +\newcommand\DonneeMax{}% +\newcommand\DonneeMin{}% +\newcommand\EffectifMax{}% +\newcommand\PfCArticleMediane{la}% + +\setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,% +FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,% +Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,% +Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% +Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% +% Pour les diags batons +EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,% +% Pour les diags circulaires +Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,% +%Pour les représentations +Representation=false,% +%Pour les barres horizontales +Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo +% Pour les histogrammes +Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% +}% +%compl\'ements +\defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}% +\defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}% +\defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}% +\defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}% +\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}% +\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}% +% La construction du tableau +\def\addtotok#1#2{#1\expandafter{\the#1#2}}% +\newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc% +\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}% +% +\newcounter{PfCCompteLignes}% +% +\def\BuildtabStat{% %%Tableau sans/avec total + \setcounter{PfCCompteLignes}{0}% + \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}% + \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% + \ifboolKV[ClesStat]{Total}{% + \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body% + \the\tabtoksa&Total\\% + \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\% + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}% + \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}% + \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% + % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% + % On retrace le tableau + %Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% + % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular}% + }{% + \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body% + \the\tabtoksa\\% + \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\% + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}% + \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}% + \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% + % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% + % On retrace le tableau + %Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% + % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular}% + }% +}% + +% Pour construire le diagramme en barres horizontales +\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}% + +\newcommand\buildgraphbarhor{% + \newtoks\toklistenomhor% + \newtoks\toklistedonhor% + \newtoks\toklisteaffhor% + \newtoks\toklistecouleur% + \xdef\PfCfooStat{}% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}% + }% + \xdef\DivMax{\fpeval{max(\PfCfooStat)}}% + \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}% + \xdef\DivMax{\fpeval{10**\ExposantDivMax}}% + \xdef\PfCfooStat{}% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}% + }% + \readlist*\ListeCompleteDiagHor{\PfCfooStat}% + \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}% +}% + +% Pour construire le diagramme en bâtons +\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}% +\newcommand\buildgraph[1][]{% + \newtoks\toklistepoint\toklistepoint{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende} +}% + +% Pour construire le diagramme en bâtons qualitatif +\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}% +\newcommand\buildgraphq[1][]{% + \newtoks\toklistepointq\toklistepointq{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}% +}% + +\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% +\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% + +% Pour construire le diagramme circulaire qualitatif +\def\buildgraphcq#1{% + \newtoks\toklistepointq\toklistepointq{}% + \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklistelegende\toklistelegende{}% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + % + \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% +}% + +%% calcul des fr\'equences +\newcommand\CalculFrequence[1]{% + \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} +} + +%% calcul des angles +\newcommand\CalculAngle[1]{% + \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)} +} +\newcommand\CalculSemiAngle[1]{% + \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)} +} + +%% calcul des ECC +\newcount\CompteurECC% +\newcount\CompteurECCTotal% +\newcount\CompteurECCC% +\newcount\CompteurECCCTotal% + +\newcommand\CalculECC[1]{% + \xdef\TotalECC{0}% + \CompteurECC=1% + \CompteurECCTotal=\numexpr#1+1% + \whiledo{\CompteurECC < \CompteurECCTotal}{% + \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}% + \CompteurECC=\numexpr\CompteurECC+1% + }% + \num{\TotalECC}% +} + +\def\NewMPDiagBarreHorCode{% + Longueur:=\useKV[ClesStat]{Longueur}; + Hauteur:=\useKV[ClesStat]{Hauteur}; + Ecart:=\useKV[ClesStat]{EcartBarre}; + ExposantDivMax:=\ExposantDivMax; + ecarthachures=\useKV[ClesStat]{EcartHachures}; + epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide; + Hachures=\useKV[ClesStat]{Hachures}; + Bicolore=\useKV[ClesStat]{Bicolore}; + Grille=\useKV[ClesStat]{Grille}; + AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + vardef CalculNombreDonneesEtDonneeMax(text t)= + nbdon:=0;%nombre de données + DonneeMax:=0;%donnée DonneeMaximale + for p_=t: + nbdon:=nbdon+1; + if p_>DonneeMax: + DonneeMax:=p_; + fi; + endfor; + enddef; + vardef ListeDonnees(text t)= + n:=0; + for p_=t: + n:=n+1; + Donnees[n]:=p_; + endfor; + enddef; + vardef RecuperationCouleurs(text t)= + color Col[]; + n:=0; + for p_=t: + n:=n+1; + Col[n]=p_; + endfor; + enddef; +} + +% Construction d'un diagramme en barres horizontal +\newcommand\NewMPDiagBarreHor[4]{% + % #1 Liste des noms + % #2 Liste des valeurs associées + % #3 Liste des valeurs à afficher (si pb calcul MP) + % #4 Liste des couleurs + \ifluatex% + \mplibforcehmode% + \begin{mplibcode}% + \NewMPDiagBarreHorCode% + vardef TraceDiag= + if Grille: + pair Zz[];%Pour déterminer "le dernier point" + Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz2=(0,(Hauteur+Ecart)); + Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; + if ExposantDivMax=0: + for k=1 upto DonneeMax+1: + trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + else: + for k=1 upto (floor(DonneeMax*10+2)): + trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + fi; + if ExposantDivMax=0: + for k=1 upto (DonneeMax+1): + label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); + endfor; + else: + if ExposantDivMax<5: + for k=1 upto (floor(DonneeMax*10+2)): + label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); + endfor; + else: + dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); + fi; + fi; + fi; + for k=0 upto nbdon-1: + path RectangleDonnee; + RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); + if Hachures: + fill RectangleDonnee withcolor white; + trace Hachurage(RectangleDonnee,60 if + (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures; + else: + remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; + fi; + trace RectangleDonnee; + endfor; + if Grille: + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; + fi; + enddef; + vardef AffichageNom(text t)= + k:=0; + for p_=t: + label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + vardef AffichageDonnees(text t)= + k:=0; + for p_=t: + label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + CalculNombreDonneesEtDonneeMax(#2); + ListeDonnees(#2); + RecuperationCouleurs(#4); + TraceDiag; + if LegendeVide=false: + AffichageNom(#1); + fi; + if AffichageDonnee: + AffichageDonnees(#3); + fi; + \end{mplibcode} + \else% + \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}] + vardef TraceDiag= + if Grille: + pair Zz[];%Pour déterminer "le dernier point" + Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz2=(0,(Hauteur+Ecart)); + Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); + Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; + if ExposantDivMax=0: + for k=1 upto DonneeMax+1: + trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + else: + for k=1 upto (floor(DonneeMax*10+2)): + trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; + endfor; + fi; + if ExposantDivMax=0: + for k=1 upto (DonneeMax+1): + label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); + endfor; + else: + if ExposantDivMax<5: + for k=1 upto (floor(DonneeMax*10+2)): + label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); + endfor; + else: + dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); + fi; + fi; + fi; + for k=0 upto nbdon-1: + path RectangleDonnee; + RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); + if Hachures: + fill RectangleDonnee withcolor white; + trace Hachurage(RectangleDonnee,60 if + (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures; + else: + remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; + fi; + trace RectangleDonnee; + endfor; + if Grille: + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; + drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; + fi; + enddef; + vardef AffichageNom(text t)= + k:=0; + for p_=t: + label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + vardef AffichageDonnees(text t)= + k:=0; + for p_=t: + label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); + k:=k+1; + endfor; + enddef; + CalculNombreDonneesEtDonneeMax(#2); + ListeDonnees(#2); + RecuperationCouleurs(#4); + TraceDiag; + if LegendeVide=false: + AffichageNom(#1); + fi; + if AffichageDonnee: + AffichageDonnees(#3); + fi; + \end{mpost} + \fi% +}% + +\def\MPStatNewCode{% + maxx:=0; + maxy:=0; + unitex:=\useKV[ClesStat]{Unitex}*cm; + unitey:=\useKV[ClesStat]{Unitey}*cm; + xpartorigine:=\useKV[ClesStat]{Origine}; + AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; + boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date; + GrandNombrex=\useKV[ClesStat]{GrandNombrex}; + GrandNombrey=\useKV[ClesStat]{GrandNombrey}; + if GrandNombrex: + GrandNombreA=\useKV[ClesStat]{GrandNombreA}; + fi; + if GrandNombrey: + GrandNombreO=\useKV[ClesStat]{GrandNombreO}; + fi; + Date:=\useKV[ClesStat]{Date}; + Rotation=\useKV[ClesStat]{AbscisseRotation}; + Lecture:=\useKV[ClesStat]{Lecture}; + LectureFine:=\useKV[ClesStat]{LectureFine}; + AideLecture:=\useKV[ClesStat]{AideLecture}; + DonneesSup:=\useKV[ClesStat]{DonneesSup}; + Reponses:=\useKV[ClesStat]{Reponses}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; + Qualitatif=\useKV[ClesStat]{Qualitatif}; + Tiret=\useKV[ClesStat]{Tiret}; + Retour=false; + color CoulDefaut; + CoulDefaut=\useKV[ClesStat]{CouleurDefaut}; + Depart=\useKV[ClesStat]{Depart}; + % + pair A[],B[],P[]; + vardef toto(text t)=%points quantitatif + n:=0; + for p_=t: + if pair p_: + n:=n+1; + P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); + if xpart(p_)>maxx: + maxx:=xpart(p_)-(xpartorigine); + fi; + if ypart(p_)>maxy: + maxy:=ypart(p_); + fi; + A[n]=unitex*(xpart(p_)-(xpartorigine),0); + B[n]=unitey*(0,ypart(p_)); + fi; + endfor; + enddef; + vardef tutu(text t)=%points qualitatif + n:=0; + for p_=t: + if numeric p_: + P[n]=((n)*unitex,unitey*(p_-Depart)); + B[n]=(0,unitey*(p_-Depart)); + if p_>maxy: + maxy:=p_; + fi; + else: + n:=n+1; + A[n]=unitex*(n,0); + fi; + endfor; + maxy:=maxy-Depart; + maxx:=n; + enddef; +} + +% Construction du graphique en bâtons +\newcommand\MPStatNew[3]{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPStatNewCode + % + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#3: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + % + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#2: + n:=n+1; + if color p_: + Col[n]=p_; + else: + Col[n]=CoulDefaut; + fi; + endfor; + vardef tata(text t)=%affichage quantitatif + l=0; + for p_=t: + if pair p_: + l:=l+1; + if Rotation: + if Date: + label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]); + else: + label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); + fi; + else : + if Date: + label.bot(TEX(decimal(xpart(p_))),A[l]); + else: + label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); + fi; + fi; + if Reponses: + if DonneesSup: + Test(l); + if Retour=false: + if GrandNombrey: + label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + else: + label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + fi; + fi; + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]); + fi; + fi; + fi; + fi; + endfor; + enddef; + vardef titi(text t)=%affichage qualitatif + l:=0; + for p_=t: + if numeric p_: + if Reponses: + if DonneesSup: + Test(l); + if Retour=false: + label.top(TEX("\num{"&decimal(p_)&"}"),P[l]); + fi; + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); + fi; + fi; + fi; + else: + l:=l+1; + if Rotation: + if AngleRotation<>0: + picture TEXTELABEL; + TEXTELABEL=image( + labeloffset:=labeloffset*2; + label.lft(TEX(p_),A[l]); + labeloffset:=labeloffset/2; + ); + trace rotation(TEXTELABEL,A[l],AngleRotation); + else : + label.bot(TEX(p_),A[l]); + fi; + fi; + fi; + endfor; + enddef; + if Qualitatif: tutu(#1); else: toto(#1); fi; + boolean Grille; + Grille:=\useKV[ClesStat]{Grille}; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + if Grille: + drawoptions(withcolor 0.75white); + for k=0 step Pasx until ((maxx+1)): + trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); + endfor; + for k=0 step Pasy until ((maxy+2*Pasy)): + trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); + endfor; + drawoptions(); + fi; + if epaisseurbatons<>0: + for k=1 upto n: + fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; + if AideLecture: + draw B[k]--P[k] dashed evenly; + fi; + endfor; + fi; + if LectureFine: + for k=0 step Pasy until ((maxy+1*Pasy)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); + else: + label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); + fi; + fi; + endfor; + fi; + if Lecture: + for k=0 step Pasy until Pasy: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + if GrandNombrey: + label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); + else: + label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + else: + if GrandNombrey: + dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + fi; + endfor; + fi; + drawarrow (0,0)--unitex*(maxx+1,0); + drawarrow (0,0)--unitey*(0,maxy+2*Pasy); + label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); + label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); + if Qualitatif: titi(#1); else:tata(#1); fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPStatNewCode}] + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#2: + n:=n+1; + if color p_: + Col[n]=p_; + else: + Col[n]=CoulDefaut; + fi; + endfor; + % + vardef tata(text t)=%affichage quantitatif + l=0; + for p_=t: + if pair p_: + l:=l+1; + if Rotation: + label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); + else : + label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]); + fi; + if Reponses: + if DonneesSup: + label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]); + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]); + fi; + fi; + fi; + fi; + endfor; + enddef; + vardef titi(text t)=%affichage qualitatif + l:=0; + for p_=t: + if numeric p_: + if Reponses: + if DonneesSup: + label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]); + else: + if Tiret: + trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); + label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + else: + dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); + fi; + fi; + fi; + else: + l:=l+1; + if Rotation: + if AngleRotation<>0: + picture TEXTELABEL; + TEXTELABEL=image( + labeloffset:=labeloffset*2; + label.lft(LATEX(p_),A[l]); + labeloffset:=labeloffset/2; + ); + trace rotation(TEXTELABEL,A[l],AngleRotation); + else : + label.bot(LATEX(p_),A[l]); + fi; + fi; + fi; + endfor; + enddef; + if Qualitatif: tutu(#1); else: toto(#1); fi; + boolean Grille; + Grille:=\useKV[ClesStat]{Grille}; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + if Grille: + drawoptions(withcolor 0.75white); + for k=0 step Pasx until ((maxx+1)): + trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); + endfor; + for k=0 step Pasy until ((maxy+2*Pasy)): + trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); + endfor; + drawoptions(); + fi; + if epaisseurbatons<>0: + for k=1 upto n: + fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; + if AideLecture: + draw B[k]--P[k] dashed evenly; + fi; + endfor; + fi; + if LectureFine: + for k=0 step Pasy until ((maxy+1*Pasy)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + else: + dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + if Lecture: + for k=0 step Pasy until Pasy: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + else: + dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + drawarrow (0,0)--unitex*(maxx+1,0); + drawarrow (0,0)--unitey*(0,maxy+2*Pasy); + label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); + label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); + if Qualitatif: titi(#1); else:tata(#1); fi; + \end{mpost} + \fi +} + +\def\NewMPStatCirculaireCodeQ{% + Rayon:=\useKV[ClesStat]{Rayon}; + ecarthachures=\useKV[ClesStat]{EcartHachures}; + epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter; + AffichageAngle=\useKV[ClesStat]{AffichageAngle}; + AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; + Hachures=\useKV[ClesStat]{Hachures}; + Inverse=\useKV[ClesStat]{LectureInverse}; + Legende=\useKV[ClesStat]{Legende}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + Retour=false; + ACompleter=\useKV[ClesStat]{ACompleter}; + % + pair A[],O,B[],C[],D[]; + O=(0,0); + n:=0; + numeric total[],ang[]; + total[0]=0; + ang[0]:=0; + path cc; + cc=(fullcircle scaled (2*Rayon)); + % + vardef AfficheLegende(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(TEX(p_),D[n]);fi; + fi; + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(TEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; + vardef AfficheLegendePDF(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if (xpart(C[n])>xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(LATEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; +} + +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4{% + %#1 : la liste des données + %#2 : 360 ou 180 + %#3 : liste des couleurs + %#4 : liste des légendes à effacer. + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \NewMPStatCirculaireCodeQ + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + vardef toto(text t)= + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + total[n]:=total[n-1]+p_; + fi; + endfor; + N=n; + for k=1 upto N: + ang[k]=(#2/total[N])*total[k]; + endfor; + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + if Inverse=false: + A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); + else: + A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); + fi; + %hachure ou pas ? + if Hachures=false: + fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: + arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; + else: + draw + Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) + else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; + fi; + if ACompleter=false: + draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; + fi; + % Affichage des angles associ\'es + if AffichageAngle: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fi; + elseif AffichageDonnee: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&"")); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&""))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); + fi; + fi; + fi; + % + fi; + endfor; + if #2=360: + draw cc if Hachures: withpen pencircle scaled2 fi; + else: + draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; + fi; + n:=0; + enddef; + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + Figure(-10u,-10u,10u,10u); + toto(#1); + if Legende: + n:=0; + draw AfficheLegende(#1); + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}] + pair A[],O,B[],C[],D[]; + O=(0,0); + n:=0; + numeric total[],ang[]; + total[0]=0; + ang[0]:=0; + path cc; + cc=(fullcircle scaled (2*Rayon)); + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + vardef toto(text t)= + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + total[n]:=total[n-1]+p_; + fi; + endfor; + N=n; + for k=1 upto N: + ang[k]=(#2/total[N])*total[k]; + endfor; + n:=0; + for p_=t: + if numeric p_: + n:=n+1; + if Inverse=false: + A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); + else: + A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); + fi; + %hachure ou pas ? + if Hachures=false: + fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: + arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; + else: + draw + Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) + else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) + withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; + fi; + if ACompleter=false: + draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; + fi; + % Affichage des angles associ\'es + if AffichageAngle: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); + fi; + fi; + elseif AffichageDonnee: + if round(p_*(#2/total[N]))>15: + if (n mod 2)=0: + marque_a:=20*0.75*Rayon/cm; + else: + marque_a:=20*0.5*Rayon/cm; + fi; + if Hachures: + if Inverse=false: + undraw + Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&"")); + else: + undraw + Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); + fi; + fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor + blanc; + fi; + if Inverse=false: + draw + Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&""))))); + else: + draw + Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); + fi; + fi; + fi; + % + fi; + endfor; + if #2=360: + draw cc if Hachures: withpen pencircle scaled2 fi; + else: + draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; + fi; + enddef; + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + Figure(-10u,-10u,10u,10u); + toto(#1); + if Legende: + n:=0; + draw AfficheLegendePDF(#1); + fi; + \end{mpost} + \fi +}% + +%Pour la m\'ediane. +\DTLgnewdb{mtdb}% +\dtlexpandnewvalue% +\newcount\nbdonnees% +% +\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}% +\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}% +\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}% +\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}% +\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}% + +\DTLgnewdb{mtdbEE}% +\DTLgnewdb{mtdbEEqual}% +% + +% Pour les classes +% Pour construire l'histogramme +\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}} +\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}} + +\NewDocumentCommand\buildgraphhisto{}{% + \newtoks\toklisteelmtsclasse% + \newtoks\toklistedonhisto% + \newtoks\toklistecouleur% + \newtoks\toklistelegende% + \ifboolKV[ClesStat]{LegendeVide}{% + \xdef\foo{\useKV[ClesStat]{LegendesVides}}% + \readlist*\ListeLegendesAEffacer{\foo}% + }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% + }% + \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% + \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}% + \ifboolKV[ClesStat]{ECC}{% + \toklistedonhisto{}% + \xdef\PfCFooECC{\ListeDepart[1,3]}% + \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{% + \xdef\PfCFooRetiens{0}% + \xintFor* ##2 in{\xintSeq{1}{##1}}\do{% + \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}% + }% + \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}% + }% + \readlist*\PfCListeECC{\PfCFooECC}% + \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}% + }{}% + \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}% + \foreachitem\compteur\in\ListeDepart{% + \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}} + }% + \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}} + % Pour les couleurs + \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% + \readlist*\ListeCouleur{\ListeAvantCouleurs}% + \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% + % + \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}% +} + +%% calcul des fr\'equences +\newcommand\CalculFrequenceClasses[1]{% + \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} +} + +\newcommand\CalculECCClasses[1]{% + \xdef\TotalECCC{0}% + \CompteurECCC=1% + \CompteurECCCTotal=\numexpr#1+1% + \whiledo{\CompteurECCC < \CompteurECCCTotal}{% + \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}% + \CompteurECCC=\numexpr\CompteurECCC+1% + }% + \num{\TotalECCC}% +} + +\NewDocumentCommand\buildtabclasses{}{% + \setcounter{PfCCompteLignes}{0}% + \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% + \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines] + \CodeBefore% + \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% + \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% + \Body + \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$ + }\\ + \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}% + }\\ + \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\ + }{}% + \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}% + \CodeAfter% + % On crée la liste des colonnes à vider + \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% + \xdef\FooStat{\useKV[ClesStat]{ColVide}}% + \setsepchar{,}% + \readlist*\ListeColonnesAVider{\FooStat}% + \foreachitem\compteur\in\ListeColonnesAVider{% + \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% + }% + }{}% +% % On crée la liste des cases à vider + \ifboolKV[ClesStat]{CaseVide}{% + \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% + \setsepchar[*]{,*/}% + \readlist*\ListeCasesAVider{\FooStatCases}% + \foreachitem\compteur\in\ListeCasesAVider{% + \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% + }% + }{}% +% % On retrace le tableau +% % Les colonnes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{% + \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% + }% +% % Les lignes + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% + \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% + }% + \end{NiceTabular} +}% + +\NewDocumentCommand\MPBuildHisto{mmmm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + maxx:=-infinity; + minx:=infinity; + maxy:=-infinity; + miny:=0; + unitex:=\useKV[ClesStat]{Unitex}*cm; + unitey:=\useKV[ClesStat]{Unitey}*cm; + Pasx:=\useKV[ClesStat]{Pasx}; + Pasy:=\useKV[ClesStat]{Pasy}; + UniteAire=\useKV[ClesStat]{UniteAire}; + Ecarthachures=\useKV[ClesStat]{EcartHachures}; + Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; + boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC; + ECC=\useKV[ClesStat]{ECC}; + Mediane=\useKV[ClesStat]{Mediane}; + MemeAmpli=\useKV[ClesStat]{MemeAmpli}; + Hachures:=\useKV[ClesStat]{Hachures}; + % + Lecture:=\useKV[ClesStat]{Lecture}; + LectureFine:=\useKV[ClesStat]{LectureFine}; + Tiret=\useKV[ClesStat]{Tiret}; + AideLecture:=\useKV[ClesStat]{AideLecture}; + DonneesSup:=\useKV[ClesStat]{DonneesSup}; + LegendeVide=\useKV[ClesStat]{LegendeVide}; + Retour=false; + % Test affichage + vardef Test(expr nb)= + Retour:=false; + op:=0; + for l_=#4: + if l_=nb: + op:=op+1; + fi; + endfor; + if op>0: + Retour:=true; + fi; + enddef; + %Affichage ou pas des légendes + vardef AfficheLegende(text t)= + l=0; + for p_=t: + l:=l+1; + if DonneesSup: + Test(l); + if Retour=false: + label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l])); + fi; + fi; + endfor; + enddef; + % on r\'ecup\`ere les couleurs + Depart=\useKV[ClesStat]{DepartHisto}; + color Col[],CoulDefaut; + CoulDefaut=white; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + % + numeric X[]; + numeric ecartabs[]; + vardef RecupValeursAbscisses(text t)= + p:=0; + for p_=t: + p:=p+1; + X[p]:=p_; + if X[p]<minx: + minx:=X[p]; + fi; + if X[p]>maxx: + maxx:=X[p]; + fi; + endfor; + X[0]=X[1]; + TotalAbscisses=p; + enddef; + numeric Y[],Z[]; + numeric EffectifTotal[]; + numeric EffectifTotalA[]; + vardef RecupValeursDonnees(text t)= + p:=0; + EffectifTotal[0]:=0; + EffectifTotalA[0]:=0; + for p_=t: + p:=p+1; + EffectifTotal[p]:=p_; + EffectifTotalA[p]:=EffectifTotalA[p-1]+p_; + Y[p]:=p_; + Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx)); + R[p]=ceiling(Z[p]); + if R[p]>maxy: + maxy:=R[p]; + fi; + endfor; + NbDonnees:=p; + enddef; + %On affiche la médiane dans le cas des ECC + vardef AfficheMedianeECC(text t)= + YMed:=Z[NbDonnees]/2; + DemiDonnees:=EffectifTotal[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotal[p]>DemiDonnees; + endfor; + path MedHor,MedLineaire,MedVer; + MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]); + MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed)); + MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor); + draw MedLineaire; + draw MedHor; + draw MedVer; + enddef; + % On affiche la médiane dans le cas non ECC + vardef AfficheMediane(text t)= + DemiDonnees:=EffectifTotalA[NbDonnees]/2; + p:=0; + forever: + p:=p+1; + exitif EffectifTotalA[p]>DemiDonnees; + endfor; + path MedVer; + numeric CoefLineaire,pMed; + pMed=p; + CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p]; + MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]); + draw MedVer dashed evenly; + enddef; + % On commence le tracé : on récupère les informations + RecupValeursAbscisses(#1); + RecupValeursDonnees(#2); + % on définit une grille + vardef Grille= + if MemeAmpli: + Ajout:=1; + else: + Ajout:=3; + fi; + drawoptions(withcolor 0.7white); + for k=0 upto ((maxx-minx)/Pasx+2): + trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red; + endfor; + for k=0 upto (maxy+Ajout): + trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue; + endfor; + drawoptions(); + enddef; + % Fin Grille + % On trace les rectangles + vardef AfficheRectangles= + if Hachures: + Grille; + for k=2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + else: + for k=2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi; + endfor; + Grille; + for k=2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + fi; + enddef; + % Affichage final + if ECC: + AfficheRectangles; + if Mediane: + AfficheMedianeECC(#2); + fi; + else: + if Mediane: + AfficheMediane(#2); + if Hachures: + Grille; + %Partie gauche + for k=2 step 2 until (2*pMed-2): + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0); + draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])); + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1); + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1); + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + else: + %Partie gauche + for k=2 step 2 until (2*pMed-2): + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ; + % Partie droite + for k=2*pMed+2 step 2 until TotalAbscisses: + fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + endfor; + fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; + Grille; + %Partie Gauche + for k=2 step 2 until (2*pMed-2): + trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx)))); + for k=2*pMed+2 step 2 until TotalAbscisses: + draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); + endfor; + draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); + fi; + draw MedVer withpen pencircle scaled 2; + else: + AfficheRectangles; + fi; + fi; + %Affichage ou pas des axes, de la médiane + if MemeAmpli: + drawarrow (0,0)--unitey*(0,maxy+1); + EcartAmpli:=(X[2]-X[1])/Pasx; + if AideLecture: + for k=2 step 2 until TotalAbscisses: + trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly; + endfor; + fi; + if LectureFine: + for k=0 upto ((maxy+1)): + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + if Lecture: + for k=0 upto 1: + if Tiret: + trace (1pt,k*unitey)--(-1pt,k*unitey); + label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + else: + dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); + fi; + endfor; + fi; + else:%Pas même ampli : on n'affiche pas l'axe vertical + trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0); + trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))); + label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5))); +% if Mediane: +% AfficheMediane(#2); +% fi; + fi; + % On trace l'axe des abscisses + drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0); + %On labelise l'axe des abscisses + dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0)); + for k=2 step 2 until TotalAbscisses: + dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0)); + endfor; + label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0)); + %On affiche les données sup ou pas. + AfficheLegende(#2); + \end{mplibcode} + \fi +} +% + +\newcommand\Stat[2][]{% + \useKVdefault[ClesStat]% + \setKV[ClesStat]{#1}% + \ifboolKV[ClesStat]{UneMediane}{\renewcommand{\PfCArticleMediane}{une}}{\renewcommand{\PfCArticleMediane}{la}}% + \setsepchar[*]{,*/}% + \readlist*\ListeAvantUtilisation{#2}% + \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}% + \ifboolKV[ClesStat]{Classes}{% + \setsepchar[*]{,*/}% + \readlist*\ListeDepart{#2}% + \xdef\EffectifTotal{0}% + \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% + \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}% + }% + \ifboolKV[ClesStat]{Histogramme}{% + \buildgraphhisto% + }{% + \ifboolKV[ClesStat]{Tableau}{% + \buildtabclasses% + }{}% + }% + }{% + \setsepchar{,}% + \ifboolKV[ClesStat]{Representation}{% + \setKV[TraceG]{Xmin=0,Ymin=0}% + \setKV[TraceG]{#1}% + \readlist*\ListePointsPlaces{#2}% + \newtoks\toklistepoint% + \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% + \MPPlacePoint[#1]{\the\toklistepoint}% + }{% + \ifboolKV[ClesStat]{Liste}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#2}% + \xdef\foo{}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% + \xdef\foo{\foo 1/\Liste[##1],}% + }% + \readlist*\ListeComplete{\foo}% + \setKV[ClesStat]{Qualitatif}% + }{% + \ifboolKV[ClesStat]{Sondage}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#2}% + % "liste vide" + \newtoks\tabtoksEEa% + \tabtoksEEa{}% + % + % "liste vide" + \newtoks\tabtoksEEb% + \tabtoksEEb{}% + % + \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide + % + \newcount\cmptEE% + \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif + \PasNumEE=0\relax% + \DTLcleardb{mtdbEE}% + % on range les resultats du sondage par ordre croissant. + \foreachitem\x\in\Liste{% + \DTLnewrow{mtdbEE}% + \DTLnewdbentry{mtdbEE}{Numeric}{\x}% + }% + \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% + \DTLforeach{mtdbEE}{\nba=Numeric}{% + \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% + \cmptEE=0\relax% + \foreachitem\nbb\in\ListeSansDoublonsEE{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \ifthenelse{\equal{\the\cmptEE}{0}}{% + \expandafter\AjoutListEEb\nba\nil% + \xdef\listEEa{\the\tabtoksEEb}% + \ignoreemptyitems% + \setsepchar{,}% + \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements + %%% identiques de Liste + }{}% + }% + \foreachitem\nba\in\ListeSansDoublonsEE{% + \cmptEE=0\relax% + \DTLforeach{mtdbEE}{\nbb=Numeric}{% + \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% + }% + \expandafter\AjoutListEEab\nba\nil% + \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements + %%% identiques de Liste + }% + \xdef\listEEb{\the\tabtoksEEa} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEEb% + % + \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% + }{% + \ifboolKV[ClesStat]{Qualitatif}{% + % % on lit la liste \'ecrite sous la forme valeur/effectif + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }{% Dans le qualitatif, on trie d'abord les valeurs. + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeInitiale{#2}% + % "liste vide" + \newtoks\tabtoksEE% + \tabtoksEE{}% + \DTLcleardb{mtdbEEqual}% + \foreachitem\x\in\ListeInitiale{% + \DTLnewrow{mtdbEEqual}% + \itemtomacro\ListeInitiale[\xcnt,1]\x% + \DTLnewdbentry{mtdbEEqual}{Val}{\x}% + \itemtomacro\ListeInitiale[\xcnt,2]\y% + \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% + }% + \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% + \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% + \expandafter\AjoutListEEy\Val\nil% + \expandafter\AjoutListEEx\Eff\nil% + }% + \xdef\listEE{\the\tabtoksEE} + \ignoreemptyitems% + \setsepchar[*]{,*/}% + \readlist*\ListeComplete\listEE% + }}}% + % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif + \DTLcleardb{mtdb}% + % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr + \foreachitem\x\in\ListeComplete{% + \DTLnewrow{mtdb}% + \itemtomacro\ListeComplete[\xcnt,2]\y% + \DTLnewdbentry{mtdb}{Numeric}{\y}% + }% + \dtlsort{Numeric}{mtdb}{\dtlicompare}% + % % on r\'einitialise les valeurs des crit\`eres de position et de + % dispersion + \renewcommand\NbDonnees{}% + \renewcommand\SommeDonnees{}% + \renewcommand\EffectifTotal{}% + \renewcommand\Moyenne{}% + \renewcommand\Etendue{}% + \renewcommand\Mediane{}% + \renewcommand\DonneeMax{0}% + \renewcommand\EffectifMax{0}% + \renewcommand\DonneeMin{999999999}% + \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif + % Calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \ifboolKV[ClesStat]{EffectifTotal}{% + \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est + \num{\ListeCompletelen}.\par}{% + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in + {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} + }{}% + \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% + \ifboolKV[ClesStat]{Moyenne}{% + \ifboolKV[ClesStat]{Liste}{% + La somme des donn\'ees de la s\'erie est :% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]}{% + \[ + \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \]% + }% + \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% + Donc la moyenne de la s\'erie est \'egale \`a :% + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} + \ifboolKV[ClesStat]{ValeurExacte}{}{% + \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% + \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% + \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% + \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + }% + \]% + }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,2]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,2]}% + }{}% + }% + \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% + \ifboolKV[ClesStat]{Etendue}{% + \ifboolKV[ClesStat]{Liste}{% + L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% + % celui de la mediane + %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% + \newcount\Recapmed% + \newcount\Recapmeda% + \ifodd\number\ListeCompletelen%odd impair + \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% + \else% + \Recapmed=\fpeval{\ListeCompletelen/2}\relax% + \Recapmeda=\numexpr\Recapmed+1\relax% + \fi% + \newcount\Recapk% + \Recapk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% + \ifnum\Recapk=\Recapmed% + \ifodd\number\ListeCompletelen% + \xdef\Mediane{\numeroDonnee}% + \else% + \xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\Recapk=\Recapmeda% + \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% + \fi% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + \ifboolKV[ClesStat]{Liste}{% + On range les donn\'ees par ordre croissant :% + \nbdonnees=0% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% + }{% + \medskip% + \begin{center} + \begin{minipage}{0.9\linewidth} + \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; + }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} + \end{minipage} + \end{center}% + \medskip% + }% + \newcount\med% + \newcount\meda% + \ifodd\number\ListeCompletelen%odd impair + \med=\fpeval{(\ListeCompletelen+1)/2}\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ + \else% pair + \med=\fpeval{\ListeCompletelen/2}\relax% + \meda=\numexpr\med+1\relax% + L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ + \fi% + \newcount\k% + \k=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% + \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi + \ifodd\number\ListeCompletelen% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \xdef\Mediane{\numeroDonnee}% + \else% + La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% + \fi% + \fi% + \ifnum\k=\meda + La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}$\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\numeroDonnee}}{2}=}{}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% + %%%%%%% + }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\numeroDonnee}% + \fi% + }% + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\ListeCompletelen}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% + \fi% + \newcount\PfCQtroisk% + \PfCQtroisk=0% + \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi + \xdef\QuartileTrois{\numeroDonnee}% + \fi% + }% + % Construction du tableau + \ifboolKV[ClesStat]{Tableau}{% + \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% + % Construction du graphique + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% + \ifboolKV[ClesStat]{Barre}{% + \buildgraphbarhor% + }{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraphq[#1]% + }% + }% + }% + }% + }{}% + }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif + % % on effectue les calculs + % %% celui de la somme des donn\'ees + \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% + % %% celui de l'effectif total + \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% + % %% celui de l'\'etendue + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% + \xdef\DonneeMax{\ListeComplete[##1,1]}% + }{}% + \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% + \xdef\DonneeMin{\ListeComplete[##1,1]}% + }{}% + }% + % \xdef\EffectifMax{\DonneeMax}% + \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% + % %% celui de la moyenne + \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% + \ifboolKV[ClesStat]{EffectifTotal}{% + L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in + {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] + }{}% + \ifboolKV[ClesStat]{Moyenne}{% + La somme des donn\'ees de la s\'erie est :% + \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% + \[ + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }{% + \[ + \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% + +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} + \] + }% + \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% + \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% + \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% + +\num{\ListeComplete[##1,2]} + }=\num{\EffectifTotal} + \]% + }% + }% + Donc la moyenne de la s\'erie est \'egale \`a :% + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% + \ifboolKV[ClesStat]{ValeurExacte}{}{% + \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% + \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% + \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% + \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + }% + \]% + }{}% + % % Affichage des r\'eponses. + % %% pour l'\'etendue + \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% + % pour la m\'ediane + %%% Recuperation Mediane + \newcount\Recupmed% + \newcount\Recupmeda% + \ifodd\number\EffectifTotal%odd impair + \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% + \else% pair + \Recupmed=\fpeval{\EffectifTotal/2}\relax% + \Recupmeda=\numexpr\Recupmed+1\relax% + \fi% + \newcount\Recupk% + \Recupk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \Recupk=\numexpr\Recupk+1\relax% + \ifnum\Recupk=\Recupmed% + \ifodd\number\EffectifTotal% + \xdef\Mediane{\ListeComplete[##1,1]}% + \else% + \xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\Recupk=\Recupmeda% + \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% + \fi% + }% + }% + %%% + \ifboolKV[ClesStat]{Mediane}{% + + \newcount\med% + \newcount\meda% + \ifodd\number\EffectifTotal%odd impair + \med=\fpeval{(\EffectifTotal+1)/2}\relax% + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % + \else% pair + \med=\fpeval{\EffectifTotal/2}\relax% + \meda=\numexpr\med+1\relax% + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % + \fi% + \newcount\k% + \k=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \k=\numexpr\k+1\relax% + \ifnum\k=\med% + \ifodd\number\EffectifTotal% + La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \else% + La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% + \fi% + \fi% + \ifnum\k=\meda% + La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est $\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\ListeComplete[##1,1]}}2=}{}\xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + \fi% + }% + }% + }{}% + %%% Quartile un + \newcount\PfCQuartileUn% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileUn=\fpeval{\EffectifTotal/4}% + \else% + \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% + \fi% + \newcount\PfCQunk% + \PfCQunk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \PfCQunk=\numexpr\PfCQunk+1\relax% + \ifnum\PfCQunk=\PfCQuartileUn% + \xdef\QuartileUn{\ListeComplete[##1,1]}% + \fi% + }% + }% + %%% Quartile trois + \newcount\PfCQuartileTrois% + \modulo{\EffectifTotal}{4}\relax% + \ifnum\remainder=0% + \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% + \else% + \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% + \fi% + \newcount\PfCQtroisk% + \PfCQtroisk=0% + \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% + \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% + \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois% + \xdef\QuartileTrois{\ListeComplete[##1,1]}% + \fi% + }% + }% + % Construction de tableau + \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% + % Construction du graphique ?? + \ifboolKV[ClesStat]{Graphique}{% + \ifboolKV[ClesStat]{Angle}{% + \buildgraphcq{360}% + }{% + \ifboolKV[ClesStat]{SemiAngle}{% + \buildgraphcq{180}% + }{% + \buildgraph[#1]% + }% + }% + }{}% + }% + }% + }% +}%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex b/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex index 381e2a8df64..8da863a7b18 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex @@ -969,9 +969,9 @@ }% \StrLen{\ListeNombreAPlacer[##2,2]}[\TabLongueurNombre]% \xintifboolexpr{\ListeNombreAPlacer[##2,2]==0}{}{% - %On place la virgule - \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCDerniereColonneEntiere-0.5-\TabLongueurNombre+1}) {\PfCTBstrut,};% - %on écrit la partie décimale + % On place la virgule + \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1-0.5}) {\PfCTBstrut,};% + % on écrit la partie décimale \xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{% \tikz\node at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,2]}{##1}{##1}};% }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex b/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex index 40015eaeec6..c88c18363ce 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex @@ -1,7 +1,7 @@ %%% % Tables Addition-Multiplication %%% -\setKVdefault[Tables]{Addition=false,Multiplication=true,Seul=false,Debut=0,Fin=10,Couleur=white} +\setKVdefault[Tables]{Addition=false,Soustraction=false,Multiplication,Seul=false,Debut=0,Fin=10,Couleur=white} % pour m\'emoire \newcommand\TableMultiplicationComplete{% @@ -84,20 +84,39 @@ }% }% +\newcommand\TableSoustractionSeule[1]{% + \ensuremath{% + \begin{array}{ccccc} + \xintFor* ##1 in {\xintSeq + {\fpeval{#1+\useKV[Tables]{Debut}}}{\fpeval{#1+\useKV[Tables]{Fin}}}}\do{ + ##1&-&=&\fpeval{##1-#1}\\ + } + \end{array} + }% +}% + \newcommand\Tables[2][]{% \useKVdefault[Tables]% \setKV[Tables]{#1}% \ifboolKV[Tables]{Seul}{% - \ifboolKV[Tables]{Addition}{% - \TableAdditionSeule{#2}% + \ifboolKV[Tables]{Soustraction}{% + \TableSoustractionSeule{#2}% }{% - \TableMultiplicationSeule{#2}% + \ifboolKV[Tables]{Addition}{% + \TableAdditionSeule{#2}% + }{% + \TableMultiplicationSeule{#2}% + }% }% }{% - \ifboolKV[Tables]{Addition}{% - \TableAdditionComplete% + \ifboolKV[Tables]{Soustraction}{% + La clé Soustraction n'est pas disponible ici.% }{% - \TableMultiplicationCompleteColore% + \ifboolKV[Tables]{Addition}{% + \TableAdditionComplete% + }{% + \TableMultiplicationCompleteColore% + }% }% }% }%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty index 7df0da0008d..7be8c2783f2 100644 --- a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty +++ b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty @@ -2,9 +2,9 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2023/05/19}% +\def\filedate{2023/07/05}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-m}% +\def\fileversion{0.99-z-o}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% @@ -217,14 +217,15 @@ \ooalign{$\genfrac{}{}{0pt}{0}{#1}{#2}$\cr\PfCdotover\cr}% }% -\NewDocumentCommand\MultiCol{O{}m+m}{% +\NewDocumentCommand\MultiCol{O{}+m+m}{% \setsepchar[*]{/}% \readlist*\ListeNombreCol{#2}% \setsepchar[*]{§}% \readlist*\ListeContenuCol{#3}% \xintFor* ##1 in {\xintSeq{1}{\ListeNombreCollen}}\do{% + \itemtomacro\ListeContenuCol[##1]\PfMTexte \begin{minipage}[#1]{\ListeNombreCol[##1]\linewidth}% - \ListeContenuCol[##1]% + \PfMTexte \end{minipage}% \xintifboolexpr{##1<\ListeNombreCollen}{\hfill\vrule width \columnseprule\hfill}{}% }% @@ -571,6 +572,8 @@ }%\emoticon }%\raisebox } +\input{PfCAutomatismes} +\input{PfCNumberHive} \input{PfCPatronPaves} \input{PfCErathostene} \input{PfCDobble} |