From c1550dd8735691b6aff1800ec1a50560c62d6a2f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 11 May 2024 20:36:14 +0000 Subject: proflycee (11may24) git-svn-id: svn://tug.org/texlive/trunk@71235 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/proflycee/ProfLycee-doc.pdf | Bin 1691169 -> 1783164 bytes .../doc/latex/proflycee/ProfLycee-doc.tex | 314 --------------- .../doc/latex/proflycee/ProfLycee-docctan.zip | Bin 272353 -> 275828 bytes .../proflycee/ProfLycee-exemples-pyluatex.pdf | Bin 73910 -> 74004 bytes .../proflycee/ProfLycee-exemples-pyluatex.tex | 427 --------------------- .../proflycee/ProfLycee-exemples-pythontex.tex | 242 ------------ .../texmf-dist/tex/latex/proflycee/ProfLycee.sty | 4 +- .../latex/proflycee/proflycee-tools-aleatoire.tex | 14 +- .../latex/proflycee/proflycee-tools-analyse.tex | 30 ++ .../tex/latex/proflycee/proflycee-tools-arithm.tex | 390 +++++++++++++++++++ .../latex/proflycee/proflycee-tools-graphiques.tex | 189 +++++++-- .../tex/latex/proflycee/proflycee-tools-probas.tex | 183 +++++++++ 12 files changed, 775 insertions(+), 1018 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.tex delete mode 100644 Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.tex delete mode 100644 Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pythontex.tex diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.pdf b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.pdf index b2c61b2f613..000537a0d48 100644 Binary files a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.pdf and b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.tex b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.tex deleted file mode 100644 index 34da7d98f89..00000000000 --- a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-doc.tex +++ /dev/null @@ -1,314 +0,0 @@ -% !TeX TXS-program:compile = txs:///arara -% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} -% arara: pythontex: {rerun: always} -% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} -% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') - -\documentclass[a4paper,french,11pt]{article} -\def\PLversion{3.03d} -\def\PLdate{20 avril 2024} -\usepackage{amsfonts} -\usepackage{ProfLycee} -\useproflyclib{piton,minted,pythontex,ecritures,espace} -\usepackage[math-style=french]{fourier-otf} -\usepackage{mathrsfs}%pour mathscr -\usepackage{awesomebox} -\usepackage[lua]{tkz-euclide} -\usepackage{tkz-tab} -\tikzstyle{every picture}+=[remember picture] -\usetikzlibrary{hobby} -\usepackage[group-minimum-digits=4]{siunitx} -\sisetup{locale=FR} -\usepackage{enumitem} -\usepackage{fancyvrb} -\usepackage{fancyhdr} -\usepackage{tabularray} -\usepackage{multicol} -\DeclareMathSymbol{;}\mathbin{operators}{'73} %espacement avec ; -%fancy -\fancyhf{} -\renewcommand{\headrulewidth}{0pt} -\lfoot{\sffamily \small [ProfLycee]} -\cfoot{\sffamily \small - \thepage{} -} -\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} - -\usepackage{graphics} -\usepackage{hologo} -\providecommand\tikzlogo{Ti\textit{k}Z} -\providecommand\TeXLive{\TeX{}Live\xspace} -\providecommand\PSTricks{\textsf{PSTricks}\xspace} -\let\pstricks\PSTricks -\let\TikZ\tikzlogo -\newcommand\TableauDocumentation{% - \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\huge\sffamily}} - {\LaTeX} & {\hologo{pdfLaTeX}} & {\hologo{LuaLaTeX}} & {\TikZ} & {\TeXLive} & {\hologo{MiKTeX}} \\ - \end{tblr} -} -\usepackage{simplekv} -\usepackage{menukeys} -\let\tab\relax -\usepackage{tabto} -\usepackage{pgf,pgfplots} -\pgfplotsset{compat=newest,xlabel near ticks,ylabel near ticks} -\usepackage{listofitems} -\usepackage{xintexpr} -\usepackage{codehigh} -\usepackage{scontents} -\usepackage{hyperref} -\urlstyle{same} -\hypersetup{pdfborder=0 0 0} -\usepackage{geometry} -\geometry{margin=1.5cm} -\usepackage{babel} -\usepackage{newverbs} - -\input{ProfLycee-doc-macropreamb.tex} - -\input{ProfLycee-doc-pagegarde.tex} - -\newpage - -\phantomsection -\hypertarget{matoc}{} - -\tableofcontents - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Introduction} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-introduction.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Liste des commandes} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-listecommandes.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Écritures mathématiques} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-ecritures.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour l'analyse} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-outilsanalyse.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils graphiques} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-outilsgraphiques.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Présentation de codes} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-prescodes.tex} - -\pagebreak - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour la géométrie} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-outilsgeom.tex} - -\pagebreak - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour la géométrie analytique} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-outilsgeomanalyt.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour les statistiques} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-stats.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour les probabilités} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-probas.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Outils pour l'arithmétique} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-arithm.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Écritures, simplifications} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-simplif.tex} - -\pagebreak - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Jeux et récréations} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-jeuxrecreat.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Compétences en lycée} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-competences.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Examens} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-exams.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Projets, en test} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-projets.tex} - -\newpage - -\phantom{t}\par\vfill\par -\begin{PART} - \begin{center} - \Huge\MakeUppercase{Historique} - \end{center} -\end{PART} -\par\vfill\par\phantom{t} - -\newpage - -\input{ProfLycee-doc-historique.tex} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-docctan.zip b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-docctan.zip index 918815456de..6bfaa0e0a8f 100644 Binary files a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-docctan.zip and b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-docctan.zip differ diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.pdf b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.pdf index f8e331e0a66..5e6698109fb 100644 Binary files a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.pdf and b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.pdf differ diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.tex b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.tex deleted file mode 100644 index 03648eea0c1..00000000000 --- a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pyluatex.tex +++ /dev/null @@ -1,427 +0,0 @@ -% !TeX TXS-program:compile = txs:///arara -% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} -% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') - -\documentclass[french,a4paper,10pt]{article} -\def\PLver{3.03c} -\usepackage[margin=1.5cm]{geometry} -\usepackage{ProfLycee} -\useproflyclib{piton} -\usepackage[executable=python,ignoreerrors]{pyluatex} -\usepackage{babel} -\sisetup{locale=FR,output-decimal-marker={,},group-minimum-digits=4} -\usepackage{codehigh} - -\begin{document} - -\part*{ProfLycee (\PLver), Piton et Pyluatex} - -\section{Code \og Piton \fg{}, indépendant de Pyluatex} - -\subsection{Préambule basique} - -{\small \begin{codehigh} -\documentclass[french,a4paper,10pt]{article} -\usepackage{ProfLycee} -\useproflyclib{piton} % lua -\end{codehigh}} - -\subsection{Exemples} - -{\small \begin{codehigh} -%Sortie par défaut -\begin{CodePiton}{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} -\end{codehigh}} - -\begin{CodePiton}{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} - -{\small \begin{codehigh} -%Sortie avec style Classique, Largeur=10cm -\begin{CodePiton}[Largeur=10cm]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} -\end{codehigh}} - -\begin{CodePiton}[Largeur=10cm]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} - -\pagebreak - -{\small \begin{codehigh} -%Sortie avec Style=Moderne, Sans Titre, Largeur=10cm, centré -\begin{CodePiton}[Style=Moderne,Largeur=10cm,BarreTitre=false,Alignement=center]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} -\end{codehigh}} - -\begin{CodePiton}[Style=Moderne,Largeur=10cm,BarreTitre=false,Alignement=center]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} - -{\small \begin{codehigh} -%Sortie avec Style=Classique, Largeur=0.5\linewidth, aligné à droite, sans Cadre, avec Filigrane -\begin{CodePiton}% - [Largeur=0.5\linewidth,Cadre=false,Alignement=flush right,Filigrane,Titre={Script}]{} -#environnement piton avec numéros de ligne, pleine largeur, style moderne -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} -\end{codehigh}} - -\begin{CodePiton}[Largeur=0.5\linewidth,Cadre=false,Alignement=flush right,Filigrane,Titre={Script}]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} - -{\small \begin{codehigh} -%Sortie Moderne, Largeur=11cm, avec Filigrane, aligné à gauche, sans ligne -\begin{CodePiton}[Style=Moderne,Largeur=11cm,Filigrane,Alignement=flush left,Lignes=false]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} -\end{codehigh}} - -\begin{CodePiton}[Style=Moderne,Largeur=11cm,Filigrane,Alignement=flush left,Lignes=false]{} -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{CodePiton} - -\pagebreak - -\section{Console \og Piton \fg{}, dépendant de Pyluatex} - -\subsection{Préambule, avec le package pyluatex} - -{\small \begin{codehigh} -\documentclass[french,a4paper,10pt]{article} -\usepackage{ProfLycee} -\useproflyclib{piton} -\usepackage[executable=python]{pyluatex} % lua + shell-escape -\end{codehigh}} - -\subsection{Commande} - -{\small \begin{codehigh} -\begin{ConsolePiton}[Options piton]{Options tcbox} -... -... -\end{ConsolePiton} -\end{codehigh}} - -\medskip - -Les clés, à placer entre \texttt{<...>}, sont : - -\begin{itemize} - \item \textbf{\textsf{$\langle$Logo$\rangle$}} pour afficher un petit logo dans les \textit{titres} de la console REPL ; \hfill{}défaut : \textbf{\textsf{$\langle$true$\rangle$}} - \item \textbf{\textsf{$\langle$Largeur$\rangle$}} pour spécifier la largeur de la console REPL ; \hfill{}défaut : \textbf{\textsf{$\langle$\textbackslash{}linewidth$\rangle$}} - \item \textbf{\textsf{$\langle$Alignement$\rangle$}} pour spécifier l'alignement de la console REPL.\hfill{}défaut : \textbf{\textsf{$\langle$flush left$\rangle$}} -\end{itemize} - -\subsection{Exemples} - -{\small \begin{codehigh} -%Déclaration d'une fonction python + librairie random pour utilisation ultérieure -\begin{python} -from random import randint - -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{python} -\end{codehigh}} - -\begin{python} -from random import randint - -def valeur_absolue(x) : - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0 : - return x - else: - return -x -\end{python} - -{\small \begin{codehigh} -\begin{ConsolePiton}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -\end{ConsolePiton} -\end{codehigh}} - -\begin{ConsolePiton}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -\end{ConsolePiton} - -\pagebreak - -{\small \begin{codehigh} -\begin{ConsolePiton}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -liste = [randint(1,20) for i in range(10)] -print(liste) -print(max(liste), min(liste), sum(liste)) -\end{ConsolePiton} -\end{codehigh}} - -\begin{ConsolePiton}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -liste = [randint(1,20) for i in range(10)] -print(liste) -print(max(liste), min(liste), sum(liste)) -\end{ConsolePiton} - -{\small \begin{codehigh} -\begin{ConsolePiton}{} -[i**2 for i in range(50)] -\end{ConsolePiton} -\end{codehigh}} - -\begin{ConsolePiton}{} -[i**2 for i in range(50)] -\end{ConsolePiton} - -\pagebreak - -\section{Présentation, et exécution, comme avec Thonny} - -\subsection{Préambule, avec le package pyluatex} - -{\small \begin{codehigh} -\documentclass[french,a4paper,10pt]{article} -\usepackage{ProfLycee} -\useproflyclib{piton} -\usepackage[executable=python]{pyluatex} % lua + shell-escape -\end{codehigh}} - -\subsection{Commandes} - -{\small \begin{codehigh} -\begin{PitonThonnyEditor}[options tcbox]{largeur} -... -\end{PitonThonnyEditor} -\end{codehigh}} - -\medskip - -La clé, à placer entre \texttt{<...>}, est : - -\begin{itemize} - \item la clé \textbf{\textsf{$\langle$Gobble$\rangle$}} pour spécifier des options liées au \textsf{gobble}, parmi \textbf{\textsf{$\langle$nb/auto$\rangle$}} ; - - \hfill{}à adapter en fonction des situations (!) - \item la clé \textbf{\textsf{$\langle$NomFichier$\rangle$}} pour afficher le nom du fichier dans le cartouche \textit{éditeur}. - - \hfill{}défaut : \textbf{\textsf{$\langle$script.py$\rangle$}} -\end{itemize} - -{\small \begin{codehigh} -\begin{PitonThonnyConsole}[options tcbox]{largeur} -... -\end{PitonThonnyConsole} -\end{codehigh}} - -\medskip - -Les clés, à placer entre \texttt{<...>}, sont : - -\begin{itemize} - \item la clé \textbf{\textsf{$\langle$NomConsole$\rangle$}} pour afficher le nom de la \textit{console} ; \hfill{}défaut \textbf{\textsf{$\langle$console$\rangle$}} - \item la clé \textbf{\textsf{$\langle$IntroConsole$\rangle$}} pour afficher le message d'accueil de la console. -\end{itemize} - -\subsection{Exemples} - -{\small\begin{codehigh} -\begin{python} -from math import gcd - -def est_duffy(n) : - nb_div, somme_div = 0, 0 - for i in range(1, n+1) : - if n % i == 0 : - nb_div += 1 - somme_div += i - if gcd(somme_div, n) == 1 : - return True - else : - return False - -\end{python} -\end{codehigh}} - -{\small\begin{codehigh} -\begin{PitonThonnyEditor}{12cm} -#PROJET CAPYTALE -from math import gcd - -def est_duffy(n) : - nb_div = 0 - somme_div = 0 - for i in range(1, n+1) : - if n % i == 0 : - nb_div += 1 - somme_div += i - if gcd(somme_div, n) == 1 : - return True - else : - return False -\end{PitonThonnyEditor} -\end{codehigh}} - -\begin{PitonThonnyEditor}{12cm} -#PROJET CAPYTALE -from math import gcd - -def est_duffy(n) : - nb_div = 0 - somme_div = 0 - for i in range(1, n+1) : - if n % i == 0 : - nb_div += 1 - somme_div += i - if gcd(somme_div, n) == 1 : - return True - else : - return False -\end{PitonThonnyEditor} - -{\small\begin{codehigh} -\begin{PitonThonnyConsole}{12cm} -#Run tpcapytale.py -est_duffy(6) -est_duffy(13) -est_duffy(265) - -from random import randint -nb = randint(1,100000) -nb, est_duffy(nb) -\end{PitonThonnyConsole} -\end{codehigh}} - -\begin{python} -from math import gcd - -def est_duffy(n) : - nb_div, somme_div = 0, 0 - for i in range(1, n+1) : - if n % i == 0 : - nb_div += 1 - somme_div += i - if gcd(somme_div, n) == 1 : - return True - else : - return False - -\end{python} -\begin{PitonThonnyConsole}{12cm} -#Run tpcapytale.py -est_duffy(6) -est_duffy(13) -est_duffy(265) - -from random import randint -nb = randint(1,100000) -nb, est_duffy(nb) -\end{PitonThonnyConsole} - -{\small\begin{codehigh} -\begin{PitonThonnyConsole}{8cm} -[i**2 for i in range(50)] -\end{PitonThonnyConsole} -\end{codehigh}} - -\begin{PitonThonnyConsole}{8cm} -[i**2 for i in range(50)] -\end{PitonThonnyConsole} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pythontex.tex b/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pythontex.tex deleted file mode 100644 index e418300cae1..00000000000 --- a/Master/texmf-dist/doc/latex/proflycee/ProfLycee-exemples-pythontex.tex +++ /dev/null @@ -1,242 +0,0 @@ -% !TeX TXS-program:compile = txs:///arara -% arara: lualatex: {shell: no, synctex: yes, interaction: batchmode} -% arara: pythontex: {rerun: always} if found('pytxcode', 'PYTHONTEX#py') -% arara: lualatex: {shell: no, synctex: yes, interaction: batchmode} if found('pytxcode', 'PYTHONTEX#py') -% arara: lualatex: {shell: no, synctex: yes, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') - -\documentclass[french,a4paper,10pt]{article} -\def\PLver{2.7.5} -\usepackage[margin=1.5cm]{geometry} -\usepackage{ProfLycee} -\useproflyclib{pythontex} -\usepackage{babel} -\sisetup{locale=FR,output-decimal-marker={,},group-minimum-digits=4} -\usepackage{codehigh} - -\begin{document} - -\part*{ProfLycee (\PLver), Pythontex} - -\section{Code \og Pythontex \fg{}} - -\subsection{Préambule basique} - -{\small \begin{codehigh} -\documentclass[french,a4paper,10pt]{article} -\usepackage{ProfLycee} -\useproflyclib{pythontex} % compilation spécifique -\end{codehigh}} - -\subsection{Exemples} - -{\small \begin{codehigh} -%Sortie par défaut -\begin{CodePythontex}{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontex} -\end{codehigh}} - -\begin{CodePythontex}{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x - -#bla -#bla -#bla -\end{CodePythontex} - -{\small \begin{codehigh} -%Sortie avec Style=Classique, Largeur=10cm, centré -\begin{CodePythontexAlt}[Largeur=10cm,Centre,PremLigne=10]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontexAlt} -\end{codehigh}} - -\begin{CodePythontexAlt}[Largeur=10cm,Centre,PremLigne=10]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x - -#bla -#bla -#bla -\end{CodePythontexAlt} - -\pagebreak - -{\small \begin{codehigh} -%Sortie avec Style=Classique, Largeur=10cm -\begin{CodePythontexAlt}[Largeur=10cm]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontexAlt} -\end{codehigh}} - -\begin{CodePythontexAlt}[Largeur=10cm]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontexAlt} - -{\small \begin{codehigh} -%Sortie avec Style=Classique, Largeur=0.5\linewidth, centré, sans numéro -\begin{CodePythontexAlt}[Largeur=0.5\linewidth,Centre,Lignes=false]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontexAlt} -\end{codehigh}} - -\begin{CodePythontexAlt}[Largeur=0.5\linewidth,Centre,Lignes=false]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontexAlt} - -{\small \begin{codehigh} -%Sortie Moderne, Largeur=11cm, sans ligne -\begin{CodePythontex}[Largeur=11cm,Lignes=false]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontex} -\end{codehigh}} - -\begin{CodePythontex}[Largeur=11cm,Lignes=false]{} -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x -\end{CodePythontex} - -\pagebreak - -\section{Console \og Pythontex \fg{}} - -{\small \begin{codehigh} -%Déclaration d'une fonction python + librairie random pour utilisation ultérieure -\begin{pyconcode} -from random import randint - -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x - -\end{pyconcode} -\end{codehigh}} - -\begin{pyconcode} -from random import randint - -def valeur_absolue(x): - "Renvoie la valeur absolue de x" - #le petit test qui va bien - if x > 0: - return x - else: - return -x - -\end{pyconcode} - -{\small \begin{codehigh} -\begin{ConsolePythontex}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -\end{ConsolePythontex} -\end{codehigh}} - -\begin{ConsolePythontex}{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -\end{ConsolePythontex} - -\pagebreak - -{\small \begin{codehigh} -\begin{ConsolePythontex}[Largeur=12cm,Centre]{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -liste = [randint(1,20) for i in range(10)] -print(liste) -print(max(liste), min(liste), sum(liste)) -\end{ConsolePythontex} -\end{codehigh}} - -\begin{ConsolePythontex}[Largeur=12cm,Centre]{} -1+1 -2**10 -valeur_absolue(-3) -valeur_absolue(0) -valeur_absolue(5) -print(f"La valeur absolue de 5 est {valeur_absolue(5)}") -print(f"La valeur absolue de -4 est {valeur_absolue(-4)}") -liste = [randint(1,20) for i in range(10)] -print(liste) -print(max(liste), min(liste), sum(liste)) -\end{ConsolePythontex} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty b/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty index 25a212e65ad..f6222383099 100644 --- a/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty +++ b/Master/texmf-dist/tex/latex/proflycee/ProfLycee.sty @@ -3,7 +3,9 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2024/04/20 3.03d Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2024/05/09 3.04b Aide pour l'utilisation de LaTeX en lycee] +% 3.04b Travail sur la loi binomiale + Ajout de clés pour les environnements graphiques +% 3.04a Améliorations de la partie graphiques tikz (intégrales, axes) + Factorielle % 3.03d Page de garde type BAC % 3.03c Correction du fonctionnement gobble avec piton + compatibilité luamplib PfC % 3.03b Compétences Maths Lycées + \pflnum pour num+xint :-) + correction de bugs (div eucl) diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-aleatoire.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-aleatoire.tex index 19d13ab9321..4d4a50eca37 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-aleatoire.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-aleatoire.tex @@ -85,8 +85,18 @@ \newcommand\NbAlea[4][0]{%entier ou décimal \xintifboolexpr{#1 == 0}% - {\xdef#4{\fpeval{randint(#2,#3)}}}% - {\xdef#4{\fpeval{round(randint(#2,#3)+rand(),#1)}}}% + {% + \xdef#4{\fpeval{randint(#2,#3)}}% + }% + {% + \xintifboolexpr{(#3-#2) == 1}% + {% + \xdef#4{\fpeval{round(#2+rand(),#1)}}% + }% + {% + \xdef#4{\fpeval{round(randint(#2,#3)+rand(),#1)}}% + }% + }% } \newcommand\VarNbAlea[2]{% \xdef#1{\fpeval{#2}}% diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex index 5e1f246ab3f..ade88434c2c 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-analyse.tex @@ -574,6 +574,36 @@ }% } +%===intégrale 'brute' +\NewDocumentCommand\CalcIntegrale{ s O{} D<>{50} m m m }{% + \xintdeffloatfunc varfct(x) := #4 ;% + \def\TmpNmU{\xinteval{(#3)-1}}% + \def\TmpRes{\xintfloateval{(#6-#5)/(6*(#3))*(2*add(varfct(#5+i*(#6-#5)/(#3)),i=1..\TmpNmU)+varfct(#5)+varfct(#6)+4*add(varfct(#5+(i+0.5)*(#6-#5)/(#3)), i=0..\TmpNmU))}}% + \IfStrEq{#2}{}% + {% + \IfBooleanTF{#1}{\num{\TmpRes}}{\TmpRes}% + }% + {% + \IfBooleanTF{#1}{\num{\xintfloateval{round(\TmpRes,#2)}}}{\xintfloateval{round(\TmpRes,#2)}}% + }% + \relax +} + +%===intégrale 'brute' +\NewDocumentCommand\ValeurMoyenneIntg{ s O{} D<>{50} m m m }{% + \xintdeffloatfunc varfct(x) := #4 ;% + \def\TmpNmU{\xinteval{(#3)-1}}% + \def\TmpRes{\xintfloateval{(1)/(6*(#3))*(2*add(varfct(#5+i*(#6-#5)/(#3)),i=1..\TmpNmU)+varfct(#5)+varfct(#6)+4*add(varfct(#5+(i+0.5)*(#6-#5)/(#3)), i=0..\TmpNmU))}}% + \IfStrEq{#2}{}% + {% + \IfBooleanTF{#1}{\num{\TmpRes}}{\TmpRes}% + }% + {% + \IfBooleanTF{#1}{\num{\xintfloateval{round(\TmpRes,#2)}}}{\xintfloateval{round(\TmpRes,#2)}}% + }% + \relax +} + %==intégrale tikz== \defKV[methodeintegrtkz]{% diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex index db3f2bc8ac4..a021fea9374 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-arithm.tex @@ -1512,4 +1512,394 @@ {}% } +%====FACTORIELLE +\defKV[calcfactorielle]{ChSignif=\def\factochfsign{#1},Sens=\def\factochfsens{#1}} +\setKVdefault[calcfactorielle]{% + Complet=false,% + Enonce=false,% + Partiel=false,% + Grand=false,% + ChSignif=9,% + Espace=\mkern1.5mu\relax,% + Sens=m +} + +\NewDocumentCommand\Factorielle{ s O{} m }{% + \restoreKV[calcfactorielle]% + \setKV[calcfactorielle]{#2}% + \ifboolKV[calcfactorielle]{Grand}% + {% + \xdef\tmpres{\xintfloateval[\factochfsign]{factorial(#3)}}% + }% + {% + \xdef\tmpres{\xinteval{factorial(#3)}}% + }% + \ensuremath{% + \ifboolKV[calcfactorielle]{Enonce}% + {% + \IfBooleanTF{#1}{#3\useKV[calcfactorielle]{Espace}!}{\num{#3}\useKV[calcfactorielle]{Espace}!}= + }% + {}% + \ifboolKV[calcfactorielle]{Partiel}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1 \times 2 \times \ldots \times \xinteval{#3-1} \times #3 \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{#3 \times \xinteval{#3-1} \times \ldots \times 2 \times 1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1 \times 2 \times \ldots \times \num{\xinteval{#3-1}} \times \num{#3} \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{\num{#3} \times \num{\xinteval{#3-1}} \times \ldots \times 2 \times 1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + }% + {}% + \ifboolKV[calcfactorielle]{Complet}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1 \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times ##1} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{##1 \times} 1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1 \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times \num{##1}} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{\num{##1} \times} 1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + }% + {}% + \IfBooleanTF{#1}% + {% + \tmpres% + }% + {% + \ifboolKV[calcfactorielle]{Grand}% + {% + \num[scientific-notation=true]{\tmpres}% + }% + {% + \num{\tmpres}% + }% + }% + }% +} + +\NewDocumentCommand\Primorielle{ s O{} m }{% + \restoreKV[calcfactorielle]% + \setKV[calcfactorielle]{#2}% + \def\tmpres{1}% + \xintFor* ##1 in {\xintSeq{1}{#3}}\do{% + \pgfmathisprime{##1}\ifnum\pgfmathresult=1\xdef\tmpres{\xinteval{\tmpres*##1}}\fi% + }% + \ifboolKV[calcfactorielle]{Grand}% + {% + \xdef\tmpres{\xintfloateval[\factochfsign]{\tmpres}}% + }% + {}% + \ensuremath{% + \ifboolKV[calcfactorielle]{Enonce}% + {% + \IfBooleanTF{#1}{#3\#}{\num{#3}\#}= + }% + {}% + \ifboolKV[calcfactorielle]{Complet}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEq{\factochfsens}{m}% + {% + 2 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{\pgfmathisprime{##1}\ifnum\pgfmathresult=1\times##1\fi} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{\pgfmathisprime{##1}\ifnum\pgfmathresult=1##1\times\fi} 2 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + {% + \IfStrEq{\factochfsens}{m}% + {% + 2 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{\pgfmathisprime{##1}\ifnum\pgfmathresult=1\times\num{##1}\fi} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{\pgfmathisprime{##1}\ifnum\pgfmathresult=1\num{##1}\times\fi} 2 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + }% + {}% + \IfBooleanTF{#1}% + {% + \tmpres% + }% + {% + \ifboolKV[calcfactorielle]{Grand}% + {% + \num[scientific-notation=true]{\tmpres}% + }% + {% + \num{\tmpres}% + }% + }% + }% +} + +\NewDocumentCommand\DoubleFactorielle{ s O{} m }{% + \restoreKV[calcfactorielle]% + \setKV[calcfactorielle]{#2}% + \def\tmpres{1}% + \xintFor* ##1 in {\xintSeq{1}{#3}}\do{% + \xintifboolexpr{\xintiiOdd{#3} == \xintiiOdd{##1} 'or' \xintiiEven{#3} == \xintiiEven{##1}}% + {% + \xdef\tmpres{\xinteval{\tmpres*##1}}% + }% + {}% + }% + \ifboolKV[calcfactorielle]{Grand}% + {% + \xdef\tmpres{\xintfloateval[\factochfsign]{\tmpres}}% + }% + {}% + \ensuremath{% + \ifboolKV[calcfactorielle]{Enonce}% + {% + \IfBooleanTF{#1}{#3\useKV[calcfactorielle]{Espace}!!}{\num{#3}\useKV[calcfactorielle]{Espace}!!}= + }% + {}% + \ifboolKV[calcfactorielle]{Complet}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEq{\factochfsens}{m}% + {% + \xintifboolexpr{\xintiiOdd{#3} == 1}% + {% + 1 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} == 1}{\times##1}{}% + }% + }% + {% + 2 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} != 1}{\times##1}{}% + }% + }% + \ifboolKV[calcfactorielle]{Grand}{\approx}{=}% + }% + {% + \xintifboolexpr{\xintiiOdd{#3} == 1}% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} == 1}{##1\times}{}% + }1% + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} != 1}{##1\times}{}% + }2% + }% + \ifboolKV[calcfactorielle]{Grand}{\approx}{=}% + }% + }% + {% + \IfStrEq{\factochfsens}{m}% + {% + \xintifboolexpr{\xintiiOdd{#3} == 1}% + {% + 1 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} == 1}{\times\num{##1}}{}% + }% + }% + {% + 2 \xintFor* ##1 in {\xintSeq{3}{#3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} != 1}{\times\num{##1}}{}% + }% + }% + \ifboolKV[calcfactorielle]{Grand}{\approx}{=}% + }% + {% + \xintifboolexpr{\xintiiOdd{#3} == 1}% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} == 1}{\num{##1}\times}{}% + }1% + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{3}}\do{% + \xintifboolexpr{\xintiiOdd{##1} != 1}{\num{##1}\times}{}% + }2% + }% + \ifboolKV[calcfactorielle]{Grand}{\approx}{=}% + }% + }% + }% + {}% + \IfBooleanTF{#1}% + {% + \tmpres% + }% + {% + \ifboolKV[calcfactorielle]{Grand}% + {% + \num[scientific-notation=true]{\tmpres}% + }% + {% + \num{\tmpres}% + }% + }% + }% +} + +\NewDocumentCommand\HyperFactorielle{ s O{} m }{% + \restoreKV[calcfactorielle]% + \setKV[calcfactorielle]{#2}% + \def\tmpres{1}% + \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\xdef\tmpres{\xinteval{\tmpres*(##1)^(##1)}}}% + \ifboolKV[calcfactorielle]{Grand}% + {% + \xdef\tmpres{\xintfloateval[\factochfsign]{\tmpres}}% + }% + {}% + \ensuremath{% + \ifboolKV[calcfactorielle]{Enonce}% + {% + \IfBooleanTF{#1}{\text{H}(#3)}{\text{H}(\rm{#3})}= + }% + {}% + \ifboolKV[calcfactorielle]{Partiel}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1^1 \times 2^2 \times \ldots \times \xinteval{#3-1}^{\xinteval{#3-1}} \times #3^{#3} \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{#3^{#3} \times \xinteval{#3-1}^{\xinteval{#3-1}} \times \ldots \times 2^2 \times 1^1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1 \times 2 \times \ldots \times \num{\xinteval{#3-1}}^{\num{\xinteval{#3-1}}} \times \num{#3}^{\num{#3}} \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{\num{#3}^{\num{#3}} \times \num{\xinteval{#3-1}}^{\num{\xinteval{#3-1}}} \times \ldots \times 2^2 \times 1^1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + }% + {}% + \ifboolKV[calcfactorielle]{Complet}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1^1 \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times ##1^{##1}} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{##1^{##1} \times} 1^1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1^1 \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times \num{##1}^{\num{##1}}} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{\num{##1}^{\num{##1}} \times} 1^1 \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + }% + {}% + \IfBooleanTF{#1}% + {% + \tmpres% + }% + {% + \ifboolKV[calcfactorielle]{Grand}% + {% + \num[scientific-notation=true]{\tmpres}% + }% + {% + \num{\tmpres}% + }% + }% + }% +} + +\NewDocumentCommand\SuperFactorielle{ s O{} m }{% + \restoreKV[calcfactorielle]% + \setKV[calcfactorielle]{#2}% + \def\tmpres{1}% + \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\xdef\tmpres{\xinteval{\tmpres*factorial(##1)}}}% + \ifboolKV[calcfactorielle]{Grand}% + {% + \xdef\tmpres{\xintfloateval[\factochfsign]{\tmpres}}% + }% + {}% + \ensuremath{% + \ifboolKV[calcfactorielle]{Enonce}% + {% + \IfBooleanTF{#1}{\text{sf}(#3)}{\text{sf}(\num{#3})}= + }% + {}% + \ifboolKV[calcfactorielle]{Partiel}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1\useKV[calcfactorielle]{Espace}! \times 2\useKV[calcfactorielle]{Espace}! \times \ldots \times \xinteval{#3-1}\useKV[calcfactorielle]{Espace}! \times #3\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{#3\useKV[calcfactorielle]{Espace}! \times \xinteval{#3-1}\useKV[calcfactorielle]{Espace}! \times \ldots \times 2\useKV[calcfactorielle]{Espace}! \times 1\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + {% + \IfStrEqCase{\factochfsens}{% + {m}{1\useKV[calcfactorielle]{Espace}! \times 2\useKV[calcfactorielle]{Espace}! \times \ldots \times \num{\xinteval{#3-1}}\useKV[calcfactorielle]{Espace}! \times \num{#3}\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + {d}{\num{#3}\useKV[calcfactorielle]{Espace}! \times \num{\xinteval{#3-1}}\useKV[calcfactorielle]{Espace}! \times \ldots \times 2\useKV[calcfactorielle]{Espace}! \times 1\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=}}% + }% + }% + }% + {}% + \ifboolKV[calcfactorielle]{Complet}% + {% + \IfBooleanTF{#1}% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1\useKV[calcfactorielle]{Espace}! \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times ##1\useKV[calcfactorielle]{Espace}!} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{##1\useKV[calcfactorielle]{Espace}! \times} 1\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + {% + \IfStrEq{\factochfsens}{m}% + {% + 1\useKV[calcfactorielle]{Espace}! \xintFor* ##1 in {\xintSeq{2}{#3}}\do{\times \num{##1}\useKV[calcfactorielle]{Espace}!} \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + {% + \xintFor* ##1 in {\xintSeq{#3}{2}}\do{\num{##1}\useKV[calcfactorielle]{Espace}! \times} 1\useKV[calcfactorielle]{Espace}! \ifboolKV[calcfactorielle]{Grand}{\approx}{=} + }% + }% + }% + {}% + \IfBooleanTF{#1}% + {% + \tmpres% + }% + {% + \ifboolKV[calcfactorielle]{Grand}% + {% + \num[scientific-notation=true]{\tmpres}% + }% + {% + \num{\tmpres}% + }% + }% + }% +} + \endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-graphiques.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-graphiques.tex index 22775038e70..74a3e827ed2 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-graphiques.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-graphiques.tex @@ -36,7 +36,7 @@ } \NewDocumentCommand\PtsDiscontinuite{ O{} m }{% - \useKVdefault[ptdiscont] + \restoreKV[ptdiscont] \setKV[ptdiscont]{#1}% \setsepchar[.]{§./}% \readlist*\SPLlisteDiscont{#2}% @@ -101,7 +101,7 @@ %1=liste %2=num point début %3=num point fin - \useKVdefault[genspline]% + \restoreKV[genspline]% \setKV[genspline]{#1}% \setsepchar[.]{§./}% \readlist*\SPLlistepoints{#2}% @@ -156,7 +156,7 @@ \NewDocumentCommand\SplineTikz{ O{} m }{% %\newcommand\SplineTikz[2][]{% - \useKVdefault[spline] + \restoreKV[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[.]{§./}% @@ -219,7 +219,7 @@ } \newcommand\TangenteTikz[2][]{% - \useKVdefault[tgte]% + \restoreKV[tgte]% \setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie \setsepchar[.]{§./}% \readlist*\TGTlistepoints{#2}% @@ -308,26 +308,36 @@ } \DeclareDocumentCommand\AxexTikz{ O{} m }{% - \useKVdefault[PLaxextkz] + \restoreKV[PLaxextkz] \setKV[PLaxextkz]{#1}% on paramètres les nouvelles clés et on les simplifie %récupération des tickwidth H/B \IfSubStr{\axextickwidth}{/} {\StrCut{\axextickwidth}{/}{\axextickwidthA}{\axextickwidthB}} {\def\axextickwidthA{\axextickwidth}\def\axextickwidthB{\axextickwidth}} + %====test==== + \IfEq{#2}{auto}% + {% + \xdef\tmprangexvalues{\xintfloateval{seq(i,i=\xmin..[\xgrille]..\xmax)}}\StrDel{\tmprangexvalues}{ }[\tmprangexvalues]% + \setKV[PLaxextkz]{Trigo=false}% + }% + {% + \xdef\tmprangexvalues{#2}% + }% + %====fintest= %en fonction de Trigo ou non \ifboolKV[PLaxextkz]{Trigo} - { - \foreach \x in {#2}{% + {% + \foreach \x in \tmprangexvalues {% \draw[line width=\axexwidth] ({\x-\axexOx},{\axextickwidthA}) -- ({\x-\axexOx},{-\axextickwidthB})% \ifboolKV[PLaxextkz]{AffGrad}%on affiche les graduations {% node[\axexposlabel,font=\axexfont] {\ifboolKV[PLaxextkz]{Dfrac}{$\AffAngleRadian*{\x}$}{$\AffAngleRadian{\x}$}} }% {}% - ;} - } - { - \foreach \x in {#2}{% + ;}% + }% + {% + \foreach \x in \tmprangexvalues {% \draw[line width=\axexwidth] ({\x-\axexOx},{\axextickwidthA}) -- ({\x-\axexOx},{-\axextickwidthB})% \ifboolKV[PLaxextkz]{AffGrad}%on affiche les graduations {% @@ -336,16 +346,16 @@ {\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}}% - } - } - } - } - {} + }% + }% + }% + }% + {}% ;} } @@ -371,26 +381,36 @@ } \DeclareDocumentCommand\AxeyTikz{ O{} m }{% - \useKVdefault[PLaxeytkz] + \restoreKV[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}} + {\StrCut{\axeytickwidth}{/}{\axeytickwidthA}{\axeytickwidthB}} + {\def\axeytickwidthA{\axeytickwidth}\def\axeytickwidthB{\axeytickwidth}} + %====test==== + \IfEq{#2}{auto}% + {% + \xdef\tmprangeyvalues{\xintfloateval{seq(i,i=\ymin..[\ygrille]..\ymax)}}\StrDel{\tmprangeyvalues}{ }[\tmprangeyvalues]% + }% + {% + \xdef\tmprangeyvalues{#2}% + }% + %====fintest= + \ifboolKV[PLaxeytkz]{Frac}% {% \ifboolKV[PLaxeytkz]{AffGrad}%on affiche les graduations {% - \foreach \y in {#2} + \foreach \y in \tmprangeyvalues {\draw[line width=\axeywidth] ({\axeytickwidthA},{\y-\axeyOy}) -- ({-\axeytickwidthB},{\y-\axeyOy}) % \xintifboolexpr{\y==\axeyOy}{}{node[\axeyposlabel,font=\axeyfont] {\ConversionFraction{\y}}} ;} }% {% - \foreach \y in {#2} + \foreach \y in \tmprangeyvalues {\draw[line width=\axeywidth] ({\axeytickwidthA},{\y-\axeyOy}) -- ({-\axeytickwidthB},{\y-\axeyOy}) ;} }% }% {% - \foreach \y in {#2}{% + \foreach \y in \tmprangeyvalues {% \draw[line width=\axeywidth] ({\axeytickwidthA},{\y-\axeyOy}) -- ({-\axeytickwidthB},{\y-\axeyOy})% \ifboolKV[PLaxeytkz]{AffGrad}%on affiche les graduations {% @@ -414,6 +434,12 @@ }% } +%axesOxoy +\DeclareDocumentCommand\AxexyTikz{ O{} O{} m m }{% + \AxexTikz[#1]{#3} + \AxeyTikz[#2]{#4} +} + %axes \defKV[PLaxestkz]{% Epaisseur=\def\axeswidth{#1},% @@ -444,7 +470,7 @@ } \DeclareDocumentCommand\AxesTikz{ O{} }{% - \useKVdefault[PLaxestkz] + \restoreKV[PLaxestkz] \setKV[PLaxestkz]{#1}% %les petits élargissements \IfSubStr{\axeselargx}{/} @@ -490,7 +516,7 @@ } \DeclareDocumentCommand\OrigineTikz{ O{} }{% - \useKVdefault[PLaxesorig]% + \restoreKV[PLaxesorig]% \setKV[PLaxesorig]{#1}% \draw (0,0) node[\axesorpos=\axesordecal,font=\axesorfont] {\axesorval} ; } @@ -498,11 +524,12 @@ %grilles \setKVdefault[PLgrillestkz]{% Affp=true,% - Affs=true + Affs=true,% + Dernier=false } \DeclareDocumentCommand\GrilleTikz{ O{} O{thin,lightgray} O{ultra thin,lightgray} }{% - \useKVdefault[PLgrillestkz] + \restoreKV[PLgrillestkz] \setKV[PLgrillestkz]{#1}% \ifboolKV[PLgrillestkz]{Affs} {\draw[xstep=\xgrilles,ystep=\ygrilles,#3] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});} @@ -510,6 +537,12 @@ \ifboolKV[PLgrillestkz]{Affp} {\draw[xstep=\xgrille,ystep=\ygrille,#2] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});} {} + \ifboolKV[PLgrillestkz]{Dernier} + {% + \draw[#2] ({\xmin-\axexOx},{\ymax-\axeyOy}) -- ({\xmax-\axexOx},{\ymax-\axeyOy});% + \draw[#2] ({\xmax-\axexOx},{\ymin-\axeyOy}) -- ({\xmax-\axexOx},{\ymax-\axeyOy});% + } + {} } %point(s) avec changement origines @@ -526,7 +559,7 @@ } \newcommand\PLnuagepoints[2][]{% - \useKVdefault[PLpts] + \restoreKV[PLpts] \setKV[PLpts]{#1}% \setsepchar{§}% \readlist\listepointsaffiches{#2} @@ -546,7 +579,7 @@ } \newcommand\NuagePointsTikz[3][]{% - \useKVdefault[PLpts] + \restoreKV[PLpts] \setKV[PLpts]{#1}% on paramètres les nouvelles clés et on les simplifie \def\xliste{#2} \def\yliste{#3} @@ -597,7 +630,7 @@ } \newcommand\PointMoyenTikz[1][]{% - \useKVdefault[PLptmoy] + \restoreKV[PLptmoy] \setKV[PLptmoy]{#1}% on paramètres les nouvelles clés et on les simplifie \IfStrEq{\ptmoystyle}{o}% { @@ -648,7 +681,7 @@ } \DeclareDocumentCommand\FenetreSimpleTikz{ O{} D(){} D<>{} m D<>{} m }{% - \useKVdefault[PLsimplewindow]% + \restoreKV[PLsimplewindow]% \setKV[PLsimplewindow]{#1}% on paramètres les nouvelles clés et on les simplifie \ifboolKV[PLsimplewindow]{Grille}% {\GrilleTikz}% @@ -664,6 +697,10 @@ \tikzset{declare function={#1(\x)=#2;}} } +\NewDocumentCommand\DeclareFonctionTikzXint{ O{f} m }{%nom_fonction+langage xint + \xintdeffloatfunc #1(x) := #2 ;% +} + %====INTERVALLES TIKZ \usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing} @@ -821,4 +858,92 @@ \end{scope}% } +%====Intégrale TikZ +\defKV[IntegrDomainTikz]{% + Epaisseur=\def\intgdomtikzthick{#1},% + Couleurs=\def\intgdomtikzcolors{#1},% + Style=\def\intgdomtikzstyle{#1},% + Opacite=\def\intgdomtikzopac{#1},% + Samples=\def\intgdomtikzsamples{#1},% + Hachures=\def\intgdomtikzhatch{#1},% + Type=\def\intgdomtikztype{#1},% + Pas=\def\intgdomtikzstep{#1},% + Jonction=\def\intgdomtikzjoin{#1} +} +\setKVdefault[IntegrDomainTikz]{% + Epaisseur=1pt,% + Couleurs={gray/teal},% + Style=remplissage,% + Opacite=0.5,% + Samples=250,% + Hachures={north west lines},% + Type=dessous,% + Pas=0.1,% + Jonction=bevel +} + +\NewDocumentCommand\IntegraleTikz{ O{} D<>{} m O{0} m m }{% + %1 = clés + %2 = options particulières tikz + %3 = fonction, en tikz + %4 = fonction n°2 éventuelle + %de #5 à #6 + \restoreKV[IntegrDomainTikz]% revenir au valeurs par défaut + \setKV[IntegrDomainTikz]{#1}% lit les arguments optionnels + \StrCut{\intgdomtikzcolors}{/}{\intgcolbord}{\intcolhach}% + \IfStrEq{\intgcolbord}{}{\xdef\intgcolbord{none}}{}% + \IfStrEq{\intgdomtikzstyle}{hachures}% + {% + \tikzset{integraletikzstyle/.style={line width=\intgdomtikzthick,draw=\intgcolbord,pattern=\intgdomtikzhatch,pattern color=\intcolhach,line join=\intgdomtikzjoin}} + }% + {}% + \IfStrEq{\intgdomtikzstyle}{remplissage}% + {% + \tikzset{integraletikzstyle/.style={line width=\intgdomtikzthick,draw=\intgcolbord,fill=\intcolhach,fill opacity=\intgdomtikzopac,line join=\intgdomtikzjoin}} + }% + {}% + \IfStrEq{\intgdomtikztype}{dessous}% + {% + \draw[integraletikzstyle,#2] (#5,0) -- plot[samples=\intgdomtikzsamples,domain=#5:#6] (\x,{#3}) --(#6,0) -- cycle ; + }% + {}% + \IfStrEq{\intgdomtikztype}{entre}% + {% + \draw[integraletikzstyle,#2] plot[samples=\intgdomtikzsamples,domain=#5:#6] (\x,{#3}) -- plot[samples=\intgdomtikzsamples,domain=#6:#5] (\x,{#4}) -- cycle ; + }% + {}% +} + +\NewDocumentCommand\IntegraleTikzXint{ O{} D<>{} m O{0} m m }{% + %1 = clés + %2 = options particulières tikz + %3 = fonction, en tikz + %4 = fonction n°2 éventuelle + %de #5 à #6 + \restoreKV[IntegrDomainTikz]% revenir au valeurs par défaut + \setKV[IntegrDomainTikz]{#1}% lit les arguments optionnels + \StrCut{\intgdomtikzcolors}{/}{\intgcolbord}{\intcolhach}% + \IfStrEq{\intgcolbord}{}{\xdef\intgcolbord{none}}{}% + \IfStrEq{\intgdomtikzstyle}{hachures}% + {% + \tikzset{integraletikzstyle/.style={line width=\intgdomtikzthick,draw=\intgcolbord,pattern=\intgdomtikzhatch,pattern color=\intcolhach,line join=\intgdomtikzjoin}} + }% + {}% + \IfStrEq{\intgdomtikzstyle}{remplissage}% + {% + \tikzset{integraletikzstyle/.style={line width=\intgdomtikzthick,draw=\intgcolbord,fill=\intcolhach,fill opacity=\intgdomtikzopac,line join=\intgdomtikzjoin}} + }% + {}% + \IfStrEq{\intgdomtikztype}{dessous}% + {% + \draw[integraletikzstyle,#2] (#5,0) -- plot[smooth] coordinates {\xintthecoords\xintfloatexpr seq((x,#3),x=#5..[\intgdomtikzstep]..#6)\relax} -- (#6,0) -- cycle ; + }% + {}% + \IfStrEq{\intgdomtikztype}{entre}% + {% + \draw[integraletikzstyle,#2] plot[smooth] coordinates {\xintthecoords\xintfloatexpr seq((x,#3),x=#5..[\intgdomtikzstep]..#6)\relax} -- plot[smooth] coordinates {\xintthecoords\xintfloatexpr seq((x,#4),x=#6..[-\intgdomtikzstep]..#5)\relax} -- cycle ; + }% + {}% +} + \endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-probas.tex b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-probas.tex index e817af767ea..92cff337721 100644 --- a/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-probas.tex +++ b/Master/texmf-dist/tex/latex/proflycee/proflycee-tools-probas.tex @@ -1041,4 +1041,187 @@ }% } +%===BINOMIALE +\defKV[HistoBinom]{% + Largeur=\def\GraphBinomLarg{#1},% + Hauteur=\def\GraphBinomHaut{#1},% + PasX=\def\GraphBinomPasX{#1},% + PasY=\def\GraphBinomPasY{#1},% + Plage=\def\GraphBinomPlage{#1},% + CouleurPlage=\def\GraphBimomColPlage{#1},% + Epaisseur=\def\GraphBinomThick{#1},% + ClipX=\def\GraphBinomXminmax{#1},% + Police=\def\GraphBinomFonte{#1},% + CouleurNormale=\def\GraphBinomColNorm{#1} +} +\setKVdefault[HistoBinom]{% + Largeur=10,% + Hauteur=5,% + PasX=5,% + PasY=0.01,% + Plage={},% + CouleurPlage=teal!50,% + Epaisseur=0.8pt, + ClipX={},% + Police=\normalfont\normalsize,% + AffNormale=false,% + CouleurNormale=red +} + +\NewDocumentCommand\HistogrammeBinomiale{ O{} D<>{} m m }{% + \restoreKV[HistoBinom]% + \setKV[HistoBinom]{#1} + \def\GraphBinomN{#3}% + \def\GraphBinomP{#4}% + \IfStrEq{\GraphBinomXminmax}{}% + {% + \xdef\GraphBinomXmin{0}% + \xdef\GraphBinomXmax{\GraphBinomN}% + }% + {% + \StrCut{\GraphBinomXminmax}{-}{\GraphBinomXmin}{\GraphBinomXmax}% + \IfStrEq{\GraphBinomXmin}{*}{\xdef\GraphBinomXmin{0}}{}% + \IfStrEq{\GraphBinomXmax}{*}{\xdef\GraphBinomXmax{\GraphBinomN}}{}% + }% + \IfStrEq{\GraphBinomPlage}{}% + {}% + {% + \StrCut{\GraphBinomPlage}{-}{\GraphBinomColorMin}{\GraphBinomColorMax}% + \IfStrEq{\GraphBinomColorMin}{*}{\xdef\GraphBinomColorMin{\GraphBinomXmin}}{}% + \IfStrEq{\GraphBinomColorMax}{*}{\xdef\GraphBinomColorMax{\GraphBinomXmax}}{}% + }% + %test d'unités + \xdef\GraphBinomXunit{\xintfloateval{round((\GraphBinomLarg)/(\GraphBinomXmax-\GraphBinomXmin+1),3)}}% + \xdef\grphbinommedA{\xintfloateval{trunc(\GraphBinomN*\GraphBinomP,0)}}% + \xdef\grphbinommedB{\xintfloateval{\grphbinommedA+1}}% + \xdef\GraphBinomYmaxA{\xintfloateval{binomial(\GraphBinomN,\grphbinommedA)*(\GraphBinomP)^(\grphbinommedA)*(1-(\GraphBinomP))^((\GraphBinomN)-(\grphbinommedA))}}% + \xdef\GraphBinomYmaxB{\xintfloateval{binomial(\GraphBinomN,\grphbinommedB)*(\GraphBinomP)^(\grphbinommedB)*(1-(\GraphBinomP))^((\GraphBinomN)-(\grphbinommedB))}}% + \xdef\GraphBinomMaxY{\xintfloateval{1.1*max(\GraphBinomYmaxA,\GraphBinomYmaxB)}}% + \xdef\GraphBinomNbPrecision{\xinteval{abs(ilog10(\GraphBinomMaxY))+1}}% + \xdef\GraphBinomYunit{\xintfloateval{round((\GraphBinomHaut)/(max(\GraphBinomYmaxA,\GraphBinomYmaxB)),3)}}% + \begin{tikzpicture}[x=\GraphBinomXunit cm,y=\GraphBinomYunit cm,#2] + %coloriage éventuel + \IfStrEq{\GraphBinomPlage}{}% + {}% + {% + \xintFor* ##1 in {\xintSeq{\GraphBinomColorMin}{\GraphBinomColorMax}}\do{% + \xdef\tmpYYY{\xintfloateval{binomial(\GraphBinomN,##1)*(\GraphBinomP)^(##1)*(1-(\GraphBinomP))^((\GraphBinomN)-(##1))}}% + \draw[draw=none,fill=\GraphBimomColPlage,fill opacity=0.5] ({##1-0.5},0) rectangle++ (1,{\tmpYYY}) ; + }% + }% + %axes + \draw[line width=\GraphBinomThick,->,>=latex] ({\GraphBinomXmin-0.5},0)--({\GraphBinomXmax+1},0) ; + \draw[line width=\GraphBinomThick,->,>=latex] ({\GraphBinomXmin-0.5},0)--({\GraphBinomXmin-0.5},{1.1*(\GraphBinomHaut)/(\GraphBinomYunit)}) ; + \foreach \x in {\GraphBinomXmin,\inteval{\GraphBinomXmin+\GraphBinomPasX},...,\GraphBinomXmax}{% + \draw[line width=\GraphBinomThick] (\x,2pt)--++(0,-4pt) node[below,font=\GraphBinomFonte] {\num{\x}} ; + }% + \xdef\GraphBinomNbPrecisionAxeY{\xinteval{abs(ilog10(\GraphBinomPasY))+1}}% + \foreach \y in {0,\GraphBinomPasY,...,\GraphBinomMaxY}{% + \draw[line width=\GraphBinomThick] ($({\GraphBinomXmin-0.5},\y)+(2pt,0)$)--++(-4pt,0) node[left,font=\GraphBinomFonte] {\num{\xintfloateval{round(\y,\GraphBinomNbPrecisionAxeY)}}} ; + }% + %tracé + \xintFor* ##1 in {\xintSeq{\GraphBinomXmin}{\GraphBinomXmax}}\do{% + \xdef\tmpYYY{\xintfloateval{binomial(\GraphBinomN,##1)*(\GraphBinomP)^(##1)*(1-(\GraphBinomP))^((\GraphBinomN)-(##1))}}% + \draw[line width=\GraphBinomThick] ({##1-0.5},0) rectangle++ (1,{\tmpYYY}) ; + } + \ifboolKV[HistoBinom]{AffNormale}% + {% + \xdef\MinNormHistoBinom{\xintfloateval{{\GraphBinomXmin-0.5}}}% + \xdef\MaxNormHistoBinom{\xintfloateval{{\GraphBinomXmax+0.5}}}% + \TraceLoiNormale*[line width={1.25*\GraphBinomThick},\GraphBinomColNorm]<\MinNormHistoBinom..[0.1]..\MaxNormHistoBinom>{#3}{#4} + }% + {}% + \end{tikzpicture} +} + +\NewDocumentEnvironment{HistoBinomiale}{ O{} D<>{} m m }% +{% + \restoreKV[HistoBinom]% + \setKV[HistoBinom]{#1} + \def\GraphBinomN{#3}% + \def\GraphBinomP{#4}% + \IfStrEq{\GraphBinomXminmax}{}% + {% + \xdef\GraphBinomXmin{0}% + \xdef\GraphBinomXmax{\GraphBinomN}% + }% + {% + \StrCut{\GraphBinomXminmax}{-}{\GraphBinomXmin}{\GraphBinomXmax}% + \IfStrEq{\GraphBinomXmin}{*}{\xdef\GraphBinomXmin{0}}{}% + \IfStrEq{\GraphBinomXmax}{*}{\xdef\GraphBinomXmax{\GraphBinomN}}{}% + }% + \IfStrEq{\GraphBinomPlage}{}% + {}% + {% + \StrCut{\GraphBinomPlage}{-}{\GraphBinomColorMin}{\GraphBinomColorMax}% + \IfStrEq{\GraphBinomColorMin}{*}{\xdef\GraphBinomColorMin{\GraphBinomXmin}}{}% + \IfStrEq{\GraphBinomColorMax}{*}{\xdef\GraphBinomColorMax{\GraphBinomXmax}}{}% + }% + %test d'unités + \xdef\GraphBinomXunit{\xintfloateval{round((\GraphBinomLarg)/(\GraphBinomXmax-\GraphBinomXmin+1),3)}}% + \xdef\grphbinommedA{\xintfloateval{trunc(\GraphBinomN*\GraphBinomP,0)}}% + \xdef\grphbinommedB{\xintfloateval{\grphbinommedA+1}}% + \xdef\GraphBinomYmaxA{\xintfloateval{binomial(\GraphBinomN,\grphbinommedA)*(\GraphBinomP)^(\grphbinommedA)*(1-(\GraphBinomP))^((\GraphBinomN)-(\grphbinommedA))}}% + \xdef\GraphBinomYmaxB{\xintfloateval{binomial(\GraphBinomN,\grphbinommedB)*(\GraphBinomP)^(\grphbinommedB)*(1-(\GraphBinomP))^((\GraphBinomN)-(\grphbinommedB))}}% + \xdef\GraphBinomMaxY{\xintfloateval{1.1*max(\GraphBinomYmaxA,\GraphBinomYmaxB)}}% + \xdef\GraphBinomNbPrecision{\xinteval{abs(ilog10(\GraphBinomMaxY))+1}}% + \xdef\GraphBinomYunit{\xintfloateval{round((\GraphBinomHaut)/(max(\GraphBinomYmaxA,\GraphBinomYmaxB)),3)}}% + \begin{tikzpicture}[x=\GraphBinomXunit cm,y=\GraphBinomYunit cm,#2] + %coloriage éventuel + \IfStrEq{\GraphBinomPlage}{}% + {}% + {% + \xintFor* ##1 in {\xintSeq{\GraphBinomColorMin}{\GraphBinomColorMax}}\do{% + \xdef\tmpYYY{\xintfloateval{binomial(\GraphBinomN,##1)*(\GraphBinomP)^(##1)*(1-(\GraphBinomP))^((\GraphBinomN)-(##1))}}% + \draw[draw=none,fill=\GraphBimomColPlage,fill opacity=0.5] ({##1-0.5},0) rectangle++ (1,{\tmpYYY}) ; + }% + }% + %axes + \draw[line width=\GraphBinomThick,->,>=latex] ({\GraphBinomXmin-0.5},0)--({\GraphBinomXmax+1},0) ; + \draw[line width=\GraphBinomThick,->,>=latex] ({\GraphBinomXmin-0.5},0)--({\GraphBinomXmin-0.5},{1.1*(\GraphBinomHaut)/(\GraphBinomYunit)}) ; + \foreach \x in {\GraphBinomXmin,\inteval{\GraphBinomXmin+\GraphBinomPasX},...,\GraphBinomXmax}{% + \draw[line width=\GraphBinomThick] (\x,2pt)--++(0,-4pt) node[below,font=\GraphBinomFonte] {\num{\x}} ; + }% + \xdef\GraphBinomNbPrecisionAxeY{\xinteval{abs(ilog10(\GraphBinomPasY))+1}}% + \foreach \y in {0,\GraphBinomPasY,...,\GraphBinomMaxY}{% + \draw[line width=\GraphBinomThick] ($({\GraphBinomXmin-0.5},\y)+(2pt,0)$)--++(-4pt,0) node[left,font=\GraphBinomFonte] {\num{\xintfloateval{round(\y,\GraphBinomNbPrecisionAxeY)}}} ; + }% + %tracé + \xintFor* ##1 in {\xintSeq{\GraphBinomXmin}{\GraphBinomXmax}}\do{% + \xdef\tmpYYY{\xintfloateval{binomial(\GraphBinomN,##1)*(\GraphBinomP)^(##1)*(1-(\GraphBinomP))^((\GraphBinomN)-(##1))}}% + \draw[line width=\GraphBinomThick] ({##1-0.5},0) rectangle++ (1,{\tmpYYY}) ; + } + %loi normale ? + \ifboolKV[HistoBinom]{AffNormale}% + {% + \xdef\MinNormHistoBinom{\xintfloateval{{\GraphBinomXmin-0.5}}}% + \xdef\MaxNormHistoBinom{\xintfloateval{{\GraphBinomXmax+0.5}}}% + \TraceLoiNormale*[line width={1.25*\GraphBinomThick},\GraphBinomColNorm]<\MinNormHistoBinom..[0.1]..\MaxNormHistoBinom>{#3}{#4} + }% + {}% + }% + {% + \end{tikzpicture} +} + +\xintdeffloatfunc fctreploinorm(x,mu,sigma):=1/(sigma*sqrt(2*Pi))*exp(-1/2*((x-mu)/sigma)^2); + +\NewDocumentCommand\TraceLoiNormale{ s O{} D<>{} m m }{% + \IfBooleanTF{#1}% + {% + \draw[#2] plot[smooth] coordinates {% + \xintthecoords\xintfloatexpr + seq((x,fctreploinorm(x,#4*#5,sqrt(#4*#5*(1-#5)))),x=#3) + \relax + }; + }% + {% + \draw[#2] plot[smooth] coordinates {% + \xintthecoords\xintfloatexpr + seq((x,fctreploinorm(x,#4,#5)),x=#3) + \relax + }; + }% +} + \endinput \ No newline at end of file -- cgit v1.2.3