summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty')
-rw-r--r--Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty3125
1 files changed, 0 insertions, 3125 deletions
diff --git a/Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty b/Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty
deleted file mode 100644
index dc3c35fdd75..00000000000
--- a/Master/texmf-dist/tex/latex/proflycee/ProfLycee-old.sty
+++ /dev/null
@@ -1,3125 +0,0 @@
-% Author : C. Pierquet
-% licence : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
-
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfLycee-old}[2022/11/06 v1.3.8 - Aide pour l'utilisation de LaTeX en lycee]
-% 1.3.8 Chargement de Piton uniquement en cas de compilation en lua
-% 1.3.7 Ajout d'un environnement simplifié pour du code python via piton
-% 1.3.6 Ajout d'un "générateur" de trinômes (ou mise en forme basique)
-% 1.3.5 Correction de bugs sur les calculs de probas (loi géométrique)
-% 1.3.4 Ajout des calculs de probas geomtriques et hypergeometriques + petits schémas probas
-% 1.3.3 Ajout de commandes pour des arbres de probas classiques, en tikz
-% 1.3.2 Correction d'une commande liée à la conversion bintohex (suppression clé trait)
-% 1.3.1 Ajout d'une option pour ne pas afficher les bords des cases en pixelart
-% 1.3.0 Ajout d'une commande pour mettre en forme une conversion depuis la base 10
-% 1.2.9 Correction d'une incompatibilité avec simplekv (clés vides...)
-% 1.2.8 Correction de l'oubli d'une librairie tikz et remise en forme de la documentation
-% 1.2.7 Calculs de probas pour des lois classiques
-% 1.2.6 Ajout d'un environnement tikz pour des sudomaths personnalisés
-% 1.2.5 Ajout d'une commande pour des boites à moustaches, en tikz
-% 1.2.4 Correction de quelques bugs mineurs, et mise à jour de la doc
-% 1.2.3 Ajout d'un environnement simplifié pour du code python
-% 1.2.2 Ajouts de commandes pour des stats à 2 variables
-% 1.2.1 Amélioration de la gestion du csv pour les pixelart
-% 1.2 Correction d'un méchant bug avec pixelart, erf...
-% 1.1.9 Commande pour du pixelart en tikz (avec option csvii pour compatibilité)
-% 1.1.8 Ajout d'un style mainlevee pour tikz
-% 1.1.7 Ajout de commandes pour des conversions bin/dec/hex
-% 1.1.6 Ajout d'une commande pour déterminer les paramètres d'un régression linéaire par moindres carrés
-% 1.1.5 Ajout de commandes pour "visualiser" le signe de ax+b ou de ax2+bx+c (cf tnsana !)
-% 1.1.4 Ajout d'une commande cercletrigoPL pour, en \TikZ, créer facilement un cercle trigo avec options
-% 1.1.3 Ajout d'une commande ensemble pour créer un ensemble à partir d'une liste
-% 1.1.2 Modifs mineures
-% 1.1.1 Modification mineure de l'environnement CF, avec prise de charge de la taille du texte !
-% 1.1.0 Ajout d'une commande tetraPL pour un tetraèdre dans un environnement TikZ
-% 1.0.9 Ajout d'une commande pavePL pour un pave droit dans un environnement TikZ
-% 1.0.8 Ajout d'une commande liencapytale pour créer un cartouche "comme sur capytale"
-% 1.0.7 Option [build] pour placer les fichiers temporaires dans un répertoire build (désactivée par défaut)
-% 1.0.6 Option [nominted] pour éviter de charger minted & nettoyage amssymb
-% 1.0.5 Environnement code python avec minted
-% 1.0.4 Environnement pour simuler terminal windows & linux
-% 1.0.3 Environnement pour présenter du pseudocode
-% 1.0.2 Environnement pour présenter du code python (avec pythontex)
-% 1.0.1 Modif mineure du chargement de xcolor (compatibilité avec d'autres packages notamment...)
-% 1.0 Version initiale
-
-%------Option(s)
-\newif\if@nominted \@nomintedfalse
-\DeclareOption{nominted}{\@nomintedtrue}
-\newif\if@build \@buildfalse
-\DeclareOption{build}{\@buildtrue}
-\newif\if@csvii \@csviifalse
-\DeclareOption{csvii}{\@csviitrue}
-\DeclareOption*{}
-\ProcessOptions\relax
-
-%------Packages utiles
-\RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs
-\RequirePackage{tikz}
-\RequirePackage{tkz-tab}
-\RequirePackage{mathtools}
-\RequirePackage{pgf,pgffor}
-\RequirePackage{ifthen}
-\RequirePackage{xparse}
-\RequirePackage{xkeyval}
-\RequirePackage{xfp}
-\RequirePackage{xstring}
-\RequirePackage{xintexpr}
-\RequirePackage{xintbinhex}
-\RequirePackage{simplekv}
-\RequirePackage{listofitems}
-\RequirePackage{tabularray}
-\RequirePackage{siunitx} %test avec v3
-\sisetup{%
- locale=FR,%
- mode = match, propagate-math-font = true,%
- reset-math-version = false, reset-text-family = false,%
- reset-text-series = false, reset-text-shape = false,%
- text-family-to-math = true, text-series-to-math = true,%
- output-decimal-marker={,},%
- group-minimum-digits=4%
-}%
-\RequirePackage{fontawesome5}
-\if@csvii
- \RequirePackage[legacy]{csvsimple}
-\else
- \RequirePackage{expl3}
- \RequirePackage[l3]{csvsimple}
-\fi
-%librairies tikz
-\usetikzlibrary{calc}
-\usetikzlibrary{decorations}
-\usetikzlibrary{decorations.pathreplacing}
-\usetikzlibrary{decorations.markings}
-\usetikzlibrary{arrows,arrows.meta}
-\usetikzlibrary{babel}
-\usetikzlibrary{shapes.geometric}
-\usetikzlibrary{decorations.pathmorphing}
-%tcolorbox
-\RequirePackage[most]{tcolorbox}
-%divers
-\RequirePackage{iftex}
-%python
-\RequirePackage{fancyvrb}
-\RequirePackage[gobble=auto]{pythontex}
-\setpythontexlistingenv{pythont} %pour ne pas télescoper lstlistings (?)
-\if@build
- \setpythontexoutputdir{./build/pythontex-files-\jobname} %essai de modif pythontex répertoire build
-\fi
-
-%---------------SPLINES----------------------
-%------commande utile pour extraire des infos d'une liste
-\newcommand\extractcoeff[2]{% #1=liste & #2=numero
- \setsepchar{§}%
- \readlist\lcoeffs{#1}
- \ifnum \lcoeffslen=1
- \def\COEFFA{#1}
- \def\COEFFB{#1}
- \else
- \itemtomacro\lcoeffs[#2]\COEFF
- \IfSubStr{\COEFF}{/}%
- {\StrCut{\COEFF}{/}{\COEFFA}{\COEFFB}}%
- {\def\COEFFA{\COEFF}\def\COEFFB{\COEFF}}
- \fi
-}
-
-%------splines en tikz avec ..controls
-\defKV[spline]{%
- liste=\def\SPLliste{#1},%
- width=\def\SPLepaisseur{#1},%
- couleur=\def\SPLcouleur{#1},%
- coeffs=\def\SPLcoeffs{#1},%
- couleurpoints=\def\SPLcouleurpoints{#1},%
- taillepoints=\def\SPLtaillepoints{#1},%
- style=\def\SPLstyle{#1}
-}
-
-\setKVdefault[spline]{%
- spline={},%
- width=1.25pt,%
- couleur=red,%
- coeffs=3,%
- couleurpoints=black,%
- taillepoints=2pt,%
- affpoints=false,%
- style={}
-}
-
-\newcommand\splinetikz[1][]{%
- \useKVdefault[spline]
- \setKV[spline]{#1}% on paramètres les nouvelles clés et on les simplifie
- %on lit la liste des points/nbderivés et on stocke dans \listepoints
- \setsepchar[.]{§./}%
- \readlist\SPLlistepoints\SPLliste
- \def\SPLnbsplines{\inteval{\SPLlistepointslen-1}}
- %si uniquement deux points, pas de boucle...
- \ifnum \SPLlistepointslen=2
- %extraction des coeffs de compensation
- \extractcoeff{\SPLcoeffs}{1}%
- %extraction des coordonnées
- \itemtomacro\SPLlistepoints[1,1]\xa
- \itemtomacro\SPLlistepoints[1,2]\ya
- \itemtomacro\SPLlistepoints[1,3]\fprimea
- \itemtomacro\SPLlistepoints[2,1]\xb
- \itemtomacro\SPLlistepoints[2,2]\yb
- \itemtomacro\SPLlistepoints[2,3]\fprimeb
- \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFA}).. (\xb,\yb) ;%
- %sinon on construit bout par bout !
- \else
- \foreach \i in {1,2,...,\SPLnbsplines}{
- %extraction des coeffs de compensation
- \extractcoeff{\SPLcoeffs}{\i}
- \def\j{\inteval{\i+1}}
- \itemtomacro\SPLlistepoints[\i,1]\xa
- \itemtomacro\SPLlistepoints[\i,2]\ya
- \itemtomacro\SPLlistepoints[\i,3]\fprimea
- \itemtomacro\SPLlistepoints[\j,1]\xb
- \itemtomacro\SPLlistepoints[\j,2]\yb
- \itemtomacro\SPLlistepoints[\j,3]\fprimeb
- \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFB}).. (\xb,\yb) ;%
- }
- \fi
- \ifboolKV[spline]{affpoints}%on affiche les points de contrôle
- {%
- \foreach \i in {1,2,...,\SPLlistepointslen}{%
- \itemtomacro\SPLlistepoints[\i,1]\xa
- \itemtomacro\SPLlistepoints[\i,2]\ya
- \filldraw[\SPLcouleurpoints] (\xa,\ya) circle[radius=\SPLtaillepoints] ;%
- }
- }
- {}
-}
-
-%------tangente(s) en TikZ, avec point/dérivée ou liste points/dérivées
-\defKV[tgte]{%
- liste=\def\TGTliste{#1},%
- width=\def\TGTepaisseur{#1},%
- couleur=\def\TGTcouleur{#1},%
- xl=\def\TGTXL{#1},%
- xr=\def\TGTXR{#1},%
- style=\def\TGTstyle{#1},%
- point=\def\TGTnumpt{#1}
-}
-
-\setKVdefault[tgte]{
- liste={},%
- width=1.25pt,%
- couleur=red,%
- xl=0.5,xr=0.5,%
- style={},%
- point=1
-}
-
-\newcommand\tangentetikz[1][]{%
- \useKVdefault[tgte]%
- \setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie
- \setsepchar[.]{§./}%
- \readlist\TGTlistepoints\TGTliste
- \itemtomacro\TGTlistepoints[\TGTnumpt,1]\xa
- \itemtomacro\TGTlistepoints[\TGTnumpt,2]\ya
- \itemtomacro\TGTlistepoints[\TGTnumpt,3]\fprimea
- \def\TGTDEB{\fpeval{\xa-\TGTXL}}\def\TGTFIN{\fpeval{\xa+\TGTXR}}%
- \draw[line width=\TGTepaisseur,\TGTcouleur,domain=\TGTDEB:\TGTFIN,\TGTstyle] plot (\x,{\fprimea*(\x-\xa)+\ya}) ;%
-}
-
-%----------------FENÊTRE CALCUL FORMEL
-\newcommand\CFchap{\textasciicircum}
-\newcounter{CFnum}
-%def des clés
-\defKV[paramfenxcas]{%
- larg=\def\CFlarg{#1},%
- esplg=\def\CFesplg{#1},%
- premcol=\def\CFpremcol{#1},%
- hpremcol=\def\CFhpremcol{#1},%
- taille=\def\CFtaille{#1},%
- couleur=\def\CFcouleur{#1},%
- tailletitre=\def\CFtailletitre{#1},%
- couleurcmd=\def\CFcoulcmd{#1},%
- couleurres=\def\CFcoulres{#1},%
- poscmd=\def\CFposcmd{#1},%
- posres=\def\CFposres{#1},%
- labeltitre=\def\CFlabeltitre{#1}%
-}
-\setKVdefault[paramfenxcas]{%
- larg=16,esplg=2pt,premcol=0.3,hpremcol=0.4,%
- couleur=darkgray,menu=true,titre=false,tailletitre=\normalsize,taille=\normalsize,%
- sep=true,posres=centre,poscmd=gauche,%
- couleurcmd=red,couleurres=blue,%
- labeltitre={Résultats obtenus avec un logiciel de Calcul Formel}}
-\newcommand\paramCF[1][]{%
- \setcounter{CFnum}{0}
- \useKVdefault[paramfenxcas]%
- \setKV[paramfenxcas]{#1}% on paramètres les nouvelles clés et on les simplifie
-}
-%def des clés
-\defKV[paramlgxcas]{%
- hc=\def\CFhle{#1},%
- hr=\def\CFhlr{#1}
-}
-\setKVdefault[paramlgxcas]{hc=0.75,hr=0.75}
-\newcommand\ligneCF[3][]{%
- \addtocounter{CFnum}{1}
- \def\CFL{\theCFnum}
- \def\CFLA{\inteval{\CFL-1}}%
- \useKVdefault[paramlgxcas]%
- \setKV[paramlgxcas]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\CFLA{\inteval{\CFL-1}}%
- %DÉCLARATION DES NŒUDS (les "6" coins des lignes commande et résultat)
- \xintifboolexpr{\CFL == 1}%si c'est la première ligne
- {\coordinate (A0\CFL) at (0,0);}
- {\coordinate (A0\CFL) at ($(A2\CFLA) + (0,{-\CFesplg})$);}
- \coordinate (A1\CFL) at ($(A0\CFL) + (0,{-\CFhle})$);
- \coordinate (A2\CFL) at ($(A1\CFL) + (0,{-\CFhlr})$);
- \coordinate (A3\CFL) at ($(A0\CFL) + ({\CFlarg},0)$);
- \coordinate (A4\CFL) at ($(A1\CFL) + ({\CFlarg},0)$);
- \coordinate (A5\CFL) at ($(A2\CFL) + ({\CFlarg},0)$);
- %DÉCLARATION DES NŒUDS INTERMÉDIAIRES (pour les commandes et les résultats)
- \coordinate (C1\CFL) at ($(A0\CFL) + (0,{-0.5*\CFhle})$);
- \coordinate (C2\CFL) at ($(A0\CFL) + ({0.5*\CFlarg},{-0.5*\CFhle})$);
- \coordinate (C3\CFL) at ($(A0\CFL) + ({\CFlarg},{-0.5*\CFhle})$);
- \coordinate (R1\CFL) at ($(A1\CFL) + (0,{-0.5*\CFhlr})$);
- \coordinate (R2\CFL) at ($(A1\CFL) + ({0.5*\CFlarg},{-0.5*\CFhlr})$);
- \coordinate (R3\CFL) at ($(A1\CFL) + ({\CFlarg},{-0.5*\CFhlr})$);
- %RECTANGLE DE BASE
- \draw[\CFcouleur] (A0\CFL) rectangle (A5\CFL) ;
- %LA COMMANDE EN ROUGE
- \IfStrEq{\CFposcmd}{centre}%si poscmd=center
- {\draw (C2\CFL) node[\CFcoulcmd,font=\CFtaille] {#2} ;}
- {}
- \IfStrEq{\CFposcmd}{gauche}%si poscmd=left
- {\draw (C1\CFL) node[right,\CFcoulcmd,font=\CFtaille] {#2} ;}
- {}
- \IfStrEq{\CFposcmd}{right}%si poscmd=right
- {\draw (C3\CFL) node[left,\CFcoulcmd,font=\CFtaille] {#2} ;}
- {}
- %LA LIGNE DE SÉPARATION
- \ifboolKV[paramfenxcas]{sep}%si sep=true
- {\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);}
- {}
- %LE RÉSULTAT
- \IfStrEq{\CFposres}{centre}%si posrep=center
- {\draw (R2\CFL) node[\CFcoulres,font=\CFtaille] {#3} ;}
- {}
- \IfStrEq{\CFposres}{gauche}%si posrep=left
- {\draw (R1\CFL) node[right,\CFcoulres,font=\CFtaille] {#3} ;}
- {}
- \IfStrEq{\CFposres}{right}%si posrep=right
- {\draw (R3\CFL) node[left,\CFcoulres,font=\CFtaille] {#3} ;}
- {}
- \ifboolKV[paramfenxcas]{sep}%si sep=true
- {\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);}%
- {}
- %LE PETIT NUMÉRO
- \draw[\CFcouleur] (A0\CFL) rectangle ++ ({-\CFpremcol},{-\CFhpremcol}) node[\CFcouleur,midway,font=\small\sffamily\bfseries] {\CFL} ;
- %LE RECTANGLE "MENU"
- \ifboolKV[paramfenxcas]{menu}%si menu=true
- {\draw[\CFcouleur,fill=\CFcouleur!25] (A5\CFL) rectangle ++ (-0.65,0.25) node[black,midway,font=\tiny\sffamily\bfseries] {MENU} ;}%
- {}
- %LE BLOC "TITRE"
- \ifboolKV[paramfenxcas]{titre}%si titre=true
- {\draw[\CFcouleur,fill=lightgray!25,rounded corners] ($(A01) + (0,2pt)$) rectangle ++ ($({\CFlarg},2em)$) node[ForestGreen!50!\CFcouleur,midway,font=\CFtailletitre\ttfamily\bfseries] {\CFlabeltitre};}
- {}
-}
-
-%=========CONSOLEPYTHON=========== OK !!
-\defKV[envpythonconsole]{%
- largeur=\def\CSPYlargeur{#1},%
- centre=\testboolKV{#1}
- {\def\hookcenterpre{\begin{center}}\def\hookcenterpost{\end{center}}}
- {\def\hookcenterpre{\begin{flushleft}}\def\hookcenterpost{\end{flushleft}}}
-}
-
-\setKVdefault[envpythonconsole]{%
- largeur=\linewidth,%
- centre=true,%
- label=true
-}
-
-\newenvironment{envconsolepythontex}[1][]{%
- \useKVdefault[envpythonconsole]%
- \setKV[envpythonconsole]{#1}% on paramètres les nouvelles clés et on les simplifie
- \VerbatimEnvironment
- \hookcenterpre
- \begin{minipage}{\CSPYlargeur}
- \ifboolKV[envpythonconsole]{label}%si sep=true
- {\begin{pyconsole}[][%
- framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen},label={[\scriptsize Début de la console python]\scriptsize Fin de la console python}]}%
- {\begin{pyconsole}[][%
- framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen}]}
- }
- {
- \end{pyconsole}
- \end{minipage}
- \hookcenterpost
-}
-
-%=========CODEPYTHONTEX=========== OK!!
-\defKV[envpythonverb]{%
- largeur=\def\CODPYlargeur{#1},%
- centre=\testboolKV{#1}
- {\def\verbcenterpre{\begin{center}}\def\verbcenterpost{\end{center}}}
- {\def\verbcenterpre{}\def\verbcenterpost{}}
-}
-
-\setKVdefault[envpythonverb]{%
- largeur=\linewidth,%
- centre=true,%
- lignes=true
-}
-
-\tcbset{stylepythontex/.style={%
- enhanced,boxrule=1.25pt,%
- sharp corners=downhill,arc=12pt,
- before skip=12pt,after skip=12pt,%
- top=10pt,bottom=1mm,rightupper=4pt,%leftupper=25pt,
- attach boxed title to top right={yshift=-\tcboxedtitleheight},
- boxed title style={
- size=small,colback=ForestGreen!25,boxrule=1.25pt,
- colframe=Green,boxsep=1.25pt,
- sharp corners=downhill,
- arc=12pt,
- top=2pt,bottom=1pt,left=6pt,right=6pt
- },
- fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize,
- title={\scriptsize\faPython}\:Code Python\vphantom{p},
- watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50,
- }
-}
-
-\tcbset{stylepythonnolineos/.style={%
- stylepythontex,leftupper=10pt,
- colframe=Green,colback=ForestGreen!5,%
- fontlower=\small,%
- before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
- }
-}
-
-\tcbset{stylepythonlineos/.style={%
- stylepythontex,leftupper=25pt,
- colframe=Green,colback=ForestGreen!5,%
- fontlower=\small,%
- before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
- }
-}
-
-\newtcolorbox{tcpythontexcode}[1][\linewidth]{%
- width=#1,stylepythonlineos
-}
-
-\newtcolorbox{tcpythontexcodeno}[1][\linewidth]{%
- width=#1,stylepythonnolineos
-}
-
-\newenvironment{envcodepythontex}[1][]{%
- \useKVdefault[envpythonverb]%
- \setKV[envpythonverb]{#1}% on paramètres les nouvelles clés et on les simplifie
- \VerbatimEnvironment
- \verbcenterpre
- \ifboolKV[envpythonverb]{lignes}%si lignes=true
- {\begin{tcpythontexcode}[\CODPYlargeur]}
- {\begin{tcpythontexcodeno}[\CODPYlargeur]}
- \ifboolKV[envpythonverb]{lignes}%si lignes=true
- {\begin{pyverbatim}[][fontsize=\footnotesize,numbers=left,numbersep=10pt,commandchars=\\\{\},mathescape]}
- {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\footnotesize,commandchars=\\\{\},mathescape]}
- }
- {
- \end{pyverbatim}
- \ifboolKV[envpythonverb]{lignes}%si lignes=true
- {\end{tcpythontexcode}}
- {\end{tcpythontexcodeno}}
- \verbcenterpost
-}
-
-%=========PYTHONMINTED========= OK !!
-\if@nominted
- %on ne charge pas minted et la librairie tcbox
-\else
- \if@build
- %on charge minted avec le répertoire build
- \RequirePackage[outputdir=build]{minted}
- \fi
- %on charge minted via la librairie tcbox
- \tcbuselibrary{minted}
-\fi
-
-\tcbset{pytmintedno/.style={%
- listing engine=minted,minted style=colorful,
- minted language=python,listing only,
- minted options={tabsize=4,fontsize=\small,autogobble},
- }
-}
-
-\tcbset{pytminted/.style={%
- listing engine=minted,minted style=colorful,
- minted language=python,listing only,
- minted options={tabsize=4,fontsize=\small,autogobble,xleftmargin=16pt,linenos,numbersep=10pt},
- }
-}
-
-\DeclareTCBListing{envcodepythonminted}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis option...
- \IfBooleanTF{#1}{pytmintedno}{pytminted},
- enhanced,width=#2,#3,
- colframe=Green,colback=ForestGreen!5,%
- boxrule=1.25pt,
- sharp corners=downhill,arc=12pt,
- before skip=12pt,after skip=12pt,%
- leftupper=8pt,top=10pt,bottom=4pt,rightupper=4pt,%
- attach boxed title to top right={yshift=-\tcboxedtitleheight},
- boxed title style={
- size=small,colback=ForestGreen!25,boxrule=1.25pt,
- colframe=Green,boxsep=1.25pt,
- sharp corners=downhill,
- arc=12pt,
- top=2pt,bottom=1pt,left=6pt,right=6pt
- },
- fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize,
- title={\scriptsize\faPython}\:Code Python\vphantom{y},
- watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50,
- before upper = \renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}}
-}
-
-%=======STYLE ALGO LST========= OK !
-\ifluatex
- \tcbuselibrary{listings}
- \lstdefinelanguage{langnat}{%
- keywords={},
- inputencoding=utf8,
- comment=[l]{}}
- \lstdefinestyle{PLpython}{%
- language = python,
- inputencoding = utf8,
- basicstyle = \ttfamily\footnotesize,
- keywordstyle = \color{ForestGreen},
- keywordstyle = [2]\color{magenta},
- commentstyle = \color{gray}\itshape,
- stringstyle = \color{red!75},
- numberstyle = \scriptsize\ttfamily\color{Green},
- aboveskip = 4pt,
- belowskip = 1pt,
- tabsize = 4,
- showstringspaces = false,
- columns = fullflexible,
- keepspaces = true,
- breaklines = true,
- breakatwhitespace = true
- }
-\else
- \tcbuselibrary{listingsutf8}
- \lstdefinelanguage{langnat}{%
- keywords={},
- inputencoding=utf8/latin1,
- comment=[l]{}}
- \lstdefinestyle{PLpython}{%
- language = python,
- inputencoding = utf8/latin1,
- basicstyle = \ttfamily\footnotesize,
- keywordstyle = \color{ForestGreen},
- keywordstyle = [2]\color{magenta},
- commentstyle = \color{gray}\itshape,
- stringstyle = \color{red!75},
- numberstyle = \scriptsize\ttfamily\color{Green},
- aboveskip = 4pt,
- belowskip = 1pt,
- tabsize = 4,
- showstringspaces = false,
- columns = fullflexible,
- keepspaces = true,
- breaklines = true,
- breakatwhitespace = true
- }
-\fi
-
-%=======PYTHONLISTINGS========= OK !!
-\tcbset{stylepythonlst/.style={%
- enhanced,boxrule=1.25pt,%
- leftupper=10pt,
- sharp corners=downhill,arc=12pt,
- before skip=12pt,after skip=12pt,%
- top=10pt,bottom=1mm,rightupper=4pt,%leftupper=25pt,
- attach boxed title to top right={yshift=-\tcboxedtitleheight},
- boxed title style={
- size=small,colback=ForestGreen!25,boxrule=1.25pt,
- colframe=Green,boxsep=1.25pt,
- sharp corners=downhill,
- arc=12pt,
- top=2pt,bottom=1pt,left=6pt,right=6pt
- },
- colframe=Green,colback=ForestGreen!5,%
- fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize,
- title={\scriptsize\faPython}\:Code Python\vphantom{p},
- watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50,
- listing only,listing engine=listings,%
- }
-}
-
-\tcbset{stylepythonlstnolineos/.style={%
- stylepythonlst,
- listing options={style=PLpython,xleftmargin=0pt,numbers=none}
- }
-}
-
-\tcbset{stylepythonlstlineos/.style={%
- stylepythonlst,
- listing options={style=PLpython,xleftmargin=16pt,numbers=left}
- }
-}
-
-\DeclareTCBListing{envcodepython}{ s O{\linewidth} m }{% * off pour numéros de lignes + {largeur} + <options tcbox>
- \IfBooleanTF{#1}{stylepythonlstnolineos}{stylepythonlstlineos},
- width=#2,#3
-}
-
-\NewTCBInputListing{\envcodepythonfichier}{ s O{\linewidth} m m }{
- \IfBooleanTF{#1}{stylepythonlstnolineos}{stylepythonlstlineos},
- width=#2,#3,
- listing file={#4}}
-
-%=========PYTHONPITON========== OK !!
-\defKV[envpiton]{%
- Largeur=\def\CODPITlargeur{#1},%
- Alignement=\def\CODPITalign{#1}
-}
-
-\setKVdefault[envpiton]{%
- Largeur=\linewidth,%
- Alignement=center,%
- Lignes=true
-}
-\ifluatex
- \RequirePackage{piton}
- \NewPitonEnvironment{envcodepiton}{ O{} }%
- {%
- \useKVdefault[envpiton]%
- \setKV[envpiton]{#1}% on paramètres les nouvelles clés et on les simplifie
- \ifboolKV[envpiton]{Lignes}%si lignes=true
- {\PitonOptions{left-margin=12.75pt,line-numbers}}%
- {\PitonOptions{}}%
- \begin{tcolorbox}[stylepythontex,leftupper=8pt,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontlower=\small,\CODPITalign]
- }%
- {%
- \end{tcolorbox}%
- }
-\fi
-
-%=========PSEUDOCODE=========== OK !!
-%language pseudocode listings
-\lstdefinestyle{pseudocodePL}{%
- language=langnat,
- basicstyle=\footnotesize\ttfamily,
- numberstyle=\scriptsize\ttfamily\color{gray},
- keywordstyle=\bfseries,
- stringstyle=\color{red!75},
- keepspaces=true,
- tabsize=4,numbersep=10pt,
- xleftmargin=14pt,
- numbers=left,
- morestring=[b]",
- showstringspaces=false,
- %showtabs=false,
- escapeinside={(*}{*)}
-}
-
-\lstdefinestyle{pseudocodenoPL}{%
- language=langnat,
- basicstyle=\footnotesize\ttfamily,
- numberstyle=\scriptsize\ttfamily\color{gray},
- keywordstyle=\bfseries,
- stringstyle=\color{red!75},
- keepspaces=true,
- tabsize=4,numbersep=10pt,
- numbers=none,
- showstringspaces=false,
- morestring=[b]",
- %showtabs=true,
- escapeinside={(*}{*)}
-}
-
-%style tcbox pseudocode avec bannière hautdroite
-\tcbset{stylepseudocodePL/.style={%
- %fontupper=\small\sffamily,%
- enhanced,boxrule=1.25pt,sharp corners=downhill,arc=12pt,
- before skip=12pt,after skip=12pt,leftupper=10pt,top=8pt,bottom=2pt,rightupper=4pt,%
- attach boxed title to top right={yshift=-\tcboxedtitleheight},
- boxed title style={
- size=small,colback=gray!25,boxrule=1.25pt,
- colframe=darkgray,boxsep=1.25pt,
- sharp corners=downhill,
- arc=12pt,
- top=2pt,bottom=1pt,left=6pt,right=6pt
- },
- fonttitle=\color{darkgray}\ttfamily\footnotesize,
- title={\scriptsize\faFileCode}\:\textit{Pseudo-Code}\vphantom{p},
- watermark text={\faCode},watermark opacity=0.175,watermark zoom=0.50,
- }
-}
-
-\ifluatex
- \newcommand\algomathttPL[1]{\symtt{#1}}
-\else
- \newcommand\algomathttPL[1]{\mathtt{#1}}
-\fi
-
-\DeclareTCBListing{envpseudocode}{ s O{12cm} !O{} }{% étoilée sans numéro, taille puis option...
- width=#2,#3,
- stylepseudocodePL,
- listing only,listing engine=listings,
- listing options={
- style=\IfBooleanTF{#1}{pseudocodenoPL}{pseudocodePL},%version étoilée sans numéro de lignes
- aboveskip=2pt,belowskip=2pt,
- columns=fullflexible,
- literate={é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1%
- {ú}{{\'u}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1%
- {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1%
- {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1%
- {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1%
- {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1%
- {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1%
- {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1%
- {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1%
- {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1%
- {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1%
- {€}{{\texteuro}}1 {£}{{\pounds}}1%
- {=}{\textleftarrow}1 {==}{=}1%
- {*}{$\algomathttPL{\times}$}{1}%
- }
-}
-
-%============FakeTerm=========== OK !!
-%couleurs (inspirées par termsim !)
-\definecolor{PLmpurple}{RGB}{48,10,36}
-\definecolor{PLmgray}{RGB}{70,72,67}
-\definecolor{PLogray}{RGB}{148,147,141}
-\definecolor{PLoorange}{RGB}{233,101,56}
-\definecolor{PLterminal}{RGB}{80,78,70}
-\definecolor{PLlinux}{RGB}{0,39,51}
-\definecolor{PLwinblue}{HTML}{1883D7}
-\definecolor{PLosxgray}{HTML}{D8D6D9}
-
-%WINDOWS
-\tcbset{PLfaketermwin/.style={%
- enhanced,boxrule=1pt,sharp corners,before skip=12pt,after skip=12pt,%
- colframe=PLwinblue,colback=black,colbacktitle=white,colupper=white,coltitle=black,%
- titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
- fonttitle=\bfseries\small\sffamily
- }
-}
-
-\setKVdefault[fakeTERMwin]{titre={Terminal Windows}}
-
-\newcommand\PLcommandeswin{%
- \begin{tikzpicture}[thick,scale=0.66]
- \draw (0,0)--(1em,0) ; \draw (2em,0) rectangle (3em,1em) ; \draw (4em,1em)--(5em,0) (4em,0)--(5em,1em) ;
- \end{tikzpicture}%
-}
-
-\newcommand\termwintitre[1][]{%
- \restoreKV[fakeTERMwin]
- \setKV[fakeTERMwin]{#1}
- \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={X[l]r}}
- {\footnotesize\faTerminal}~~\useKV[fakeTERMwin]{titre} & \PLcommandeswin \\ %
- \end{tblr}
-}
-
-\DeclareTCBListing{PLtermwin}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
- PLfaketermwin,title={\termwintitre[#2]},%
- listing only,listing engine=listings,%
- listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
- width=#1,#3
-}
-
-%LINUX
-\newcommand{\PLUbuntuWhite}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[PLmgray] (0,0.25em) circle[radius=0.5em] ;
- \end{tikzpicture}%
-}
-\newcommand{\PLUbuntuMin}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em];
- \draw[PLterminal](-0.35em,0.25em)--(0.35em,0.25em);
- \end{tikzpicture}%
-}
-\newcommand{\PLUbuntuClose}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[color=PLoorange!70!white] (0,0.25em) circle[radius=0.5em];
- \draw[PLterminal] (-0.32em,-0.07em)--(0.32em,0.57em);
- \draw[PLterminal] (-0.32em,0.57em)--(0.32em,-0.07em);
- \end{tikzpicture}%
-}
-\newcommand{\PLUbuntuMax}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em];
- \draw[PLterminal] (-0.32em,0.5em) rectangle (0.32em,0);
- \end{tikzpicture}%
-}
-
-\tcbset{PLtermlinux/.style={%
- enhanced,boxrule=1pt,arc=4pt,before skip=12pt,after skip=12pt,%
- colframe=PLmgray,colback=PLmpurple,colbacktitle=PLmgray,colupper=white,coltitle=white,%
- titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
- fonttitle=\bfseries\small\sffamily
- }
-}
-
-\setKVdefault[fakeTERMnux]{titre={Terminal UNiX}}
-
-\newcommand\termnuxtitre[1][]{%
- \restoreKV[fakeTERMnux]
- \setKV[fakeTERMnux]{#1}
- \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}}
- \PLUbuntuWhite~~\PLUbuntuWhite~~\PLUbuntuWhite & \vphantom{p}\useKV[fakeTERMnux]{titre} & \PLUbuntuMin~~\PLUbuntuMax~~\PLUbuntuClose \\
- \end{tblr}
-}
-
-\DeclareTCBListing{PLtermunix}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
- PLtermlinux,title={\termnuxtitre[#2]},%
- listing only,listing engine=listings,%
- listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
- width=#1,#3
-}
-
-%OSX
-\tcbset{PLfaketermosx/.style={%
- enhanced,boxrule=1pt,arc=6pt,before skip=12pt,after skip=12pt,%
- colframe=PLosxgray,colback=lightgray!15,colbacktitle=PLosxgray,colupper=black,coltitle=black,%
- titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,%
- fonttitle=\bfseries\small\sffamily
- }
-}
-
-\newcommand{\PLOSXRed}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[red] (0,0.25em) circle[radius=0.45em] ;
- \end{tikzpicture}%
-}
-
-\newcommand{\PLOSXOrange}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[orange] (0,0.25em) circle[radius=0.45em] ;
- \end{tikzpicture}%
-}
-
-\newcommand{\PLOSXGreen}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[ForestGreen] (0,0.25em) circle[radius=0.45em] ;
- \end{tikzpicture}%
-}
-
-\newcommand{\PLOSXLG}{%
- \begin{tikzpicture}[thick,anchor=base,baseline]
- \filldraw[PLosxgray] (0,0.25em) circle[radius=0.45em] ;
- \end{tikzpicture}%
-}
-
-\setKVdefault[fakeTERMosx]{titre={Terminal OSX}}
-
-\newcommand\termosxtitre[1][]{%
- \restoreKV[fakeTERMosx]
- \setKV[fakeTERMosx]{#1}
- \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}}
- \PLOSXRed~\PLOSXOrange~\PLOSXGreen & \vphantom{p}\useKV[fakeTERMosx]{titre} & \PLOSXLG~\PLOSXLG~\PLOSXLG \\
- \end{tblr}
-}
-
-\DeclareTCBListing{PLtermosx}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option]
- PLfaketermosx,title={\termosxtitre[#2]},%
- listing only,listing engine=listings,%
- listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
- width=#1,#3
-}
-
-%============CartoucheCapytale========= OK !!
-\definecolor{vertcapyt}{rgb}{0.0,0.5,0.0}
-%\definecolor{vertcapyt}{HTML}{008000}
-\DeclareTotalTCBox{\liencapytale}{ s O{} m }
- {enhanced,size=fbox,on line,arc=3pt,colback=vertcapyt,colframe=vertcapyt,fontupper=\IfBooleanTF{#1}{\ttfamily}{\sffamily}\bfseries,colupper=white}%
- {#3#2~{\scriptsize\faLink}}
-
-%============PaveDroitTikZ============= OK !!
-\defKV[paramspave]{%
- largeur=\xdef\PFPaveLg{#1},%
- profondeur=\xdef\PFPavePf{#1},%
- hauteur=\xdef\PFPaveHt{#1},%
- angle=\xdef\PFPaveAngl{#1},%
- fuite=\xdef\PFPaveFuite{#1},%
- sommets=\def\PFPaveSommets{#1},%
- epaisseur=\xdef\PFPaveThick{#1}
-}
-\setKVdefault[paramspave]{%
- aff=false,%
- plein=false,%
- largeur=2,%
- profondeur=1,%
- hauteur=1.25,%
- angle=30,%
- fuite=0.5,%
- epaisseur=thick,%
- sommets=A§B§C§D§E§F§G§H,%
- cube=false
-}
-
-\newcommand\pavePL[1][]{%
- \useKVdefault[paramspave]%
- \setKV[paramspave]{#1}%
- \ifboolKV[paramspave]{cube}
- {\xdef\PFPavePf{\PFPaveLg}%
- \xdef\PFPaveHt{\PFPaveLg}}
- {}
- \setsepchar{§}%
- \readlist\PFListeSommets\PFPaveSommets
- \itemtomacro\PFListeSommets[1]\PaveA
- \itemtomacro\PFListeSommets[2]\PaveB
- \itemtomacro\PFListeSommets[3]\PaveC
- \itemtomacro\PFListeSommets[4]\PaveD
- \itemtomacro\PFListeSommets[5]\PaveE
- \itemtomacro\PFListeSommets[6]\PaveF
- \itemtomacro\PFListeSommets[7]\PaveG
- \itemtomacro\PFListeSommets[8]\PaveH
- %les nœuds du pave
- \coordinate (\PaveA) at (0,0) ;
- \coordinate (\PaveB) at ({\PFPaveLg},0) ;
- \coordinate (\PaveC) at ($(\PaveB) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
- \coordinate (\PaveD) at ($(\PaveA) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
- \coordinate (\PaveE) at ($(\PaveA) + (0,{\PFPaveHt})$) ;
- \coordinate (\PaveF) at ($(\PaveB) + (0,{\PFPaveHt})$) ;
- \coordinate (\PaveG) at ($(\PaveC) + (0,{\PFPaveHt})$) ;
- \coordinate (\PaveH) at ($(\PaveD) + (0,{\PFPaveHt})$) ;
- \ifboolKV[paramspave]{aff}
- {\draw (\PaveA) node[below left] {\PaveA} ;
- \draw (\PaveB) node[below right] {\PaveB} ;
- \draw (\PaveC) node[above right] {\PaveC} ;
- \ifboolKV[paramspave]{plein}
- {}
- {\draw (\PaveD) node[above left] {\PaveD} ;}
- \draw (\PaveE) node[below left] {\PaveE} ;
- \draw (\PaveF) node[below right] {\PaveF} ;
- \draw (\PaveG) node[above right] {\PaveG} ;
- \draw (\PaveH) node[above left] {\PaveH} ;}
- {}%on affiche rien
- \draw[\PFPaveThick] (\PaveA)--(\PaveB)--(\PaveF)--(\PaveE)--cycle
- (\PaveB)--(\PaveC)--(\PaveG)--(\PaveF)--cycle
- (\PaveG)--(\PaveH)--(\PaveE) ;
- \ifboolKV[paramspave]{plein}
- {}
- {\draw[dashed,\PFPaveThick] (\PaveA)--(\PaveD)--(\PaveC)
- (\PaveD)--(\PaveH) ;}
-}
-
-%============TétraèdreTikZ============= OK !!
-\defKV[paramstetra]{%
- largeur=\xdef\PFTetraLg{#1},%
- profondeur=\xdef\PFTetraPf{#1},%
- hauteur=\xdef\PFTetraHt{#1},%
- alpha=\xdef\PFTetraAlpha{#1},%
- beta=\xdef\PFTetraBeta{#1},%
- sommets=\def\PFTetraSommets{#1},%
- epaisseur=\xdef\PFTetraThick{#1}
-}
-\setKVdefault[paramstetra]{%
- aff=false,%
- plein=false,%
- largeur=4,%
- profondeur=1.25,%
- hauteur=3,%
- alpha=40,%
- beta=60,%
- epaisseur=thick,%
- sommets=A§B§C§D,%
-}
-
-\newcommand\tetraPL[1][]{%
- \useKVdefault[paramstetra]%
- \setKV[paramstetra]{#1}%
- \setsepchar{§}%
- \readlist\PFListeSommets\PFTetraSommets
- \itemtomacro\PFListeSommets[1]\TetraA
- \itemtomacro\PFListeSommets[2]\TetraB
- \itemtomacro\PFListeSommets[3]\TetraC
- \itemtomacro\PFListeSommets[4]\TetraD
- %les nœuds du tétraèdre
- \coordinate (\TetraA) at (0,0) ;
- \coordinate (\TetraB) at ($(\TetraA) + ({-\PFTetraAlpha}:{\PFTetraPf})$) ;
- \coordinate (\TetraC) at ({\PFTetraLg},0) ;
- \coordinate (\TetraD) at ($(\TetraA) + ({\PFTetraBeta}:{\PFTetraHt})$) ;
- \ifboolKV[paramstetra]{aff}
- {\draw (\TetraA) node[left] {\TetraA} ;
- \draw (\TetraB) node[below] {\TetraB} ;
- \draw (\TetraC) node[right] {\TetraC} ;
- \draw (\TetraD) node[above] {\TetraD} ;}
- {}%on affiche rien
- \draw[\PFTetraThick] (\TetraA)--(\TetraD)--(\TetraC)--(\TetraB)--cycle
- (\TetraD)--(\TetraB) ;
- \ifboolKV[paramstetra]{plein}
- {}
- {\draw[dashed,\PFTetraThick] (\TetraA)--(\TetraC) ;}
-}
-
-%============EnsembleList============== OK !!
-\defKV[kvensemble]{%
- sep=\def\PLenssep{#1},%
- option=\def\PLensopt{#1}
-}
-
-\setKVdefault[kvensemble]{%
- sep={;},%
- mathpunct=true,%
- option={}
-}
-
-\newcommand\ensPL[2][1]{%
- \useKVdefault[kvensemble]%
- \setKV[kvensemble]{#1}%
- \ifboolKV[kvensemble]{mathpunct}%
- {\left\lbrace \PLensopt{} \mathpunct{} \StrSubstitute{#2}{/}{\mathpunct{}{\PLenssep}\mathpunct{}} \mathpunct{} \right\rbrace}%
- {\left\lbrace \PLensopt{} \StrSubstitute{#2}{/}{{\PLenssep}} \right\rbrace}
-}
-
-%===============SimplFrac============== OK !!
-\DeclareDocumentCommand\convertfraction{ O{} m }{% argument optionnel [d ou t] puis argument mandataire {calcul ou fraction}
- \def\calculargument{\xintPRaw{\xintIrr{\xinteval{#2}}}}%on calcule et on transforme en A/B
- \IfSubStr{\calculargument}{/}%on teste si le symbole / apparaît
- {%si oui := fraction
- \StrBefore{\calculargument}{/}[\numerateur]%on extrait le numérateur
- \StrBehind{\calculargument}{/}[\denominateur]%on extrait le dénominateur
- \ifblank{#1}{\ensuremath{\frac{\numerateur}{\denominateur}}}{}%si l'argument optionnel est vide
- \IfStrEq{#1}{d}{\ensuremath{\dfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est d
- \IfStrEq{#1}{t}{\ensuremath{\tfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est t
- }{%si non := entier
- \num{\calculargument}%on affiche l'entier, avec le package siunitx
- }
-}
-
-%================CabWeb================ OK !!
-\defKV[webrecurr]{%
- fct=\def\PLRecurfct{#1},%
- nom=\def\PLRecurnom{#1},%
- no=\def\PLRecurno{#1},%
- nb=\def\PLRecurnb{#1},%
- uno=\def\PLRecuruno{#1},%
- poslabel=\def\PLRecurposlab{#1},%
- decallabel=\def\PLRecuroffset{#1},%
- taillelabel=\def\PLRecurlabelsize{#1},%
-}
-
-\setKVdefault[webrecurr]{
- no=0,%
- nom=u,%
- nb=5,%
- afftermes=true,%
- poslabel=below,%
- decallabel=6pt,%
- taillelabel=\small
-}
-
-%\newcommand\recurr[1][]{%
- \NewDocumentCommand\recurrPL{ O{} O{thick,color=magenta} O{dotted} }{
- %<clés> + <style cabweb> + <style supplémentaire pointillés>
- \useKVdefault[webrecurr]%
- \setKV[webrecurr]{#1}% on paramètres les nouvelles clés et on les simplifie
- \foreach \i [remember=\i as \x (initially \PLRecuruno)] in {1,...,\PLRecurnb}{%
- \def\y{\fpeval{\PLRecurfct}}
- %test de la position courbe / bissectrice ?
- \ifnum \i=1
- \newdimen \X
- \newdimen \Y
- \X = \x pt
- \Y = \y pt
- \ifdim \Y < \X
- \draw[#2] (\x,\y)--(\y,\y) ;
- \else
- \draw[#2] (\x,\x)--(\x,\y)--(\y,\y) ;
- \fi
- \else
- \draw[#2] (\x,\x)--(\x,\y)--(\y,\y) ;
- \fi
- \ifboolKV[webrecurr]{afftermes}
- {\def\indice{\fpeval{\i+\PLRecurno-1}}
- \draw[#2,#3] (\x,\y)--(\x,0) node[\PLRecurposlab=\PLRecuroffset,font=\PLRecurlabelsize]{$\PLRecurnom_\indice$};}
- {}
- \def\i{\fpeval{\y}}%
- }
- }
-
-%================CercleTrigo=========== OK !!
-\defKV[cercletrigo]{%
- rayon=\def\PLcerclerayon{#1},%
- epaisseur=\def\PLcerclethick{#1},%
- epaisseursol=\def\PLcerclesolthick{#1},%
- marge=\def\PLcerclemarge{#1},%
- taillevaleurs=\def\PLcerclevaleurs{#1},%
- tailleangles=\def\PLcercleangles{#1},%
- couleurfond=\def\PLcerclefond{#1},%
- decal=\def\PLcercledecal{#1},%
- cos=\def\PLcerclevalcos{#1},%
- sin=\def\PLcerclevalsin{#1},%
- couleursol=\def\PLcerclecoleq{#1}
-}
-
-\setKVdefault[cercletrigo]{
- rayon=3,%
- marge=0.25,%
- decal=10pt,%
- epaisseur=thick,%
- epaisseursol=very thick,%
- affangles=true,%
- afftraits=true,%
- affvaleurs=true,%
- moinspi=true,%
- taillevaleurs=\scriptsize,%
- tailleangles=\footnotesize,%
- couleurfond=white,%
- equationcos=false,%
- equationsin=false,%
- cos=45,%
- sin=30,%
- couleursol=blue
-}
-
-\newcommand\cercletrigoPL[1][]{%
- \useKVdefault[cercletrigo]
- \setKV[cercletrigo]{#1}
- \tikzset{PLval/.style={inner sep=1pt,font=\PLcerclevaleurs,fill=\PLcerclefond}}
- \tikzset{PLagl/.style={inner sep=1pt,font=\PLcercleangles,fill=\PLcerclefond}}
- %valeurs remarquables
- \ifboolKV[cercletrigo]{affangles}
- {%valeursdudessus
- \draw ({\PLcerclerayon},0) node[above right=2pt,font=\PLcercleangles] {0} ;
- \draw ($(30:{\PLcerclerayon})+(30:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{6}$} ;
- \draw ($(45:{\PLcerclerayon})+(45:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{4}$} ;
- \draw ($(60:{\PLcerclerayon})+(60:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{3}$} ;
- \draw (0,{\PLcerclerayon}) node[above right=2pt,PLagl] {$\tfrac{\pi}{2}$} ;
- \draw ({-\PLcerclerayon},0) node[above left=2pt,PLagl] {$\pi$} ;
- \draw ($(150:{\PLcerclerayon})+(150:\PLcercledecal)$) node[PLagl] {$\tfrac{5\pi}{6}$} ;
- \draw ($(135:{\PLcerclerayon})+(135:\PLcercledecal)$) node[PLagl] {$\tfrac{3\pi}{4}$} ;
- \draw ($(120:{\PLcerclerayon})+(120:\PLcercledecal)$) node[PLagl] {$\tfrac{2\pi}{3}$} ;
- \draw ($(30:{\PLcerclerayon})+(30:\PLcercledecal)$) node[PLagl] {$\tfrac{\pi}{6}$} ;
- %valeursdudessous
- \draw ($(-30:{\PLcerclerayon})+(-30:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{11}\pi}{6}$} ;
- \draw ($(-45:{\PLcerclerayon})+(-45:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{7}\pi}{4}$} ;
- \draw ($(-60:{\PLcerclerayon})+(-60:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{5}\pi}{3}$} ;
- \draw (0,{-\PLcerclerayon}) node[below right=2pt,PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-}{3}\pi}{2}$} ;
- \draw ($(-120:{\PLcerclerayon})+(-120:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-2}{4}\pi}{3}$} ;
- \draw ($(-135:{\PLcerclerayon})+(-135:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-3}{5}\pi}{4}$} ;
- \draw ($(-150:{\PLcerclerayon})+(-150:\PLcercledecal)$) node[PLagl] {$\tfrac{\ifboolKV[cercletrigo]{moinspi}{-5}{7}\pi}{6}$} ;
- \ifboolKV[cercletrigo]{moinspi}
- {\draw ({-\PLcerclerayon},0) node[below left=2pt,PLagl] {$-\pi$} ;}
- {\draw ({\PLcerclerayon},0) node[below right=2pt,PLagl] {$2\pi$} ;}
- }%
- {}
- %tracés
- \draw[\PLcerclethick,->] ({-\PLcerclerayon-\PLcerclemarge},0)--({\PLcerclerayon+\PLcerclemarge},0) ;
- \draw[\PLcerclethick,->] (0,{-\PLcerclerayon-\PLcerclemarge})--(0,{\PLcerclerayon+\PLcerclemarge}) ;
- \draw[\PLcerclethick] (0,0) circle[radius=\PLcerclerayon] ;
- \draw (0,0) node[below left=2pt,PLval] {0} ;
- %equations
- \ifboolKV[cercletrigo]{equationcos}
- {%traitsdeconstructioncos
- \draw[\PLcerclethick,dotted,gray] (-45:\PLcerclerayon) -- (135:\PLcerclerayon)
- (-135:\PLcerclerayon) -- (45:\PLcerclerayon)
- (30:\PLcerclerayon) -- (150:\PLcerclerayon)
- (-30:\PLcerclerayon) -- (-150:\PLcerclerayon)
- (-60:\PLcerclerayon)--(60:\PLcerclerayon)
- (-120:\PLcerclerayon)--(120:\PLcerclerayon) ;
- \draw[\PLcerclesolthick,\PLcerclecoleq] ({\PLcerclevalcos}:\PLcerclerayon)--({-\PLcerclevalcos}:\PLcerclerayon) ;
- \filldraw[\PLcerclecoleq] ({\PLcerclevalcos}:\PLcerclerayon) circle[radius=2pt] ({-\PLcerclevalcos}:\PLcerclerayon) circle[radius=2pt] ;%
- }
- {}
- \ifboolKV[cercletrigo]{equationsin}
- {%traitsdeconstructioncos
- \draw[\PLcerclethick,dotted,gray] (-45:\PLcerclerayon) -- (135:\PLcerclerayon)
- (-135:\PLcerclerayon) -- (45:\PLcerclerayon)
- (30:\PLcerclerayon) -- (150:\PLcerclerayon)
- (-30:\PLcerclerayon) -- (-150:\PLcerclerayon)
- (-60:\PLcerclerayon)--(60:\PLcerclerayon)
- (-120:\PLcerclerayon)--(120:\PLcerclerayon) ;
- \draw[\PLcerclesolthick,\PLcerclecoleq] ({\PLcerclevalsin}:\PLcerclerayon)--({180-\PLcerclevalsin}:\PLcerclerayon) ;
- \filldraw[\PLcerclecoleq] ({\PLcerclevalsin}:\PLcerclerayon) circle[radius=2pt] ({180-\PLcerclevalsin}:\PLcerclerayon) circle[radius=2pt] ;%
- }
- {}
- %valeurs
- \ifboolKV[cercletrigo]{affvaleurs}
- {%
- \draw ({0.5*\PLcerclerayon},0) node[below=2pt,PLval] {$\tfrac{1}{2}$} ;
- \draw ({-0.5*\PLcerclerayon},0) node[below=2pt,PLval] {$-\tfrac{1}{2}$} ;
- \draw (0,{0.5*\PLcerclerayon}) node[left=2pt,PLval] {$\tfrac{1}{2}$} ;
- \draw (0,{-0.5*\PLcerclerayon}) node[left=2pt,PLval] {$-\tfrac{1}{2}$} ;
- \draw ({0.866*\PLcerclerayon},0) node[below=2pt,PLval] {$\tfrac{\sqrt{3}}{2}$} ;
- \draw ({-0.866*\PLcerclerayon},0) node[below=2pt,PLval] {$-\tfrac{\sqrt{3}}{2}$} ;
- \draw (0,{0.866*\PLcerclerayon}) node[left=2pt,PLval] {$\tfrac{\sqrt{3}}{2}$} ;
- \draw (0,{-0.866*\PLcerclerayon}) node[left=2pt,PLval] {$-\tfrac{\sqrt{3}}{2}$} ;
- \draw ({0.707*\PLcerclerayon},0) node[above=2pt,PLval] {$\tfrac{\sqrt{2}}{2}$} ;
- \draw ({-0.707*\PLcerclerayon},0) node[above=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
- \draw (0,{0.707*\PLcerclerayon}) node[right=2pt,PLval] {$\tfrac{\sqrt{2}}{2}$} ;
- \draw (0,{-0.707*\PLcerclerayon}) node[right=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
- }%
- {}
- %valeurs remarquables en dernier
- \ifboolKV[cercletrigo]{afftraits}
- {%
- \draw[\PLcerclethick,dotted,gray] (-120:\PLcerclerayon) rectangle (60:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (-150:\PLcerclerayon) rectangle (30:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (-135:\PLcerclerayon) rectangle (45:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (-120:\PLcerclerayon)--(60:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (-150:\PLcerclerayon)--(30:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (-135:\PLcerclerayon)--(45:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (120:\PLcerclerayon)--(-60:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (150:\PLcerclerayon)--(-30:\PLcerclerayon) ;
- \draw[\PLcerclethick,dotted,gray] (135:\PLcerclerayon)--(-45:\PLcerclerayon) ;
- }%
- {}
-}
-
-%==================AideTds============= OK !!
-\defKV[aidetds]{%
- code=\def\tdsparam{#1},%
- couleur=\def\tdscouleur{#1},%
- racines=\def\tdsracine{#1},%
- largeur=\def\tdslarg{#1},%
- hauteur=\def\tdshaut{#1}
-}
-
-\setKVdefault[aidetds]{%
- code=da+,
- couleur=red,%
- largeur=2,%
- hauteur=1,%
- cadre=true,%
- racines=2
-}
-
-\NewDocumentCommand\schematdsaff{ s m m m m }{%pour les droites (interne)
- % * = étoilée -> a négatif
- % #2 = couleur
- % #3 = largeur
- % #4 = hauteur
- % #5 = racine
- \IfBooleanTF{#1}%si étoile := droite qui descend
- {%
- \def\possgnavant{above right}\def\possgnapres{below left}\def\sgnavant{\strut+}\def\sgnapres{\strut-}%
- \draw[thick,#2] ({-0.5*#3},{0.5*#4})--({0.5*#3},{-0.5*#4});
- }
- {%
- \def\possgnavant{below right}\def\possgnapres{above left}\def\sgnavant{\strut-}\def\sgnapres{\strut+}%
- \draw[thick,#2] ({-0.5*#3},{-0.5*#4})--({0.5*#3},{0.5*#4});
- }
- \draw[#2] ({-0.5*#3},0) node[inner sep=0pt,\possgnavant=1pt,font=\scriptsize] {\textcircled{$\sgnavant$}};
- \draw[#2] ({0.5*#3},0) node[inner sep=0pt,\possgnapres=1pt,font=\scriptsize] {\textcircled{$\sgnapres$}};
- \draw[#2] (0,0) node[inner sep=0pt,above=3pt,font=\scriptsize] {$\strut#5$} ;
- \filldraw[#2] (0,0) circle[radius=2pt] ;
-}
-
-\NewDocumentCommand\schematdsparab{ m m m m m o }{%pour les paraboles (interne)
- % #1 = signe de a (1 ou -1) ?
- % #2 = couleur
- % #3 = largeur
- % #4 = hauteur
- % #5 = nb racine
- % #6 = liste racines (option)
- \xintifboolexpr{ #1 > 0 'and' #5 == 2 } %a>0 et delta>0
- {%
- \StrCut{#6}{/}{\xun}{\xdeux}
- \draw[thick,#2] ({-0.375*#3},{0.5*#4}) parabola bend (0,{-0.5*#4}) ({0.375*#3},{0.5*#4}) ;
- \draw[#2] ({-0.5*#3},0) node[above right=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut+$}};
- \draw[#2] ({0.5*#3},0) node[above left=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut+$}};
- \draw[#2] (0,0) node[below=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut-$}};
- \filldraw[#2] ({0.2625*#3},0) circle[radius=2pt] node[below right=1pt,inner sep=0pt,font=\scriptsize] {$\strut\xdeux$};
- \filldraw[#2] ({-0.2625*#3},0) circle[radius=2pt] node[below left=1pt,inner sep=0pt,font=\scriptsize] {$\strut\xun$};%
- }
- {}
- \xintifboolexpr{ #1 < 0 'and' #5 == 2 } %a<0 et delta>0
- {%
- \StrCut{#6}{/}{\xun}{\xdeux}
- \draw[thick,#2] ({-0.375*#3},{-0.5*#4}) parabola bend (0,{0.5*#4}) ({0.375*#3},{-0.5*#4}) ;
- \draw[#2] ({-0.5*#3},0) node[below right=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut-$}};
- \draw[#2] ({0.5*#3},0) node[below left=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut-$}};
- \draw[#2] (0,0) node[above=1pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut+$}};
- \filldraw[#2] ({0.2625*#3},0) circle[radius=2pt] node[above right=1pt,inner sep=0pt,font=\scriptsize] {$\strut\xdeux$};
- \filldraw[#2] ({-0.2625*#3},0) circle[radius=2pt] node[above left=1pt,inner sep=0pt,font=\scriptsize] {$\strut\xun$};%
- }
- {}
- \xintifboolexpr{ #1 > 0 'and' #5 == 1 } %a>0 et delta=0
- {%
- \draw[thick,#2] ({-0.375*#3},{0.5*#4}) parabola bend (0,0) ({0.375*#3},{0.5*#4}) ;
- \filldraw[#2] (0,0) circle[radius=2pt] node[below=3pt,inner sep=1pt,font=\scriptsize] {$#6$};
- \draw[#2] (0,0) node[above=3pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut+$}};
- }
- {}
- \xintifboolexpr{ #1 < 0 'and' #5 == 1 } %a>0 et delta=0
- {%
- \draw[thick,#2] ({-0.375*#3},{-0.5*#4}) parabola bend (0,0) ({0.375*#3},{-0.5*#4}) ;
- \filldraw[#2] (0,0) circle[radius=2pt] node[above=3pt,inner sep=0pt,font=\scriptsize] {$#6$};
- \draw[#2] (0,0) node[below=3pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut-$}};
- }
- {}
- \xintifboolexpr{ #1 > 0 'and' #5 == 0 } %a>0 et delta<0
- {%
- \draw[thick,#2] ({-0.375*#3},{0.5*#4}) parabola bend (0,{0.075*#4}) ({0.375*#3},{0.5*#4}) ;
- \draw[#2] (0,{0.075*#4}) node[above=2pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut+$}};
- }
- {}
- \xintifboolexpr{ #1 < 0 'and' #5 == 0 } %a>0 et delta<0
- {%
- \draw[thick,#2] ({-0.375*#3},{-0.5*#4}) parabola bend (0,{-0.075*#4}) ({0.375*#3},{-0.5*#4}) ;
- \draw[#2] (0,{-0.075*#4}) node[below=2pt,inner sep=0pt,font=\scriptsize] {\textcircled{$\strut-$}};
- }
- {}
-}
-
-\newcommand\aidesignePL[1][]{%
- \useKVdefault[aidetds]
- \setKV[aidetds]{#1}
- %simplification des codes
- \IfEq{\tdsparam}{da+}{\def\xcode{1}}{}
- \IfEq{\tdsparam}{da-}{\def\xcode{-1}}{}
- \IfEq{\tdsparam}{pa+d+}{\def\xcode{12}}{}
- \IfEq{\tdsparam}{pa-d+}{\def\xcode{-12}}{}
- \IfEq{\tdsparam}{pa+d0}{\def\xcode{11}}{}
- \IfEq{\tdsparam}{pa-d0}{\def\xcode{-11}}{}
- \IfEq{\tdsparam}{pa+d-}{\def\xcode{10}}{}
- \IfEq{\tdsparam}{pa-d-}{\def\xcode{-10}}{}
- %cadre si booléen true
- \ifboolKV[aidetds]{cadre}
- {\draw[lightgray] ({-0.5*\tdslarg},{-0.5*\tdshaut}) rectangle ({0.55*\tdslarg},{0.5*\tdshaut}) ;}
- {}
- %restriction de la petite fenêtre
- \clip ({-0.5*\tdslarg},{-0.5*\tdshaut}) rectangle ({0.55*\tdslarg},{0.5*\tdshaut}) ;
- %axe (Ox)
- \draw[thick,->] ({-0.5*\tdslarg},0)--({0.55*\tdslarg},0);
- %1er degré a+ code = 1
- \ifnum\xcode=1
- \schematdsaff{\tdscouleur}{\tdslarg}{\tdshaut}{\tdsracine}
- \fi
- %1er degré a- code = -1
- \ifnum\xcode=-1
- \schematdsaff*{\tdscouleur}{\tdslarg}{\tdshaut}{\tdsracine}
- \fi
- %2d degré a+delta+ code = 12
- \ifnum\xcode=12
- \schematdsparab{1}{\tdscouleur}{\tdslarg}{\tdshaut}{2}[\tdsracine]
- \fi
- %2d degré a-delta+ code = -12
- \ifnum\xcode=-12
- \schematdsparab{-1}{\tdscouleur}{\tdslarg}{\tdshaut}{2}[\tdsracine]
- \fi
- %2d degré a+delta0 code = 11
- \ifnum\xcode=11
- \schematdsparab{1}{\tdscouleur}{\tdslarg}{\tdshaut}{1}[\tdsracine]
- \fi
- %2d degré a-delta0 code = -11
- \ifnum\xcode=-11
- \schematdsparab{-1}{\tdscouleur}{\tdslarg}{\tdshaut}{1}[\tdsracine]
- \fi
- %2d degré a+delta- code = 10
- \ifnum\xcode=10
- \schematdsparab{1}{\tdscouleur}{\tdslarg}{\tdshaut}{0}
- \fi
- %2d degré a-delta- code = -10
- \ifnum\xcode=-10
- \schematdsparab{-1}{\tdscouleur}{\tdslarg}{\tdshaut}{0}
- \fi
-}
-
-%pour l'interaction avec tkz-tab
-\defKV[aidetdstkz]{%
- echelle=\def\tdstkzscale{#1},%
- decal=\def\tdstkzoffset{#1}
-}
-
-\setKVdefault[aidetdstkz]{%
- echelle=1,%
- decal=1.25
-}
-
-\NewDocumentCommand\aidesignetkztabPL{ o m O{0.85} O{1.5} }{%
- %#1 = codeaidetikz
- %#2 = numligne
- %#3 = échelle
- %#4 = décalage
- %\shorthandoff{:}\shorthandoff{!} %bizzzzzzzzare
- %\NoAutoSpacing
- \coordinate (Z) at ($(T2#2)!.5!(T2\the\numexpr#2+1\relax)$) ;
- %\shorthandon{:}\shorthandon{!}
- \path (Z.east) + (#4,0) pic[right,scale=#3,every node/.style={scale=#3}] {code={\aidesignePL[#1]}} ;
-}
-
-%=============RegressionLinéaire======= OK !!
-%calcul des paramètres
-\defKV[coeffreglin]{%
- nomcoeffa=\def\RegLinCoeffa{#1},%
- nomcoeffb=\def\RegLinCoeffb{#1},%
- nomcoeffr=\def\RegLinCoeffr{#1},%
- nomcoeffrd=\def\RegLinCoeffrd{#1},%
- nomxmin=\def\RegLinCoeffXmin{#1},%
- nomxmax=\def\RegLinCoeffXmax{#1}
-}
-
-\setKVdefault[coeffreglin]{%
- nomcoeffa=COEFFa,%
- nomcoeffb=COEFFb,%
- nomcoeffr=COEFFr,%
- nomcoeffrd=COEFFrd,%
- nomxmin=LXmin,%
- nomxmax=LXmax
-}
-
-\newcommand\PLreglin[3][]{
- \useKVdefault[coeffreglin]
- \setKV[coeffreglin]{#1}% on paramètres les nouvelles clés et on les simplifie
- %xmin et xmax
- \expandafter\def\csname\RegLinCoeffXmin\endcsname{\fpeval{min(#2)}}
- \expandafter\def\csname\RegLinCoeffXmax\endcsname{\fpeval{max(#2)}}
- %listes des données
- \def\xliste{#2}
- \def\yliste{#3}
- \readlist*\LX{\xliste}
- \readlist*\LY{\yliste}
- %taille des listes
- \def\LNB{\inteval{\LXlen}}
- %somme des LX et des LY OK
- \xdef\LXSomme{0}
- \xdef\LYSomme{0}
- \foreach \i in {1,2,...,\LNB}{
- \xdef\LXSomme{\fpeval{\LXSomme+\LX[\i]}}
- }
- \foreach \i in {1,2,...,\LNB}{
- \xdef\LYSomme{\fpeval{\LYSomme+\LY[\i]}}
- }
- %moyenne des LX et des LY OK
- \xdef\LXmoy{\fpeval{\LXSomme/\LNB}}
- \xdef\LYmoy{\fpeval{\LYSomme/\LNB}}
- %variance des LX et des LY OK
- \xdef\LXvar{0}
- \foreach \i in {1,2,...,\LNB}{
- \xdef\LXvar{\fpeval{\LXvar+(\LX[\i]-\LXmoy)*(\LX[\i]-\LXmoy)}}
- }
- \xdef\LXvar{\fpeval{\LXvar/\LNB}}
- \xdef\LYvar{0}
- \foreach \i in {1,2,...,\LNB}{
- \xdef\LYvar{\fpeval{\LYvar+(\LY[\i]-\LYmoy)*(\LY[\i]-\LYmoy)}}
- }
- \xdef\LYvar{\fpeval{\LYvar/\LNB}}
- %covariance des XY OK
- \xdef\LXYvar{0}
- \foreach \i in {1,2,...,\LNB}{
- \xdef\LXYvar{\fpeval{\LXYvar+(\LX[\i]-\LXmoy)*(\LY[\i]-\LYmoy)}}
- }
- \xdef\LXYvar{\fpeval{\LXYvar/\LNB}}
- %COEFFS OK
- \expandafter\def\csname\RegLinCoeffa\endcsname{\fpeval{\LXYvar/\LXvar}}
- \expandafter\def\csname\RegLinCoeffb\endcsname{\fpeval{\LYmoy-\csname\RegLinCoeffa\endcsname*\LXmoy}}
- \expandafter\def\csname\RegLinCoeffr\endcsname{\fpeval{\LXYvar/sqrt(\LXvar*\LYvar)}}
- \expandafter\def\csname\RegLinCoeffrd\endcsname{\fpeval{\csname\RegLinCoeffr\endcsname*\csname\RegLinCoeffr\endcsname}}
-}
-
-%pour un nuage en TiKz
-\defKV[nuagereglin]{%
- couleur=\def\RegLinNuageCouleur{#1},%
- taille=\def\RegLinNuageTaille{#1},
- Ox=\def\RegLinNuageOx{#1},%
- Oy=\def\RegLinNuageOy{#1},%
-}
-
-\setKVdefault[nuagereglin]{%
- couleur=teal,%
- taille=2pt,%
- Ox=0,%
- Oy=0
-}
-
-\newcommand\PLreglinpts[3][]{%
- \useKVdefault[nuagereglin]
- \setKV[nuagereglin]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\xliste{#2}
- \def\yliste{#3}
- \readlist*\LX{\xliste}
- \readlist*\LY{\yliste}
- %taille des listes
- \def\LNB{\inteval{\LXlen}}
- \foreach \i in {1,2,...,\LNB} {\filldraw[\RegLinNuageCouleur] ({\LX[\i]-\RegLinNuageOx},{\LY[\i]-\RegLinNuageOy}) circle[radius=\RegLinNuageTaille] ;}
-}
-
-%=============ConversionsBases========= OK !!
-%dec->bin avec blocs de 4 chiffres
-\setKVdefault[CONVDECBIN]{%
- affbase=true
-}
-\NewDocumentCommand\PLconvdecbin{ s O{} m }{%
- \useKVdefault[CONVDECBIN]
- \setKV[CONVDECBIN]{#2}% on paramètres les nouvelles clés et on les simplifie
- \def\resbrut{\xintDecToBin{#3}}
- \StrLen{\resbrut}[\nbchiffres]
- \def\nbgrp{\fpeval{4*ceil(\nbchiffres/4,0)}}
- \IfBooleanTF{#1}
- {\num{#3}\ifboolKV[CONVDECBIN]{affbase}{_{10}}{}=\num[digit-group-size=4]{\resbrut}\ifboolKV[CONVDECBIN]{affbase}{_{2}}{}}
- {\num{#3}\ifboolKV[CONVDECBIN]{affbase}{_{10}}{}=\num[digit-group-size=4,minimum-integer-digits=\nbgrp]{\resbrut}\ifboolKV[CONVDECBIN]{affbase}{_{2}}{}}
-}
-
-%bin->hexa avec blocs de 4 chiffres
-%\defKV[CONVBINHEX]{%
-% trait=\def\epcrochet{#1}
-%}
-\setKVdefault[CONVBINHEX]{%
- %trait=0.5pt,%
- affbase=true,%
- details=true
-}
-%bourrage de 0 avant
-\ExplSyntaxOn
-\NewExpandableDocumentCommand{\PLstrzeros}{m}
-{
- \int_compare:nT { #1 > 0 }
- {
- 0 \prg_replicate:nn { #1 - 1 } { 0 }
- }
-}
-\ExplSyntaxOff
-
-
-%la conversion complète
-\newcommand\PLconvbinhex[2][]{%
- \useKVdefault[CONVBINHEX]
- \setKV[CONVBINHEX]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\chbrut{#2}
- \StrLen{\chbrut}[\nbchiffres] %nb de chiffres du binaire
- \xdef\nbgrp{\fpeval{4*ceil(\nbchiffres/4,0)}} %nb de chiffres avec blocs de 4
- \xdef\nbblocs{\fpeval{\nbgrp/4}} %nb de blocs
- %on rajoute des zeros si besoin := OK
- \xdef\resinter{\chbrut}
- \num[digit-group-size=4]{\chbrut}\ifboolKV[CONVBINHEX]{affbase}{_{2}}{}=
- \ifboolKV[CONVBINHEX]{details}{%
- \ifnum\nbchiffres<\nbgrp
- \xdef\nbz{\inteval{\nbgrp-\nbchiffres}}
- \xdef\resinter{\PLstrzeros{\nbz}\chbrut}
- \num[digit-group-size=4,minimum-integer-digits=\nbgrp]{\resinter}=
- \fi
- %découpage par blocs et conversion en hexa := OK
- \newcount\cpt
- \cpt0
- \loop\ifnum \cpt<\nbblocs
- \def\iinit{\fpeval{4*\cpt+1}}%
- \def\ifinal{\fpeval{4*(\cpt+1)}}%
- \StrMid{\resinter}{\iinit}{\ifinal}[\blocinter]%
- {\underbracket{\blocinter}_{\xintBinToHex{\blocinter}}\,}
- \advance\cpt by 1
- \repeat
- \!=
- }%
- {}
- \xintBinToHex{\chbrut}\ifboolKV[CONVBINHEX]{affbase}{_{16}}{}
-}
-
-%bin/hexa/bin->dec avec écriture polynomiale
-\defKV[CONVTODEC]{%
- basedep=\def\basedepart{#1}
-}
-\setKVdefault[CONVTODEC]{%
- basedep=2,%
- affbase=true,%
- details=true,%
- zeros=true
-}
-
-\ExplSyntaxOn
-\newcommand\convertbasetobasedix[2]{%
- \int_from_base:nn {#1}{#2}
-}
-\ExplSyntaxOff
-
-\newcommand\PLconvtodec[2][]{%
- \useKVdefault[CONVTODEC]
- \setKV[CONVTODEC]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\nbdepart{#2}
- \StrLen{\nbdepart}[\nbchiffres]
- \StrChar{\nbdepart}{1}[\chiffre]
- %si on est en base 16
- \xintifboolexpr{\basedepart == 16}%
- {%
- \nbdepart\ifboolKV[CONVTODEC]{affbase}{_{\basedepart}}{} =
- \ifboolKV[CONVTODEC]{details}{%
- \xintHexToDec{\chiffre}\times\basedepart^{\inteval{\nbchiffres-1}}%
- \newcount\cpt
- \cpt2
- \loop\ifnum \cpt<\inteval{\nbchiffres+1}
- \def\puiss{\inteval{\nbchiffres-\cpt}}
- \StrChar{\nbdepart}{\cpt}[\chiffre]
- \ifboolKV[CONVTODEC]{zeros}%
- {%
- +\xintHexToDec{\chiffre}\times\basedepart^{\puiss}%
- }
- {
- \ifnum\xintHexToDec{\chiffre} > 0
- +\xintHexToDec{\chiffre}\times\basedepart^{\puiss}%
- \fi
- }
- \advance\cpt by 1
- \repeat
- =
- }
- {}
- \num{\xintHexToDec{\nbdepart}}\ifboolKV[CONVTODEC]{affbase}{_{10}}{}
- }%
- {}
- \xintifboolexpr{\basedepart == 2}%
- {%
- \num[digit-group-size=4]{\nbdepart}\ifboolKV[CONVTODEC]{affbase}{_{\basedepart}}{} =
- \ifboolKV[CONVTODEC]{details}{%
- \chiffre\times\basedepart^{\inteval{\nbchiffres-1}}%
- \newcount\cpt
- \cpt2
- \loop\ifnum \cpt<\inteval{\nbchiffres+1}
- \def\puiss{\inteval{\nbchiffres-\cpt}}
- \StrChar{\nbdepart}{\cpt}[\chiffre]
- \ifboolKV[CONVTODEC]{zeros}%
- {%
- +\chiffre\times\basedepart^{\puiss}%
- }
- {
- \ifnum\chiffre > 0
- +\chiffre\times\basedepart^{\puiss}%
- \fi
- }
- \advance\cpt by 1
- \repeat
- =
- }
- {}
- \num{\xintBinToDec{\nbdepart}}\ifboolKV[CONVTODEC]{affbase}{_{10}}{}
- }%
- {}
-}
-
-\newcommand\PLconvversdix[3][]{%1=options,%2=nb,%3=basedep
- \useKVdefault[CONVTODEC]
- \setKV[CONVTODEC]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\NBdepart{#2}
- \def\basedepart{#3}
- \StrLen{\NBdepart}[\nbchiffres]
- \StrChar{\NBdepart}{1}[\chiffre]
- \NBdepart\ifboolKV[CONVTODEC]{affbase}{_{\basedepart}}{} =
- \ifboolKV[CONVTODEC]{details}{%
- \xintHexToDec{\chiffre}\times\basedepart^{\inteval{\nbchiffres-1}}%
- \newcount\cpt
- \cpt2
- \loop\ifnum \cpt<\inteval{\nbchiffres+1}
- \def\puiss{\inteval{\nbchiffres-\cpt}}
- \StrChar{\NBdepart}{\cpt}[\chiffre]
- \ifboolKV[CONVTODEC]{zeros}%
- {%
- +\xintHexToDec{\chiffre}\times\basedepart^{\puiss}%
- }
- {
- \ifnum\xintHexToDec{\chiffre} > 0
- +\xintHexToDec{\chiffre}\times\basedepart^{\puiss}%
- \fi
- }
- \advance\cpt by 1
- \repeat
- =
- }
- {}
- \num{\convertbasetobasedix{#2}{#3}}\ifboolKV[CONVTODEC]{affbase}{_{10}}{}
-}
-
-%==============MainLevée TikZ========== OK !!
-\tikzset{%
- mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}},
- mainlevee/.default={5mm et 0.6pt}
-}
-
-%==============PixelArt TikZ=========== OK !!
-\defKV[pixelarttkz]{%
- codes=\def\PATlettres{#1},%
- couleurs=\def\PATcouleurs{#1},%
- symboles=\def\PATchiffres{#1},%
- style=\def\PATtaille{#1}
-}
-
-\setKVdefault[pixelarttkz]{%
- style=\scriptsize,%
- correction=false,%
- symb=false,%
- bordcases=true
-}
-
-\newcommand\PLpixelart[2][]{%
- \useKVdefault[pixelarttkz]
- \setKV[pixelarttkz]{#1}
- %affichage du corrigé
- \ifboolKV[pixelarttkz]{correction}
- {%
- \csvloop{file=#2,no head,command={%
- \foreach \l [count=\n] in \csvline {%
- \StrDel{\l}{ }[\l]
- \setsepchar{,}
- \readlist\LCPA\PATcouleurs
- \StrPosition{\PATlettres}{\l}[\pixcnt]%
- \xintifboolexpr{\pixcnt>0}%
- {%
- \itemtomacro\LCPA[\pixcnt]\pixcol%
- \ifboolKV[pixelarttkz]{bordcases}%
- {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
- {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
- %
- }%
- {}
- }
- }
- }
- }
- {%
- \ifboolKV[pixelarttkz]{symb}
- {%affichage du pixelart versions chiffres si besoin
- \csvloop{file=#2,no head,command={%
- \foreach \l [count=\n] in \csvline {%
- \StrDel{\l}{ }[\l]
- \setsepchar{,}
- \readlist\LCNA\PATchiffres
- \StrPosition{\PATlettres}{\l}[\pixpos]%
- \xintifboolexpr{\pixpos>0}%
- {%
- \itemtomacro\LCNA[\pixpos]\pixchf%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\pixchf} ;%
- }
- {}%
- }
- }
- }
- }
- {%affichage du pixelart versions lettres ou chiffres simples (<=9)
- \csvloop{file=#2,no head,command={%
- \foreach \l [count=\n] in \csvline {%
- \StrDel{\l}{ }[\l]
- \IfSubStr{\PATlettres}{\l}%
- {%
- \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};}
- {}
- }
- }
- }
- }
- }
-}
-
-%=========STATS2VAR=========
-%variables directement dans tikzpicture
-\tikzset{%
- Ox/.store in=\axexOx,Ox/.default=0,Ox=0,%essai
- Oy/.store in=\axeyOy,Oy/.default=0,Oy=0,%essai
- xmin/.store in=\xmin,xmin/.default=-5,xmin=-5,
- xmax/.store in=\xmax,xmax/.default=5,xmax=5,
- ymin/.store in=\ymin,ymin/.default=-5,ymin=-5,
- ymax/.store in=\ymax,ymax/.default=5,ymax=5,
- xgrille/.store in=\xgrille,xgrille/.default=1,xgrille=1,
- xgrilles/.store in=\xgrilles,xgrilles/.default=0.5,xgrilles=0.5,
- ygrille/.store in=\ygrille,ygrille/.default=1,ygrille=1,
- ygrilles/.store in=\ygrilles,ygrilles/.default=0.5,ygrilles=0.5,
- xunit/.store in=\xunit,xunit/.default=1,xunit=1,
- yunit/.store in=\yunit,yunit/.default=1,yunit=1
-}
-
-%style point croix
-\tikzset{pics/PLdotcross/.style args={#1/#2}{
- code={
- \draw[line width={0.5*#1},rotate=#2] (-#1,0) -- (#1,0);
- \draw[line width={0.5*#1},rotate=#2] (0,-#1) -- (0, #1);
- }
- },
- pics/PLdotcross/.default={4pt/0}
-}
-
-%axeOx
-\defKV[PLaxextkz]{%
- epaisseur=\def\axexwidth{#1},%
- police=\def\axexfont{#1},%
- hautgrad=\def\axextickwidth{#1},%
- posgrad=\def\axexposlabel{#1}
-}
-
-\setKVdefault[PLaxextkz]{%
- epaisseur=1.25pt,%
- police=\normalsize\normalfont,%
- posgrad=below,%
- hautgrad=4pt,%
- affgrad=true,%
- afforigine=true,%
- annee=false
-}
-
-\DeclareDocumentCommand\PLaxextikz{ O{} m }{%
- \useKVdefault[PLaxextkz]
- \setKV[PLaxextkz]{#1}% on paramètres les nouvelles clés et on les simplifie
- %formatage des années
- \IfSubStr{\axextickwidth}{/}
- {\StrCut{\axextickwidth}{/}{\axextickwidthA}{\axextickwidthB}}
- {\def\axextickwidthA{\axextickwidth}\def\axextickwidthB{\axextickwidth}}
- \foreach \x in {#2}{%
- \draw[line width=\axexwidth] ({\x-\axexOx},{\axextickwidthA}) -- ({\x-\axexOx},{-\axextickwidthB})%
- \ifboolKV[PLaxextkz]{affgrad}%on affiche les graduations
- {%
- \ifboolKV[PLaxextkz]{afforigine}%si on demande d'afficher l'origine
- {node[\axexposlabel,font=\axexfont]
- {\ifboolKV[PLaxextkz]{annee}%
- {\num[group-digits=none]{\x}}%
- {\num[text-family-to-math=true,text-series-to-math=true]{\x}}%
- }
- }
- {\xintifboolexpr{\x==\axexOx}{}{node[\axexposlabel,font=\axexfont] {\ifboolKV[PLaxextkz]{annee}%
- {\num[group-digits=none]{\x}}%
- {\num[text-family-to-math=true,text-series-to-math=true]{\x}}%
- }
- }
- }
- }
- {}
- ;}
-}
-
-%axeOy
-\defKV[PLaxeytkz]{%
- epaisseur=\def\axeywidth{#1},%
- police=\def\axeyfont{#1},%
- hautgrad=\def\axeytickwidth{#1},%
- posgrad=\def\axeyposlabel{#1}
-}
-
-\setKVdefault[PLaxeytkz]{%
- epaisseur=1.25pt,%
- police=\normalsize\normalfont,%
- posgrad=left,%
- hautgrad=4pt,%
- affgrad=true,%
- afforigine=true,%
- annee=false
-}
-
-\DeclareDocumentCommand\PLaxeytikz{ O{} m }{%
- \useKVdefault[PLaxeytkz]
- \setKV[PLaxeytkz]{#1}% on paramètres les nouvelles clés et on les simplifie
- \IfSubStr{\axeytickwidth}{/}
- {\StrCut{\axeytickwidth}{/}{\axeytickwidthA}{\axeytickwidthB}}
- {\def\axeytickwidthA{\axeytickwidth}\def\axeytickwidthB{\axeytickwidth}}
- \foreach \y in {#2}{%
- \draw[line width=\axeywidth] ({\axeytickwidthA},{\y-\axeyOy}) -- ({-\axeytickwidthB},{\y-\axeyOy})%
- \ifboolKV[PLaxeytkz]{affgrad}%on affiche les graduations
- {%
- \ifboolKV[PLaxeytkz]{afforigine}%si on demande d'afficher l'origine
- {node[\axeyposlabel,font=\axeyfont]
- {\ifboolKV[PLaxeytkz]{annee}%
- {\num[group-digits=none]{\y}}%
- {\num[text-family-to-math=true,text-series-to-math=true]{\y}}%
- }
- }
- {\xintifboolexpr{\y==\axeyOy}{}{node[\axeyposlabel,font=\axeyfont] {\ifboolKV[PLaxeytkz]{annee}%
- {\num[group-digits=none]{\y}}%
- {\num[text-family-to-math=true,text-series-to-math=true]{\y}}%
- }
- }
- }
- }
- {}
- ;}
-}
-
-%axes
-\defKV[PLaxestkz]{%
- epaisseur=\def\axeswidth{#1},%
- police=\def\axesfont{#1},%
- labelx=\def\axeslabelx{#1},%
- labely=\def\axeslabely{#1},%
- poslabelx=\def\axesposlabelx{#1},%
- poslabely=\def\axesposlabely{#1},%
- echellefleche=\def\axesechellefleche{#1},%
- typefleche=\def\axestypefleche{#1},%
- afflabel=\def\axesafflabel{#1}
-}
-
-\setKVdefault[PLaxestkz]{%
- epaisseur=1.25pt,%
- police=\normalsize\normalfont,%
- labelx=$x$,%
- labely=$y$,%
- afflabel=z,%
- poslabelx=right,%
- poslabely=above,%
- echellefleche=1,%
- typefleche=>
-}
-
-\DeclareDocumentCommand\PLaxestikz{ O{} }{%
- \useKVdefault[PLaxestkz]
- \setKV[PLaxestkz]{#1}%
- %on affiche les deux axes
- \draw[line width=\axeswidth,-{\axestypefleche[scale=\axesechellefleche]}] ({\xmin-\axexOx},0) -- ({\xmax-\axexOx},0) ;
- \draw[line width=\axeswidth,-{\axestypefleche[scale=\axesechellefleche]}] (0,{\ymin-\axeyOy}) -- (0,{\ymax-\axeyOy}) ;
- %les labels éventuels
- \IfSubStr{\axesafflabel}{x}%
- {\draw ({\xmax-\axexOx},0) node[\axesposlabelx,font=\axesfont] {\axeslabelx} ;}
- {}
- \IfSubStr{\axesafflabel}{y}%
- {\draw (0,{\ymax-\axeyOy}) node[\axesposlabely,font=\axesfont] {\axeslabely} ;}
- {}
-}
-
-%fenêtre clippée
-\newcommand\PLfenetre{%
- \clip ({\xmin-\axexOx},{\ymin-\axeyOy}) rectangle ({\xmax-\axexOx},{\ymax-\axeyOy}) ;
-}
-
-%origine
-\defKV[PLaxesorig]{%
- police=\def\axesorfont{#1},%
- pos=\def\axesorpos{#1},%
- decal=\def\axesordecal{#1},%
- valeur=\def\axesorval{#1}
-}
-
-\setKVdefault[PLaxesorig]{%
- police=\normalsize\normalfont,%
- pos={below left},%
- decal=2pt,%
- valeur=0
-}
-
-\DeclareDocumentCommand\PLorigine{ O{} }{%
- \useKVdefault[PLaxesorig]
- \setKV[PLaxesorig]{#1}%
- \draw (0,0) node[\axesorpos=\axesordecal,font=\axesorfont] {\axesorval} ;
-}
-
-%grilles
-\setKVdefault[PLgrillestkz]{%
- affp=true,%
- affs=true
-}
-
-\DeclareDocumentCommand\PLgrilletikz{ O{} O{thin,lightgray} O{ultra thin,lightgray} }{%
- \useKVdefault[PLgrillestkz]
- \setKV[PLgrillestkz]{#1}%
- \ifboolKV[PLgrillestkz]{affs}
- {\draw[xstep=\xgrilles,ystep=\ygrilles,#3] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});}
- {}
- \ifboolKV[PLgrillestkz]{affp}
- {\draw[xstep=\xgrille,ystep=\ygrille,#2] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});}
- {}
-}
-
-%point(s) avec changement origines
-\defKV[PLpts]{%
- taille=\def\ptstaille{#1},%
- couleur=\def\ptscouleur{#1},%
- style=\def\ptsstyle{#1}
-}
-
-\setKVdefault[PLpts]{%
- taille=2pt,%
- couleur=blue,%
- style=o
-}
-
-\newcommand\PLnuagepoints[2][]{%
- \useKVdefault[PLpts]
- \setKV[PLpts]{#1}%
- \setsepchar{§}%
- \readlist\listepointsaffiches{#2}
- \foreachitem\point\in\listepointsaffiches{%
- \StrBetween{\point}{(}{,}[\XPT]
- \StrBetween{\point}{,}{)}[\YPT]
- \IfStrEq{\ptsstyle}{o}%
- {\filldraw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) circle[radius=\ptstaille] ;}
- {}
- \IfStrEq{\ptsstyle}{x}%
- {\draw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) pic {PLdotcross=\ptstaille/45} ;}
- {}
- \IfStrEq{\ptsstyle}{+}%
- {\draw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) pic {PLdotcross=\ptstaille/0} ;}
- {}
- }
-}
-
-\newcommand\PLnuagepts[3][]{%
- \useKVdefault[PLpts]
- \setKV[PLpts]{#1}% on paramètres les nouvelles clés et on les simplifie
- \def\xliste{#2}
- \def\yliste{#3}
- \readlist*\LX{\xliste}
- \readlist*\LY{\yliste}
- %taille des listes
- \def\LNB{\inteval{\LXlen}}
- \foreach \i in {1,2,...,\LNB} {
- \IfStrEq{\ptsstyle}{o}%
- {
- \IfSubStr{\ptscouleur}{/}
- {\StrCut{\ptscouleur}{/}{\ptscouleurA}{\ptscouleurB}\draw[thick,\ptscouleurA,fill=\ptscouleurB] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) circle[radius=\ptstaille] ;}
- {\draw[\ptscouleur,fill=\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) circle[radius=\ptstaille] ;}
- }
- {}
- \IfStrEq{\ptsstyle}{x}%
- {\draw[\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) pic {PLdotcross=\ptstaille/45} ;}
- {}
- \IfStrEq{\ptsstyle}{+}%
- {\draw[\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) pic {PLdotcross=\ptstaille/0} ;}
- {}
- }
-}
-
-\defKV[PLptmoy]{%
- police=\def\ptmoyfont{#1},%
- taille=\def\ptmoytaille{#1},%
- couleur=\def\ptmoycouleur{#1},%
- style=\def\ptmoystyle{#1},%
- xg=\def\ptmoyx{#1},%
- yg=\def\ptmoyy{#1},%
- nom=\def\ptmoynom{#1},%
- pos=\def\ptmoypos{#1},%
- decal=\def\ptmoydecal{#1},%
-}
-
-\setKVdefault[PLptmoy]{%
- police=\normalsize\normalfont,%
- taille=4pt,%
- couleur=red,%
- style=x,%
- xg=\LXmoy,%
- yg=\LYmoy,%
- nom=G,%
- pos=above,%
- decal=0pt,%
- affnom=true
-}
-
-\newcommand\PLnuageptmoy[1][]{%
- \useKVdefault[PLptmoy]
- \setKV[PLptmoy]{#1}% on paramètres les nouvelles clés et on les simplifie
- \IfStrEq{\ptmoystyle}{o}%
- {
- \IfSubStr{\ptmoycouleur}{/}
- {\StrCut{\ptmoycouleur}{/}{\ptmoycouleurA}{\ptmoycouleurB}\draw[thick,\ptmoycouleurA,fill=\ptmoycouleurB] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) circle[radius=\ptmoytaille] ;}
- {\draw[\ptmoycouleur,fill=\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) circle[radius=\ptmoytaille] ;}
- }
- {}
- \IfStrEq{\ptmoystyle}{x}%
- {\draw[\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) pic {PLdotcross=\ptmoytaille/45} ;}
- {}
- \IfStrEq{\ptmoystyle}{+}%
- {\draw[\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) pic {PLdotcross=\ptmoytaille/0} ;}
- {}
- \ifboolKV[PLptmoy]{affnom}
- {\draw ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) node[\ptmoypos={\ptmoytaille+\ptmoydecal},font=\ptmoyfont] {\ptmoynom} ;}
- {}
-
-}
-
-%courbe ?
-\newcommand\PLcourbe[3][]{%
- \setsepchar{:}%
- \readlist\PLdomaine{#3}
- \itemtomacro\PLdomaine[1]\PLDm
- \itemtomacro\PLdomaine[2]\PLDM
- \saveexpandmode\noexpandarg
- \StrSubstitute{#2}{\x}{(\x+\axexOx)}[\fctdecx]
- \restoreexpandmode % restore the previous mode
- \draw[#1] plot[domain={\PLDm-\axexOx}:{\PLDM-\axexOx}] (\x,{\fctdecx-\axeyOy}) ;
-}
-
-\setKVdefault[PLsimplewindow]{%
- axes=true,%
- grille=true,%
-}
-
-\DeclareDocumentCommand\PLfenetresimple{ O{} D<>{} m D<>{} m }{%
- \useKVdefault[PLsimplewindow]
- \setKV[PLsimplewindow]{#1}% on paramètres les nouvelles clés et on les simplifie
- \ifboolKV[PLsimplewindow]{grille}
- {\PLgrilletikz}
- {}
- \ifboolKV[PLsimplewindow]{axes}
- {\PLaxestikz\PLaxextikz[#2]{#3}\PLaxeytikz[#4]{#5}}
- {}
-}
-
-\NewDocumentEnvironment{PLstats}{ O{} }
-{%
- \begin{tikzpicture}[#1]
- }%
- {%
- \end{tikzpicture}%
-}
-
-%=============BOITES MOUSTACHES======== OK !!
-\defKV[boiteamoustaches]{%
- parametres=\def\BaMListe{#1},%
- couleur=\def\BaMCouleur{#1},%
- elevation=\def\BaMElevation{#1},%
- hauteur=\def\BaMHauteur{#1},%
- moyenne=\def\BaMMoyenne{#1},%
- epaisseur=\def\BaMEpaisseur{#1},%
- remplir=\def\BaMRemplissage{#1}
-}
-
-\setKVdefault[boiteamoustaches]{%
- couleur=black,%
- elevation=1,%
- hauteur=1,%
- affmoyenne=false,%
- epaisseur=thick,%
- pointilles=false,%
- valeurs=false,%
- remplir=white
-}
-
-\defKV[boiteamoustachesaxe]{%
- min=\def\BaMAxeMin{#1},%
- max=\def\BaMAxeMax{#1},%
- elargir=\def\BaMAxeElarg{#1},%
- epaisseur=\def\BaMAxeEpaisseur{#1},%
- valeurs=\def\BaMAxeValeurs{#1}
-}
-
-\setKVdefault[boiteamoustachesaxe]{%
- elargir=0.05,%
- epaisseur=thick,%
- affvaleurs=false
-}
-
-\newcommand\PLboitemoustaxe[1][]{
- \useKVdefault[boiteamoustachesaxe]
- \setKV[boiteamoustachesaxe]{#1}
- \def\BaMaxelargeur{\fpeval{\BaMAxeMax-\BaMAxeMin}}
- \def\BaMaxexmin{\fpeval{\BaMAxeMin-\BaMAxeElarg*\BaMaxelargeur}}
- \def\BaMaxexmax{\fpeval{\BaMAxeMax+\BaMAxeElarg*\BaMaxelargeur}}
- \draw[\BaMAxeEpaisseur,->] (\BaMaxexmin,0) -- (\BaMaxexmax,0) ;
- \ifboolKV[boiteamoustachesaxe]{affvaleurs}
- {\foreach \x in \BaMAxeValeurs \draw[\BaMAxeEpaisseur] (\x,3pt)--(\x,-3pt) node[below=3pt] {\num{\x}} ;}
- {}
-}
-
-\newcommand\PLboitemoust[1][]{
- \useKVdefault[boiteamoustaches]
- \setKV[boiteamoustaches]{#1}
- \setsepchar[.]{/}%
- \readlist*\BaMListeparams\BaMListe%
- \itemtomacro\BaMListeparams[1]\BaMmin%
- \itemtomacro\BaMListeparams[2]\BaMqu%
- \itemtomacro\BaMListeparams[3]\BaMmed%
- \itemtomacro\BaMListeparams[4]\BaMqt%
- \itemtomacro\BaMListeparams[5]\BaMmax%
- \draw[draw,\BaMEpaisseur,\BaMCouleur,fill=\BaMRemplissage] ({\BaMqu},{\BaMElevation-0.5*\BaMHauteur}) rectangle ({\BaMqt},{\BaMElevation+0.5*\BaMHauteur}) ;
- \draw[\BaMEpaisseur,\BaMCouleur] (\BaMmin,{\BaMElevation-0.5*\BaMHauteur})--(\BaMmin,{\BaMElevation+0.5*\BaMHauteur}) (\BaMmax,{\BaMElevation-0.5*\BaMHauteur})--(\BaMmax,{\BaMElevation+0.5*\BaMHauteur}) (\BaMmed,{\BaMElevation-0.5*\BaMHauteur})--(\BaMmed,{\BaMElevation+0.5*\BaMHauteur});
- \draw[\BaMEpaisseur,\BaMCouleur] ({\BaMmin},{\BaMElevation})--({\BaMqu},{\BaMElevation}) ({\BaMqt},{\BaMElevation})--({\BaMmax},{\BaMElevation}) ;
- \ifboolKV[boiteamoustaches]{affmoyenne}
- {\filldraw[\BaMCouleur] ({\BaMMoyenne},{\BaMElevation}) circle[radius=2.5pt] ;}
- {}
- \ifboolKV[boiteamoustaches]{pointilles}
- {
- \draw[\BaMEpaisseur,densely dashed] (\BaMmin,{\BaMElevation-0.5*\BaMHauteur}) -- (\BaMmin,0) ;
- \draw[\BaMEpaisseur,densely dashed] (\BaMqu,{\BaMElevation-0.5*\BaMHauteur}) -- (\BaMqu,0) ;
- \draw[\BaMEpaisseur,densely dashed] (\BaMmed,{\BaMElevation-0.5*\BaMHauteur}) -- (\BaMmed,0) ;
- \draw[\BaMEpaisseur,densely dashed] (\BaMqt,{\BaMElevation-0.5*\BaMHauteur}) -- (\BaMqt,0) ;
- \draw[\BaMEpaisseur,densely dashed] (\BaMmax,{\BaMElevation-0.5*\BaMHauteur}) -- (\BaMmax,0) ;
- }
- {}
- \ifboolKV[boiteamoustaches]{valeurs}
- {
- \filldraw (\BaMmin,0) circle[radius=2pt] node[below=4pt] {\num{\BaMmin}} ;
- \filldraw (\BaMqu,0) circle[radius=2pt] node[below=4pt] {\num{\BaMqu}} ;
- \filldraw (\BaMmed,0) circle[radius=2pt] node[below=4pt] {\num{\BaMmed}} ;
- \filldraw (\BaMqt,0) circle[radius=2pt] node[below=4pt] {\num{\BaMqt}} ;
- \filldraw (\BaMmax,0) circle[radius=2pt] node[below=4pt] {\num{\BaMmax}} ;
- }
- {}
-}
-
-%================SUDOMATHS============= OK !!
-\defKV[PLTIKZSUDOM]{%
- couleurtexte=\def\PLSMcoultexte{#1},%
- epaisseur=\def\PLSMepf{#1},%
- epaisseurg=\def\PLSMepg{#1},%
- unite=\def\PLSMunite{#1},%
- couleurcase=\def\PLSMcoulcase{#1},%
- nbcol=\def\PLSMnbcol{#1},%
- nbsubcol=\def\PLSMnbsubcol{#1},%
- nblig=\def\PLSMnblig{#1},%
- nbsublig=\def\PLSMnbsublig{#1},%
- police=\def\PLSMfonte{#1},%
- policeleg=\def\PLSMfonteleg{#1},%
- listelegv=\def\PLSMlistelegv{#1},%
- listelegh=\def\PLSMlistelegh{#1},%
- decallegende=\def\PLSMdecalleg{#1}
-}
-
-\setKVdefault[PLTIKZSUDOM]{%
- epaisseurg=1.5pt,%
- epaisseur=0.5pt,%
- unite=1cm,%
- couleurcase=LightBlue!50,%
- couleurtexte=blue,%
- nbcol=9,%
- nbsubcol=3,%
- nblig=9,%
- nbsublig=3,
- police=\normalfont\normalsize,%
- policeleg=\normalfont\sffamily,%
- legendes=true,%
- listelegv=ABCDEFGHIJKLMNOPQRSTUVWXYZ,%
- listelegh=abcdefghijklmnopqrstuvwxyz,%
- decallegende=0.45
-}
-
-\NewDocumentEnvironment{PLenvsudomaths}{ O{} m }
- {
- \useKVdefault[PLTIKZSUDOM]
- \setKV[PLTIKZSUDOM]{#1}% on paramètres les nouvelles clés et on les simplifie
- %calculs intermédiaires
- \def\larcolinter{\inteval{\PLSMnbcol/\PLSMnbsubcol}}
- \def\larliginter{\inteval{\PLSMnblig/\PLSMnbsublig}}
- %lecture liste
- \IfEq{#2}{}{}%
- {%
- \setsepchar[.]{§./}%
- \readlist*\SPGrilleSudoMaths{#2}%
- }
- %débt envtik
- \begin{tikzpicture}[x=\PLSMunite,y=\PLSMunite,line join=miter]
- %cases
- \IfEq{#2}{}{}%
- {%
- \foreach \i in {1,2,...,\PLSMnblig}{%
- \foreach \j in {1,2,...,\PLSMnbcol}{%
- \itemtomacro\SPGrilleSudoMaths[\i,\j]\SMcase
- \IfSubStr{\SMcase}{*}%si on veut colorier via *
- {%
- \StrDel{\SMcase}{*}[\SMcaseb]%
- \draw[draw=none,fill=\PLSMcoulcase] ({\j-1},{1-\i}) rectangle++ (1,-1) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte,midway] {\SMcaseb} ;%
- }
- {%
- \draw ({\j-0.5},{0.5-\i}) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte] {\SMcase} ;%
- }
- }
- }%
- }
- %grilles
- \draw[line width=\PLSMepg] (0,0) rectangle ({\PLSMnbcol},{-\PLSMnblig}) ;
- \draw[line width=\PLSMepf,xstep=1,ystep=1] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
- \draw[line width=\PLSMepg,xstep=\larcolinter,ystep=\larliginter] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
- %légendes
- \ifboolKV[PLTIKZSUDOM]{legendes}
- {%
- \foreach \i in {1,2,...,\PLSMnbcol}{\draw ({\i-0.5},{\PLSMdecalleg}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\strut\StrChar{\PLSMlistelegh}{\i}} ;}
- \foreach \j in {1,2,...,\PLSMnblig}{\draw ({-\PLSMdecalleg},{0.5-\j}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\StrChar{\PLSMlistelegv}{\j}} ;}
- }{}
- }
- {
- \end{tikzpicture}
- }
-
-\NewDocumentCommand\PLsudomaths{ O{} m }{%
- \useKVdefault[PLTIKZSUDOM]
- \setKV[PLTIKZSUDOM]{#1}% on paramètres les nouvelles clés et on les simplifie
- %calculs intermédiaires
- \def\larcolinter{\inteval{\PLSMnbcol/\PLSMnbsubcol}}
- \def\larliginter{\inteval{\PLSMnblig/\PLSMnbsublig}}
- %lecture liste
- \IfEq{#2}{}{}%
- {%
- \setsepchar[.]{§./}%
- \readlist*\SPGrilleSudoMaths{#2}%
- }
- %débt envtik
- \begin{tikzpicture}[x=\PLSMunite,y=\PLSMunite,line join=miter]
- %cases
- \IfEq{#2}{}{}%
- {%
- \foreach \i in {1,2,...,\PLSMnblig}{%
- \foreach \j in {1,2,...,\PLSMnbcol}{%
- \itemtomacro\SPGrilleSudoMaths[\i,\j]\SMcase
- \IfSubStr{\SMcase}{*}%si on veut colorier via *
- {%
- \StrDel{\SMcase}{*}[\SMcaseb]%
- \draw[draw=none,fill=\PLSMcoulcase] ({\j-1},{1-\i}) rectangle++ (1,-1) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte,midway] {\SMcaseb} ;%
- }
- {%
- \draw ({\j-0.5},{0.5-\i}) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte] {\SMcase} ;%
- }
- }
- }%
- }
- %grilles
- \draw[line width=\PLSMepg] (0,0) rectangle ({\PLSMnbcol},{-\PLSMnblig}) ;
- \draw[line width=\PLSMepf,xstep=1,ystep=1] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
- \draw[line width=\PLSMepg,xstep=\larcolinter,ystep=\larliginter] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
- %légendes
- \ifboolKV[PLTIKZSUDOM]{legendes}
- {%
- \foreach \i in {1,2,...,\PLSMnbcol}{\draw ({\i-0.5},{\PLSMdecalleg}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\strut\StrChar{\PLSMlistelegh}{\i}} ;}
- \foreach \j in {1,2,...,\PLSMnblig}{\draw ({-\PLSMdecalleg},{0.5-\j}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\StrChar{\PLSMlistelegv}{\j}} ;}
- }{}
- \end{tikzpicture}
-}
-
-%================LOISPROBAS============ OK !!
-%calculs "simples"
-\newcommand\calcPbinomP[3]{%npk
- \xintFloatToDecimal{\xintfloateval{binomial(#1,#3)*#2^#3*(1-#2)^(#1-#3)}}
-}
-\newcommand\calcPbinomC[4]{%npab
- \def\BorneInf{#3}\def\BorneSup{#4}
- \ifthenelse{\equal{#3}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneSup{#1}}
- {}
- \xintFloatToDecimal{\xintfloateval{add(binomial(#1,i)*#2^i*(1-#2)^(#1-i), i=\BorneInf..\BorneSup)}}
-}
-\newcommand\calcPgeomP[2]{%pk
- \xintFloatToDecimal{\xintfloateval{(1-#1)^(#2-1)*(#1)}}
-}
-\newcommand\calcPgeomC[3]{%pab
- \def\BorneInf{#2}\def\BorneSup{#3}
- \ifthenelse{\equal{#2}{*}}%
- {\def\BorneInf{1}}
- {}
- \ifthenelse{\equal{#3}{*}}%
- {\def\BorneSup{\fpeval{trunc(1/#1*10,0)}}}
- {}
- \xintFloatToDecimal{\xintfloateval{add((1-#1)^(i-1)*(#1), i=\BorneInf..\BorneSup)}}
-}
-\newcommand\calcPhypergeomP[4]{%Nnmk
- \xintFloatToDecimal{\xintfloateval{binomial(#3,#4)*binomial(#1-#3,#2-#4)/binomial(#1,#2)}}
-}
-\newcommand\calcPhypergeomC[5]{%Nnmab
- \def\BorneInf{#4}\def\BorneSup{#5}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneSup{#1}}
- {}
- \xintFloatToDecimal{\xintfloateval{add(binomial(#3,i)*binomial(#1-#3,#2-i)/binomial(#1,#2), i=\BorneInf..\BorneSup)}}
-}
-\newcommand\calcPpoissP[2]{%lk
- \xintFloatToDecimal{\xintfloateval{exp(-#1)*#1^#2/factorial(#2)}}
-}
-\newcommand\calcPpoissC[3]{%lab
- \def\BorneInf{#2}\def\BorneSup{#3}
- \ifthenelse{\equal{#2}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#3}{*}}%
- {\def\BorneSup{10*#1}}
- {}
- \xintFloatToDecimal{\xintfloateval{add(exp(-#1)*#1^i/factorial(i), i=\BorneInf..\BorneSup)}}
-}
-%utiles idée de https://tex.stackexchange.com/questions/355574/im-searching-for-a-table-with-cdf-of-standard-normal-distribution
-\xintdeffloatvar a_1,a_2,a_3,a_4,a_5,a_6 :=
-0.0705230784,0.0422820123,0.0092705272,0.0001520143,0.0002765672,0.0000430638;
-\xintdeffloatvar rac2inv := sqrt(2)/2 ;
-\xintdeffloatfunc erfc(x) := % uniquement pour x positif
-((((((a_6*x+a_5)*x+a_4)*x+a_3)*x+a_2)*x+a_1)*x+1)**-16 ; % fin de définition de erfc(x)
-\xintdeffloatfunc Phi(z) := (z>=0)?{1 - 0.5 * erfc(rac2inv * z)}{0.5 * erfc(-rac2inv * z)};
-
-\newcommand\calcPnormC[4]{%msab
- %def des bornes de l'intervalle suivant l'absence de a ou de b...
- \def\BorneInf{#3}\def\BorneSup{#4}
- \ifthenelse{\equal{#3}{*}}%
- {\def\BorneInf{#4-10*#2}}
- {}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneSup{#3+10*#2}}
- {}
- \xintFloatToDecimal{\xintfloateval{Phi((\BorneSup-#1)/#2)-Phi((\BorneInf-#1)/#2)}}
-}
-%calculs "simples" fiabilite
-\newcommand\calcPexpoC[3]{%lab
- \def\BorneInf{#2}\def\BorneSup{#3}
- \ifthenelse{\equal{#2}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#3}{*}}%
- {\def\BorneSup{100/#1}}
- {}
- \xintFloatToDecimal{\xintfloateval{exp(-#1*\BorneInf)-exp(-#1*\BorneSup)}}
-}
-
-%calculs formatés
-\NewDocumentCommand{\numPbinomP}{ s O{3} m m m }{%*=sci,2=prec,3=n,4=p,5=k
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(binomial(#3,#5)*#4^#5*(1-#4)^(#3-#5),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(binomial(#3,#5)*#4^#5*(1-#4)^(#3-#5),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPbinomC}{ s O{3} m m m m }{%*=sci,2=prec,3=n,4=p,5=a,6=b
- \def\BorneInf{#5}\def\BorneSup{#6}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#6}{*}}%
- {\def\BorneSup{#3}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(add(binomial(#3,i)*#4^i*(1-#4)^(#3-i), i=\BorneInf..\BorneSup),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(add(binomial(#3,i)*#4^i*(1-#4)^(#3-i), i=\BorneInf..\BorneSup),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPgeomP}{ s O{3} m m }{%*=sci,2=prec,3=p,4=k
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round((1-#3)^(#4-1)*(#3),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round((1-#3)^(#4-1)*(#3),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPgeomC}{ s O{3} m m m }{%*=sci,2=prec,3=p,4=a,5=b
- \def\BorneInf{#4}\def\BorneSup{#5}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneInf{1}}
- {}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneSup{\fpeval{trunc(1/#3*10,0)}}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(add((1-#3)^(i-1)*(#3), i=\BorneInf..\BorneSup),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(add((1-#3)^(i-1)*(#3), i=\BorneInf..\BorneSup),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPhypergeomP}{ s O{3} m m m m }{%*=sci,2=prec,3=N,4=n,5=m,6=k
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(binomial(#5,#6)*binomial(#3-#5,#4-#6)/binomial(#3,#4),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(binomial(#5,#6)*binomial(#3-#5,#4-#6)/binomial(#3,#4),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPhypergeomC}{ s O{3} m m m m m }{%*=sci,2=prec,3=N,4=n,5=m,6=a,7=b
- \def\BorneInf{#6}\def\BorneSup{#7}
- \ifthenelse{\equal{#6}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#7}{*}}%
- {\def\BorneSup{#3}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(add(binomial(#5,i)*binomial(#3-#5,#4-i)/binomial(#3,#4), i=\BorneInf..\BorneSup),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(add(binomial(#5,i)*binomial(#3-#5,#4-i)/binomial(#3,#4), i=\BorneInf..\BorneSup),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPpoissP}{ s O{3} m m }{%*=sci,2=prec,3=lbda,4=k
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(exp(-#3)*#3^#4/factorial(#4),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(exp(-#3)*#3^#4/factorial(#4),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPpoissC}{ s O{3} m m m }{%*=ing,2=prec,3=lbda,4=a,5=b
- \def\BorneInf{#4}\def\BorneSup{#5}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneSup{10*#3}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(add(exp(-#3)*#3^i/factorial(i), i=\BorneInf..\BorneSup),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(add(exp(-#3)*#3^i/factorial(i), i=\BorneInf..\BorneSup),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPnormC}{ s O{3} m m m m }{%
- %*=ing,2=prec,3=mu,4=sigma,5=a,6=b
- %def des bornes de l'intervalle suivant l'absence de a ou de b...
- \def\BorneInf{#5}\def\BorneSup{#6}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneInf{#6-10*#4}}
- {}
- \ifthenelse{\equal{#6}{*}}%
- {\def\BorneSup{#5+10*#4}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(Phi((\BorneSup-#3)/#4)-Phi((\BorneInf-#3)/#4),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintfloateval{round(Phi((\BorneSup-#3)/#4)-Phi((\BorneInf-#3)/#4),#2)}}}
- }
-}
-
-\NewDocumentCommand{\numPexpoC}{ s O{3} m m m }{%*=ing,2=prec,3=lbda,4=a,5=b
- \def\BorneInf{#4}\def\BorneSup{#5}
- \ifthenelse{\equal{#4}{*}}%
- {\def\BorneInf{0}}
- {}
- \ifthenelse{\equal{#5}{*}}%
- {\def\BorneSup{100/#3}}
- {}
- \IfBooleanTF{#1}%
- {%
- \num[exponent-mode=scientific]{\xintFloatToDecimal{\xintfloateval{round(exp(-#3*\BorneInf)-exp(-#3*\BorneSup),#2)}}}
- }%
- {%
- \num[minimum-decimal-digits=#2]{\xintFloatToDecimal{\xintFloatToDecimal{\xintfloateval{round(exp(-#3*\BorneInf)-exp(-#3*\BorneSup),#2)}}}}
- }
-}
-
-%===============CONVFROMDEC============ OK !!
-\newcommand\PLnoeud[2]{\tikz[remember picture,baseline=(#1.base)]\node[shape=rectangle,inner sep=0pt](#1){#2};}
-\ExplSyntaxOn
-\newcommand\convertbasedixtobase[2]{%
- \int_to_Base:nn {#1}{#2}
-}
-\ExplSyntaxOff
-
-\defKV[convfromten]{%
- couleur=\def\PLConvCouleur{#1},%
- decalh=\def\PLConvDecalH{#1},%
- decalv=\def\PLConvDecalV{#1},%
- noeud=\def\PLConvNoeud{#1}
-}
-
-\setKVdefault[convfromten]{%
- couleur=red,%
- decalh=2pt,%
- decalv=3pt,%
- rect=true,%
- noeud=EEE,%
- couleurres=false
-}
-
-\newcommand\PLconvDepuisDec[3][]{%
- \useKVdefault[convfromten]%
- \setKV[convfromten]{#1}%
- \xdef\ValRes{\xintDecToHex{#2}}%
- \xdef\ValA{#2}\xdef\ValB{#3}%
- \xdef\ValTMP{#2}%
- \xdef\ValMU{\inteval{#3-1}}%
- \ensuremath{%
- \left\lbrace\begin{array}{@{\,}r@{\;=\;}l@{\;+\;}r}
- %1ere division
- \xdef\ValQ{\fpeval{trunc(\ValTMP/#3,0)}}\xdef\ValR{\fpeval{\ValTMP-#3*\ValQ}}
- \num{\ValTMP}\uppercase{&}\num{\ValB}\times\num{\ValQ}\uppercase{&}\PLnoeud{\PLConvNoeud1}{\num{\ValR}}%
- \xdef\ValTMP{\ValQ}%
- \whiledo {\ValTMP > \ValMU}%
- {%
- \xdef\ValQ{\fpeval{trunc(\ValTMP/#3,0)}}\xdef\ValR{\fpeval{\ValTMP-#3*\ValQ}}%
- \\ \num{\ValTMP}\uppercase{&}\num{\ValB}\times\num{\ValQ}\uppercase{&}\num{\ValR}
- \xdef\ValTMP{\ValQ}%
- }
- %dernière
- \xdef\ValQ{\fpeval{trunc(\ValTMP/#3,0)}}\xdef\ValR{\fpeval{\ValTMP-#3*\ValQ}}%
- \\ \num{\ValTMP}\uppercase{&}\num{\ValB}\times\num{\ValQ}\uppercase{&}\PLnoeud{\PLConvNoeud2}{\num{\ValR}}
- \end{array} \right| \Rightarrow \num{#2}_{10}=\ifboolKV[convfromten]{couleurres}{\mathcolor{\PLConvCouleur}{\convertbasedixtobase{#2}{#3}_{#3}}}{\convertbasedixtobase{#2}{#3}_{#3}}}%
- \ifboolKV[convfromten]{rect}%
- {%
- \IfSubStr{\PLConvDecalH}{/}%
- {\StrCut{\PLConvDecalH}{/}{\PLConvDecalHg}{\PLConvDecalHd}}%
- {\def\PLConvDecalHg{\PLConvDecalH}\def\PLConvDecalHd{\PLConvDecalH}}%
- \begin{tikzpicture}
- \draw[overlay,rounded corners=4pt,\PLConvCouleur,thick] ($(\PLConvNoeud1.north west)+(-\PLConvDecalHg,\PLConvDecalV)$) rectangle ($(\PLConvNoeud2.south east)+(\PLConvDecalHd,-\PLConvDecalV)$) ;
- \draw[overlay,rounded corners=4pt,\PLConvCouleur,thick,->,>=latex] ($(\PLConvNoeud2.east)+(\PLConvDecalHd,0)$)--++(0,{0.75\baselineskip}) ;
- \end{tikzpicture}%
- }{}%
-}
-
-%===============ARBRESPROBAS=========== OK !!
-\defKV[PLTIKZARBRE]{%
- unite=\def\PLAPunite{#1},%
- espniv=\def\PLAPespniv{#1},%
- espfeuille=\def\PLAPespfeuille{#1},%
- type=\def\PLAPtype{#1},%
- police=\def\PLAPfont{#1},%
- policeprobas=\def\PLAPfontproba{#1},%
- styletrait=\def\PLAPtypetrait{#1},%
- eptrait=\def\PLAPeptrait{#1}
-}
-
-\setKVdefault[PLTIKZARBRE]{%
- unite=1cm,%
- espniv=3.25,%
- espfeuille=1,%
- type=2x2,%
- police=\normalfont\normalsize,%
- policeprobas=\normalfont\small,%
- inclineprobas=true,%
- fleche=false,%
- styletrait={},%
- eptrait=semithick
-}
-
-\NewDocumentCommand\PLarbre{ O{} m }{%1=options,2=libellés
- \useKVdefault[PLTIKZARBRE]%
- \setKV[PLTIKZARBRE]{#1}%
- \setsepchar[.]{,./}%
- \readlist*\PLARBREDONNES{#2}%
- \begin{tikzpicture}[x=\PLAPunite,y=\PLAPunite]
- %styles
- \tikzstyle{noeud} = [font=\PLAPfont]
- \tikzstyle{probas}= [font=\PLAPfontproba]
- \ifboolKV[PLTIKZARBRE]{inclineprobas}
- {\tikzstyle{PLetiquette}=[pos=0.525,sloped,fill=white]}
- {\tikzstyle{PLetiquette}=[pos=0.525,fill=white]}
- \ifboolKV[PLTIKZARBRE]{fleche}
- {\tikzstyle{PLfleche}=[->,>=latex,\PLAPtypetrait,\PLAPeptrait]}
- {\tikzstyle{PLfleche}=[\PLAPtypetrait,\PLAPeptrait]}
- %arbre2x2
- \IfEq{\PLAPtype}{2x2}
- {%
- \coordinate (R) at ({0*\PLAPespniv},{-1.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-0.5*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-2.5*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (A12)--(A23) ;}
- {\draw[PLfleche] (A12)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- }{}
- %arbre3x2
- \IfEq{\PLAPtype}{3x2}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-2.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-0.5*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-2.5*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A13) at ({1*\PLAPespniv},{-4.5*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[9,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (A12)--(A23) ;}
- {\draw[PLfleche] (A12)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (R)--(A13) ;}
- {\draw[PLfleche] (R)--(A13) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A13)--(A25) ;}
- {\draw[PLfleche] (A13)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- \IfEq{\PLARBREDONNES[9,2]}{}
- {\draw[PLfleche] (A13)--(A26) ;}
- {\draw[PLfleche] (A13)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[9,3]}] {{\PLARBREDONNES[9,2]}} ;}
- }{}
- %arbre2x3
- \IfEq{\PLAPtype}{2x3}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-2.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (A11)--(A23) ;}
- {\draw[PLfleche] (A11)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (A12)--(A25) ;}
- {\draw[PLfleche] (A12)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A12)--(A26) ;}
- {\draw[PLfleche] (A12)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- }{}
- %arbre2x3
- \IfEq{\PLAPtype}{3x3}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-4*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[10,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- \node[noeud] (A27) at ({2*\PLAPespniv},{-6*\PLAPespfeuille}) {\PLARBREDONNES[10,1]};
- \node[noeud] (A28) at ({2*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[11,1]};
- \node[noeud] (A29) at ({2*\PLAPespniv},{-8*\PLAPespfeuille}) {\PLARBREDONNES[12,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[9,2]}{}
- {\draw[PLfleche] (R)--(A13) ;}
- {\draw[PLfleche] (R)--(A13) node[probas,PLetiquette,{\PLARBREDONNES[9,3]}] {{\PLARBREDONNES[9,2]}} ;}
- %N2
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (A11)--(A23) ;}
- {\draw[PLfleche] (A11)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (A12)--(A25) ;}
- {\draw[PLfleche] (A12)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A12)--(A26) ;}
- {\draw[PLfleche] (A12)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- \IfEq{\PLARBREDONNES[10,2]}{}
- {\draw[PLfleche] (A13)--(A27) ;}
- {\draw[PLfleche] (A13)--(A27) node[probas,PLetiquette,{\PLARBREDONNES[10,3]}] {{\PLARBREDONNES[10,2]}} ;}
- \IfEq{\PLARBREDONNES[11,2]}{}
- {\draw[PLfleche] (A13)--(A28) ;}
- {\draw[PLfleche] (A13)--(A28) node[probas,PLetiquette,{\PLARBREDONNES[11,3]}] {{\PLARBREDONNES[11,2]}} ;}
- \IfEq{\PLARBREDONNES[12,2]}{}
- {\draw[PLfleche] (A13)--(A29) ;}
- {\draw[PLfleche] (A13)--(A29) node[probas,PLetiquette,{\PLARBREDONNES[12,3]}] {{\PLARBREDONNES[12,2]}} ;}
- }{}
- \end{tikzpicture}
-}
-
-\NewDocumentEnvironment{PLenvarbre}{ O{} m }%1=options,2=libellés
-{
- \useKVdefault[PLTIKZARBRE]
- \setKV[PLTIKZARBRE]{#1}
- \setsepchar[.]{,./}%
- \readlist*\PLARBREDONNES{#2}
- \begin{tikzpicture}[x=\PLAPunite,y=\PLAPunite]
- %styles
- \tikzstyle{noeud} = [font=\PLAPfont]
- \tikzstyle{probas}= [font=\PLAPfontproba]
- \ifboolKV[PLTIKZARBRE]{inclineprobas}
- {\tikzstyle{PLetiquette}=[pos=0.525,sloped,fill=white]}
- {\tikzstyle{PLetiquette}=[pos=0.525,fill=white]}
- \ifboolKV[PLTIKZARBRE]{fleche}
- {\tikzstyle{PLfleche}=[->,>=latex,\PLAPtypetrait,\PLAPeptrait]}
- {\tikzstyle{PLfleche}=[\PLAPtypetrait,\PLAPeptrait]}
- %arbre2x2
- \IfEq{\PLAPtype}{2x2}
- {%
- \coordinate (R) at ({0*\PLAPespniv},{-1.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-0.5*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-2.5*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (A12)--(A23) ;}
- {\draw[PLfleche] (A12)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- }{}
- %arbre3x2
- \IfEq{\PLAPtype}{3x2}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-2.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-0.5*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-2.5*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A13) at ({1*\PLAPespniv},{-4.5*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[9,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (A12)--(A23) ;}
- {\draw[PLfleche] (A12)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (R)--(A13) ;}
- {\draw[PLfleche] (R)--(A13) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A13)--(A25) ;}
- {\draw[PLfleche] (A13)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- \IfEq{\PLARBREDONNES[9,2]}{}
- {\draw[PLfleche] (A13)--(A26) ;}
- {\draw[PLfleche] (A13)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[9,3]}] {{\PLARBREDONNES[9,2]}} ;}
- }{}
- %arbre2x3
- \IfEq{\PLAPtype}{2x3}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-2.5*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (A11)--(A23) ;}
- {\draw[PLfleche] (A11)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (A12)--(A25) ;}
- {\draw[PLfleche] (A12)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A12)--(A26) ;}
- {\draw[PLfleche] (A12)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- }{}
- %arbre2x3
- \IfEq{\PLAPtype}{3x3}
- {%
- %sommets
- \coordinate (R) at ({0*\PLAPespniv},{-4*\PLAPespfeuille}) ;
- \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]};
- \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]};
- \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[10,1]};
- \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]};
- \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]};
- \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]};
- \node[noeud] (A24) at ({2*\PLAPespniv},{-3*\PLAPespfeuille}) {\PLARBREDONNES[6,1]};
- \node[noeud] (A25) at ({2*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[7,1]};
- \node[noeud] (A26) at ({2*\PLAPespniv},{-5*\PLAPespfeuille}) {\PLARBREDONNES[8,1]};
- \node[noeud] (A27) at ({2*\PLAPespniv},{-6*\PLAPespfeuille}) {\PLARBREDONNES[10,1]};
- \node[noeud] (A28) at ({2*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[11,1]};
- \node[noeud] (A29) at ({2*\PLAPespniv},{-8*\PLAPespfeuille}) {\PLARBREDONNES[12,1]};
- %branches
- \IfEq{\PLARBREDONNES[1,2]}{}
- {\draw[PLfleche] (R)--(A11) ;}
- {\draw[PLfleche] (R)--(A11) node[probas,PLetiquette,{\PLARBREDONNES[1,3]}] {{\PLARBREDONNES[1,2]}} ;}
- \IfEq{\PLARBREDONNES[5,2]}{}
- {\draw[PLfleche] (R)--(A12) ;}
- {\draw[PLfleche] (R)--(A12) node[probas,PLetiquette,{\PLARBREDONNES[5,3]}] {{\PLARBREDONNES[5,2]}} ;}
- \IfEq{\PLARBREDONNES[9,2]}{}
- {\draw[PLfleche] (R)--(A13) ;}
- {\draw[PLfleche] (R)--(A13) node[probas,PLetiquette,{\PLARBREDONNES[9,3]}] {{\PLARBREDONNES[9,2]}} ;}
- %N2
- \IfEq{\PLARBREDONNES[2,2]}{}
- {\draw[PLfleche] (A11)--(A21) ;}
- {\draw[PLfleche] (A11)--(A21) node[probas,PLetiquette,{\PLARBREDONNES[2,3]}] {{\PLARBREDONNES[2,2]}} ;}
- \IfEq{\PLARBREDONNES[3,2]}{}
- {\draw[PLfleche] (A11)--(A22) ;}
- {\draw[PLfleche] (A11)--(A22) node[probas,PLetiquette,{\PLARBREDONNES[3,3]}] {{\PLARBREDONNES[3,2]}} ;}
- \IfEq{\PLARBREDONNES[4,2]}{}
- {\draw[PLfleche] (A11)--(A23) ;}
- {\draw[PLfleche] (A11)--(A23) node[probas,PLetiquette,{\PLARBREDONNES[4,3]}] {{\PLARBREDONNES[4,2]}} ;}
- \IfEq{\PLARBREDONNES[6,2]}{}
- {\draw[PLfleche] (A12)--(A24) ;}
- {\draw[PLfleche] (A12)--(A24) node[probas,PLetiquette,{\PLARBREDONNES[6,3]}] {{\PLARBREDONNES[6,2]}} ;}
- \IfEq{\PLARBREDONNES[7,2]}{}
- {\draw[PLfleche] (A12)--(A25) ;}
- {\draw[PLfleche] (A12)--(A25) node[probas,PLetiquette,{\PLARBREDONNES[7,3]}] {{\PLARBREDONNES[7,2]}} ;}
- \IfEq{\PLARBREDONNES[8,2]}{}
- {\draw[PLfleche] (A12)--(A26) ;}
- {\draw[PLfleche] (A12)--(A26) node[probas,PLetiquette,{\PLARBREDONNES[8,3]}] {{\PLARBREDONNES[8,2]}} ;}
- \IfEq{\PLARBREDONNES[10,2]}{}
- {\draw[PLfleche] (A13)--(A27) ;}
- {\draw[PLfleche] (A13)--(A27) node[probas,PLetiquette,{\PLARBREDONNES[10,3]}] {{\PLARBREDONNES[10,2]}} ;}
- \IfEq{\PLARBREDONNES[11,2]}{}
- {\draw[PLfleche] (A13)--(A28) ;}
- {\draw[PLfleche] (A13)--(A28) node[probas,PLetiquette,{\PLARBREDONNES[11,3]}] {{\PLARBREDONNES[11,2]}} ;}
- \IfEq{\PLARBREDONNES[12,2]}{}
- {\draw[PLfleche] (A13)--(A29) ;}
- {\draw[PLfleche] (A13)--(A29) node[probas,PLetiquette,{\PLARBREDONNES[12,3]}] {{\PLARBREDONNES[12,2]}} ;}
- }{}
- }
- {
- \end{tikzpicture}
-}
-
-%==============SCHEMASPROBAS============= OK!
-%densites utiles
-\def\densnorm#1{1/(sqrt(2*pi))*exp(-0.5*(#1*#1))}
-\def\densexpo#1{exp(-#1)}
-
-\defKV[GRPHPROBCONTINUES]{%
- CouleurAire=\def\GRPHPROBcoulsurf{#1},%
- CouleurCourbe=\def\GRPHPROBcoulcbe{#1},%
- Largeur=\def\GRPHPROBlarg{#1},%
- Hauteur=\def\GRPHPROBhauteur{#1}
-}
-
-\setKVdefault[GRPHPROBCONTINUES]{%
- CouleurAire=LightGray,%
- CouleurCourbe=red,%
- Largeur=2,%
- Hauteur=1,%
- AfficheM=true,%
- AfficheCadre=true
-}
-
-\NewDocumentCommand\LoiNormaleGraphe{ O{} D<>{} m m m m }{%1=options,2=optionstikz,3=m,4=s,5=a,6=b
- %simplekv
- \useKVdefault[GRPHPROBCONTINUES]%
- \setKV[GRPHPROBCONTINUES]{#1}%
- %unites
- \def\UNITEX{\fpeval{\GRPHPROBlarg/8}}\def\UNITEY{\fpeval{\GRPHPROBhauteur/0.5}}%
- %bornes
- \def\BorneInf{\fpeval{(#5-#3)/#4}}\def\BorneSup{\fpeval{(#6-#3)/#4}}%
- \ifthenelse{\equal{#5}{*}}{\def\BorneInf{-4}}{}%
- \ifthenelse{\equal{#6}{*}}{\def\BorneSup{4}}{}%
- %tikzpicture
- \begin{tikzpicture}[x=\UNITEX cm,y=\UNITEY cm,#2]
- \ifboolKV[GRPHPROBCONTINUES]{AfficheM}%
- {\draw (0,-0.0375) node[font=\tiny,scale={2*\UNITEX}] {#3} ;}
- {}
- \ifboolKV[GRPHPROBCONTINUES]{AfficheCadre}%
- {\draw[Gray] (-4,-0.075) rectangle (4,0.425) ;}
- {}
- \clip (-4,-0.075) rectangle (4,0.425) ;
- \draw[black,semithick,fill=\GRPHPROBcoulsurf] ({\BorneInf},0) -- plot [domain={\BorneInf}:{\BorneSup},samples=100] (\x,{\densnorm{\x}}) -- ({\BorneSup},0) -- cycle;
- \draw[thick,->,>=stealth] (-4,0)--(4,0) ;
- \draw[thick,densely dotted] (0,0)--(0,0.39894) ;
- \draw[thick,domain=-4:4,samples=100,\GRPHPROBcoulcbe] plot (\x,{\densnorm{\x}}) ;
- \end{tikzpicture}
-}
-
-\NewDocumentCommand\LoiExpoGraphe{ O{} D<>{} m m m }{%1=options,2=optionstikz,3=l,4=a,5=b
- %simplekv
- \useKVdefault[GRPHPROBCONTINUES]%
- \setKV[GRPHPROBCONTINUES]{#1}%
- %unites
- \def\UNITEX{\fpeval{\GRPHPROBlarg/4}}\def\UNITEY{\fpeval{\GRPHPROBhauteur/1}}%
- \def\MOYENNE{\fpeval{trunc(1/#3,0)}}%
- %bornes
- \def\BorneInf{\fpeval{#3*#4}}\def\BorneSup{\fpeval{#3*#5}}%
- \ifthenelse{\equal{#4}{*}}{\def\BorneInf{0}}{}%
- \ifthenelse{\equal{#5}{*}}{\def\BorneSup{4}}{}%
- %tikzpicture
- \begin{tikzpicture}[x=\UNITEX cm,y=\UNITEY cm,#2]
- \ifboolKV[GRPHPROBCONTINUES]{AfficheCadre}%
- {\draw[Gray] (-0.2,-0.15) rectangle (3.8,0.85) ;}
- {}
- \clip (-0.2,-0.15) rectangle (3.8,0.85) ;
- \draw[black,semithick,fill=\GRPHPROBcoulsurf] ({\BorneInf},0) -- plot [domain={\BorneInf}:{\BorneSup},samples=100] (\x,{0.7*\densexpo{\x}}) -- ({\BorneSup},0) -- cycle;
- \ifboolKV[GRPHPROBCONTINUES]{AfficheM}%
- {\draw (1,-0.075) node[font=\tiny,scale={\UNITEX}] {\MOYENNE} ;
- \draw[thick,densely dotted] (1,0)--(1,{0.7*\densexpo{1}}) ;}
- {}
- \draw[thick,->,>=stealth] (-0.2,0)--(3.8,0) ;
- \draw[thick,->,>=stealth] (0,-0.15)--(0,0.85) ;
- \draw[thick,domain=0:3.8,samples=100,\GRPHPROBcoulcbe] plot (\x,{0.7*\densexpo{\x}}) ;
- \end{tikzpicture}
-}
-
-%===============TRINOMEALEA============== OK!
-\setKVdefault[trinomealea]{%
- Alea=false,%
- Anegatif=true
-}
-
-\NewDocumentCommand\EcritureTrinome{ O{} m m m }{%
- \useKVdefault[trinomealea]%
- \setKV[trinomealea]{#1}%
- \ifboolKV[trinomealea]{Alea}%
- {%
- \xdef\Coeffa{\fpeval{randint(#2)}}\xdef\Coeffb{\fpeval{randint(#3)}}\xdef\Coeffc{\fpeval{randint(#4)}}%
- \xdef\AleaSigneA{\fpeval{randint(1,2)}}%
- \ifboolKV[trinomealea]{Anegatif}%
- {\xintifboolexpr{\AleaSigneA == 1}{\def\TriSigneA{}}{\def\TriSigneA{-}}}%
- {\def\TriSigneA{}}%forcément a>0
- }%
- {%
- \xdef\Coeffa{#2}\xdef\Coeffb{#3}\xdef\Coeffc{#4}%
- \def\TriSigneA{}%
- }%
- \def\TriPartieA{\num{\TriSigneA\Coeffa} x^2}%
- \xintifboolexpr{\Coeffa == 1}%
- {\def\TriPartieA{x^2}}{}%
- \xintifboolexpr{\Coeffa == -1}%
- {\def\TriPartieA{-x^2}}{}%
- \def\TriPartieB{\num[print-implicit-plus]{\Coeffb}x}%
- \xintifboolexpr{\Coeffb == 0}%
- {\def\TriPartieB{}}{}%
- \xintifboolexpr{\Coeffb == 1}%
- {\def\TriPartieB{+x}}{}%
- \xintifboolexpr{\Coeffb == -1}%
- {\def\TriPartieB{-x}}{}%
- \xintifboolexpr{\Coeffc == 0}%
- {\def\TriPartieC{}}{\def\TriPartieC{\num[print-implicit-plus]{\Coeffc}}}%
- %formatage
- \ensuremath{\TriPartieA\TriPartieB\TriPartieC}%
-}
-
-
-%=================PRESPGCD=============== OK!
-\DeclareMathOperator{\PLpgcd}{PGCD}
-\defKV[prespgcd]{%
- Couleur=\def\PLPGCDCouleur{#1},%
- DecalRect=\def\PLPGCDDecal{#1},%
- Noeud=\def\PLPGCDNoeud{#1}
-}
-
-\setKVdefault[prespgcd]{%
- Couleur=red,%
- DecalRect=2pt,%
- Rectangle=true,%
- Noeud=FFF,%
- CouleurResultat=false,%
- AfficheConclusion=true,%
- AfficheDelimiteurs=true
-}
-
-\newcommand\PresentationPGCD[3][]{%
- \useKVdefault[prespgcd]%
- \setKV[prespgcd]{#1}%
- \xdef\respgcd{\xinteval{gcd(#2,#3)}}
- \xdef\ValA{#2}\xdef\ValB{#3}%on stocke les valeurs du départ
- \ensuremath{%
- \ifboolKV[prespgcd]{AfficheDelimiteurs}%
- {\left\lbrace}%
- {}%
- \begin{array}{@{\,}r@{\;=\;}l@{\;+\;}r}
- %1ère division
- \xdef\ValQ{\fpeval{trunc(\ValA/\ValB,0)}}\xdef\ValR{\fpeval{\ValA-\ValB*\ValQ}}
- \num{\ValA}\uppercase{&}\num{\ValB}\times\num{\ValQ}\uppercase{&}%
- \xintifboolexpr{\ValR == \respgcd}%
- {\PLnoeud{\PLPGCDNoeud1}{\num{\ValR}}}%noeud si c'est le pgcd
- {\num{\ValR}}%
- \xdef\ValA{\ValB}\xdef\ValB{\ValR}%nouvelles valeurs
- \whiledo {\ValR > 0}%
- {%
- \xdef\ValQ{\fpeval{trunc(\ValA/\ValB,0)}}\xdef\ValR{\fpeval{\ValA-\ValB*\ValQ}}%
- \\%
- \num{\ValA}\uppercase{&}\num{\ValB}\times\num{\ValQ}\uppercase{&}%
- \xintifboolexpr{\ValR == \respgcd}%
- {\PLnoeud{\PLPGCDNoeud1}{\num{\ValR}}}%noeud si c'est le pgcd
- {\num{\ValR}}%
- \xdef\ValA{\ValB}\xdef\ValB{\ValR}%nouvelles valeurs
- }%
- \end{array}%
- \ifboolKV[prespgcd]{AfficheDelimiteurs}%
- {\right|}%
- {}%
- \ifboolKV[prespgcd]{AfficheConclusion}%
- {%
- \Rightarrow \PLpgcd\left(\num{#2}\mathpunct{};\num{#3}\right)=\ifboolKV[prespgcd]{CouleurResultat}{\mathcolor{\PLPGCDCouleur}{\num{\respgcd}}}{\num{\respgcd}}%
- }%
- {}%
- }%
- \ifboolKV[prespgcd]{Rectangle}%
- {%
- \begin{tikzpicture}
- \draw[overlay,rounded corners=4pt,\PLPGCDCouleur,thick] ($(\PLPGCDNoeud1.north west)+(-\PLPGCDDecal,\PLPGCDDecal)$) rectangle ($(\PLPGCDNoeud1.south east)+(\PLPGCDDecal,-\PLPGCDDecal)$) ;
- \end{tikzpicture}%
- }{}%
-}
-
-\endinput \ No newline at end of file