%\documentclass{book} %DÉSACTIVER POUR A5
\documentclass[a5paper]{book} %ACTIVER POUR A5

%########
% Packages #
%########

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

%######Affichage des maths
\DecimalMathComma %pour ne plus avoir d'espace après la virgule dans l'écriture décimale des nombres

\usepackage{amsmath}
\usepackage{amssymb,amsthm}
\usepackage{mathrsfs}
\usepackage{amsopn}

\usepackage[np]{numprint}%écriture des nombres avec des espaces et en écriture scientifique

\usepackage{dsfont} %Pour faire le 1 double barre de la fonction caractéristque dans un enironnement maths. \mathds{1}
%\usepackage{bbold} %Double barre mais en petit pour tout les nombres dans un environnement maths.\mathbb{1}

%######Graphique
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{tkz-tab}
\usetikzlibrary{shapes,arrows}

\usepackage{geometry} 
\geometry{hmargin={0.75cm,1cm},vmargin={0.5cm,1.25cm},twoside}

%######Tableau
\usepackage{array} %pour centrer dans un tableau
\usepackage{colortbl} %pour colorier les cellules lignes colonnes d'un tableau: \rowcolor{}, \columncolor{}, \cellcolor{purple!25}
\usepackage{tabularx} %quelques amélioraions de l'environnement tabular
\usepackage{diagbox} %Pour faire une diagonale dans une case d'un tableau: \diagbox{bas gauche}{haut droit}
\usepackage{multirow} %fusionner des cellules horizontalement

%######Hyperliens dans les pdf

\usepackage[colorlinks=true,linkcolor=magenta,urlcolor=magenta]{hyperref}% Pour créer des liens à l'intérieur du pdf: \hyperlink{label}{texte du lien} permettra d'atteindre la cible identifiée par \hypertarget{label}{texte de la cible}. Les textes du lien et de la cible peuvent être vides.

%######Des symboles et images

\usepackage{marvosym} %Image de téléphone protable avec la commande \Mobilefone

\usepackage{fdsymbol} %Notamment le cœur plein: \varheartsuit

\usepackage{eurosym}%pour afficher le symbole euro

%######Vrac

\usepackage{enumerate}%énumération avec des lettres
\usepackage{tasks}%Pour avoir une liste en ligne utiliser \begin{tasks}(2) (pour deux colonnes) et non pas enumerate puis \task et non pas \item 
\settasks{
	% the next two should be set to the same value so labels are aligned to the
	% left
	%label-width = 1em ,
	%item-indent = 1em ,
	%before-skip = 0pt%-\parskip , % undo paragraph skip
	%after-skip =0pt% -\parskip , % undo paragraph skip
	after-item-skip = -2pt%-\parskip % undo paragraph skip
}

\usepackage{stmaryrd}%pour faire des "intervalles" d'entiers \llbracket et \rrbracket

\usepackage{xlop}%poser les calculs en colonne: \opdiv[displayintermediary=nonzero,voperation=top,shiftdecimalsep=none]{27}{45}
\opset{decimalsepsymbol={,}}

\usepackage{verbatim}%pour utiliser commande \exclure et normalement pour faire l'affichage tel quel sans compiler le texte. 
%\usepackage{alltt}%Pour utiliser une commande latex dans un environnement verbatim il faut utiliser: alltt
%Pour écrire juste suelques mots en verbatim au milieu d'un phrase: \verb|quelques mots|

\usepackage{fancyhdr}

%######Algo

\usepackage{listings} % \begin{lstlisting} \end{lstlisting} affiche du code comme le fait le langage choisi. \lstset{language=Pascal} \lstset{language=Python} pour choisir le langage dans le document avant chaque programme ou avant le \begin{document} pour l'appliquer à tout le document. 
%\lstset{} permet d'indiquer toutes les options. Pas de caractère accentué (option lourdingue à rajouter) qui vont s'ppliquer pour toute la suite du document: \lstset{language=Python}
%Il espossible d'inclure un code python d'un fichier extérieur \lstinputlisting{source_filename.py}.
%Il est possible de définir une présentation personnalisé par un ensemble de configuration enregistré dans un fichier de style
\lstdefinestyle{pythonstyle}{
	language=Python,
	backgroundcolor=\color{gray!30},   
	commentstyle=\color{Plum},
	keywordstyle=\color{blue},
	numberstyle=\tiny\color{black},
	stringstyle=\color{ForestGreen},
	basicstyle=\ttfamily\color{black},
	breakatwhitespace=false,         
	breaklines=true,                 
	captionpos=b,                    
	keepspaces=true,                 
	numbers=none,                   
	numbersep=5pt,                  
	showspaces=false,                
	showstringspaces=false,
	showtabs=false,                  
	tabsize=1
}
\lstset{style=pythonstyle}

\lstdefinestyle{bashstyle}{
	language=bash,
	backgroundcolor=\color{black},   
	commentstyle=\color{white},
	keywordstyle=\color{magenta},
	numberstyle=\tiny\color{black},
	stringstyle=\color{white},
	basicstyle=\ttfamily\footnotesize\color{white},
	breakatwhitespace=false,         
	breaklines=true,                 
	captionpos=b,                    
	keepspaces=true,                
	numbers=left,                    
	numbersep=5pt,                  
	showspaces=false,                
	showstringspaces=false,
	showtabs=false,                  
	tabsize=1
}
%\lstset{style=bashstyle}

\usepackage[french]{algorithm2e}%pseudocode

\usepackage{scratch3}

%############### Formule developpée molécule chimie

\usepackage{chemfig}

%#####################
% Commande et environnement #
%#####################

\theoremstyle{plain}

%Pour redéfinir les commande section (changer la couleur centrer):
\usepackage{titlesec}
\titleformat{\section}[block]{\color{blue}\Large\bfseries\filcenter}{}{1em}{}
\titleformat{\subsection}[hang]{\color{purple}\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}[hang]{\color{RoyalBlue} \bfseries}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}[hang]{}{}{1em}{}

\renewcommand{\thesection}{{}}
\renewcommand{\thesubsection}{\color{purple}\Roman{subsection}}
\renewcommand{\thesubsubsection}{\color{RoyalBlue}\arabic{subsubsection}}

\newenvironment{correction}{\color{Brown} \footnotesize}{}

\newenvironment{sujet}{}{}

%environnement bareme
\newenvironment{bareme}{\color{RoyalBlue}\footnotesize \hfill }{\footnotesize \emph{~points}}

%environnement détais du barème
\newenvironment{details}{\color{RoyalBlue}\noindent ~\\}{~\\}

%environnement notabene
\newenvironment{notabene}{\color{PineGreen}\noindent ~\\}{~\\}

%environnement exemples
\newenvironment{exemples}{\color{blue} \noindent Exemples.\vspace{-0.1cm}}{}

%environnement remarques
\newenvironment{remarques}{\noindent {\color{BlueViolet}Remarques.\vspace{-0.1cm}}\color{BlueViolet}}{}

\newenvironment{lecon}{\color{Gray}}{}


%Pour redéfinir les environnements exercices et autres avec de la couleur
\newsavebox{\selvestebox}
\newenvironment{colbox}[1]
{\newcommand\colboxcolor{#1}%
	\begin{lrbox}{\selvestebox}%
		\begin{minipage}{\dimexpr\columnwidth-2\fboxsep\relax}}
		{\end{minipage}\end{lrbox}%
	\begin{center}
		\colorbox{\colboxcolor}{\usebox{\selvestebox}}
\end{center}}

%environnement exercice
\newcounter{Exercice}
\setcounter{Exercice}{1}
\newcounter{Exercicecorrection}
\newenvironment{exercice}{ \setcounter{Exercicecorrection}{\theExercice} {\noindent\color{Black}EXERCICE \theExercice.} \addtocounter{Exercice}{1} \color{Black}}

%environnement exercicecorrection
\newenvironment{exercicecorrection}{\noindent\color{Brown}Exercice \theExercicecorrection. \footnotesize}

%environnement definition
\newcounter{Definition}
\setcounter{Definition}{1}
\newenvironment{definition}{\textbf{\color{Orange}Définition \theDefinition.} \addtocounter{Definition}{1} \color{Orange} }{}

\newcounter{Theoreme}
\setcounter{Theoreme}{1}
\newenvironment{theoreme}{\textbf{\color{purple}Théorème \theTheoreme.} \addtocounter{Theoreme}{1}\color{purple}}{}

%environnement proposition
\newcounter{Proposition}
\setcounter{Proposition}{1}
\newenvironment{proposition}{\textbf{\color{purple}Proposition \theProposition.} \addtocounter{Proposition}{1}\color{purple}}{}

%environnement démonstration
\newcounter{Demonstration}
\setcounter{Demonstration}{1}
\newenvironment{preuve}{\noindent{\textbf{\color{PineGreen} Démonstration}.} \addtocounter{Demonstration}{1} \color{PineGreen}}

%environnement conclusion encadré et coloré
\newenvironment{conclusion}
{\color{PineGreen}\begin{tabular}{|c|}\hline \\ \begin{minipage}{0.85\linewidth} \begin{center} }
			{\end{center} \end{minipage} \\ \\ \hline \end{tabular} }

%Commande pour l'objectif et l'écrire en vert
\newcommand{\objectif}[1]{{\color{PineGreen}#1}}

%########################
%Test conditionnel pour l'affichage    #
%########################
\newif\ifs
%\strue%affiche la boite à trous
\sfalse%affiche la réponse

%Pour faire une case à trou complétable sur le pdf
\newcounter{Trous}
\setcounter{Trous}{1}
\newcommand{\trous}[2][3cm]{
	\ifs
	\begin{Form}
		\TextField[name=\theTrous ,bordercolor=,borderwidth=0, backgroundcolor=gray!20, align=1,  width=#1 ,height=0.2cm, bordersep=0,color=black] {}
	\end{Form}
	\xspace
	\else
	#2
	\fi
	\addtocounter{Trous}{1}
}

%Un bug apparu en faisant la mise à jour de pi: les listes tasks ne se colorie plus et restent noir malgrer les commande. La solution est ce truc:
\ExplSyntaxOn\makeatletter
%patch needed to get a around a problem in the l3-drivers
\AtBeginDocument{
 \cs_set_protected_nopar:Npn \color_ensure_current:
   {\set@color}
 }
\ExplSyntaxOff\makeatother 

%#########################
%en tête puis pied de page
%#########################

\pagestyle{empty}
\pagestyle{fancy} 
\renewcommand{\headrulewidth}{0pt}%Pas de ligne horizontale en haut
\lhead[]{}%entre crochets pages paires entre accolades pages impaires
\chead[\small ]{}% l left, c center, r right
\rhead[]{}
\lfoot[]{}
\cfoot[\footnotesize \thepage ]{\footnotesize \thepage }
\rfoot[]{}

%############################
%les environnements qu'on affiche ou pas  #
%############################

\newcommand{\exclure}[1]{\renewenvironment{#1}{\begingroup\comment}{\endcomment\endgroup\ignorespaces}}

%Pour abrege
%\exclure{preuve} \exclure{exemples} \exclure{remarques} \exclure{exercicecorrection} \exclure{notabene} \exclure{details} \exclure{bareme} \exclure{sujet} \exclure{correction}\exclure{culturegenerale}

%Pour cours intégrale
%\exclure{details} \exclure{bareme} \exclure{sujet} \exclure{notabene}%\exclure{exercicecorrection}

%Pour les exercices uniquement.
%\exclure{exemples} \exclure{remarques} \exclure{proposition} \exclure{theoreme} \exclure{preuve} \exclure{definition} \exclure{lecon} \exclure{exercicecorrection} \exclure{notabene} \exclure{details} \exclure{sujet} \exclure{correction}

%Pour les correction d'exercices uniquement.
%\exclure{exemples} \exclure{remarques}  \exclure{proposition} \exclure{theoreme} \exclure{preuve} \exclure{definition} \exclure{lecon} \exclure{notabene} \exclure{details} \exclure{sujet} \exclure{correction}

%Pour devoir surveillé sujet
\exclure{preuve} \exclure{exemples} \exclure{remarques} \exclure{proposition} \exclure{theoreme} \exclure{definition} \exclure{lecon} \exclure{exercicecorrection} \exclure{notabene} \exclure{details} \exclure{correction}

%Pour devoir surveillé correction
%\exclure{preuve} \exclure{exemples} \exclure{remarques} \exclure{proposition} \exclure{theoreme} \exclure{definition} \exclure{lecon} \exclure{exercicecorrection} \exclure{notabene} \exclure{sujet}

%Pour devoir surveillé intégrale
%\exclure{preuve} \exclure{exemples} \exclure{remarques} \exclure{proposition} \exclure{theoreme} \exclure{definition} \exclure{lecon} \exclure{exercicecorrection} \exclure{notabene}

%###############################
%#Double numérotation des pages#
%###############################
%\pagenumbering{roman} %À mettre juste avant \begin{document}. DOnc simplement décommenter.
%\pagenumbering{arabic} %À copier décommenté 

\begin{document}

\small

\subsection*{Travail noté du 2026/02/06.}

\begin{sujet}
	\emph{Pas de calculatrice. Noté sur 38 points. 45 minutes.}
\end{sujet}

\subsubsection{Exercice 1.}

\begin{sujet}
	\emph{Inutile d'encadrer vos conclusion pour cet exercice.}
\end{sujet}

\begin{enumerate}
	\item 
	\begin{sujet}
		Comment note-t-on et comment appelle-t-on l'ensemble de toutes les issues d'une expérience aléatoire?\begin{bareme}2\end{bareme}
	\end{sujet}
	
	\begin{correction}
		$\Omega$ est l'univers.
	\end{correction}
	\item 
	\begin{sujet}
		Comment appelle-t-on un événement dont la probabilité est nulle? Celui dont la probabilité est $1$?\begin{bareme}2\end{bareme}
	\end{sujet}
	
	\begin{correction}
		Si $\mathbb{P}(A)=0$ alors $A$ est un événement impossible.
		
		Si $\mathbb{P}(A)=1$ alors $A$ est un événement certain.
	\end{correction}
	\item 
	\begin{sujet}
		Rappelez les deux formules permettant de calculer des probabilités quelle que soit la loi de probabilité (l'une est appelée formule du crible de Poincaré et l'autre concerne les événements contraires)? \begin{bareme}2\end{bareme}
	\end{sujet}
	
	\begin{correction}
		Formule du crible: $\mathbb{}(A \cup B)=\mathbb{P}(A) + \mathbb{P}(B)-\mathbb{P}(A \cap B)$. et Formule pour l'événement contraire: $\mathbb{P}(\overline{A})=1 -\mathbb{P}(A)$.
	\end{correction}
\end{enumerate}

\subsubsection{Exercice 2.}

%hachette declic 2019 87 page 356

\begin{sujet}	
	On choisit au hasard une famille parmi les familles de deux enfants, en admettant qu'il y a autant de chance que chaque enfant soit un garçon ($G$) ou une fille ($F$). L'issue $FG$ par exemple, indique une famille dont le premier enfant est une fille et dont le deuxième enfant est un garçon.
\end{sujet}

\begin{enumerate}
	\item 	
	\begin{sujet}
		À l'aide d'un arbre, décrire toutes les compositions possibles de familles. \begin{bareme} $8$ \end{bareme}
	\end{sujet}
	
	\begin{correction}		
		\begin{center}
			\begin{tikzpicture}[xscale=1,yscale=0.3]
				\coordinate (A1) at (4,3);
				\coordinate (A2) at (4,1);
				\coordinate (A3) at (4,-1);
				\coordinate (A4) at (4,-3);
				\coordinate (B1) at (2,2);
				\coordinate (B2) at (2,-2);
				\coordinate (C1) at (0,0);
				\draw node (A11) at (A1) {$G$};	
				\draw node (A12) at (A2) {$F$};
				\draw node (A13) at (A3) {$G$};
				\draw node (A14) at (A4) {$F$};
				\draw node (B11) at (B1) {$G$};
				\draw node (B12) at (B2) {$F$};
				\draw (B11)--(A11);
				\draw (B11)--(A12);
				\draw (B12)--(A13);
				\draw (B12)--(A14);
				\draw (C1)--(B11);
				\draw (C1)--(B12);
			\end{tikzpicture}
		\end{center}
	\end{correction}
	\item 
	\begin{sujet}
		On note les événements $A$: \og le premier enfant est une fille \fg{} et $B$:\og la famille a un seul garçon\fg{}.
	\end{sujet}
	\begin{enumerate}
		\item 
		\begin{sujet}
			Calculez $\mathbb{P}(A)$. \begin{bareme} $4$ \end{bareme}
		\end{sujet}
		
		\begin{correction}
			\objectif{Calculons $\mathbb{P}(A)$.}
			
			$A= \{ FG; FF \}$. Il y a équiprobabilité, $A$ est réalisé par $2$ issues, l'univers contient $4$ issues donc: $\mathbb{P}(A) = \frac{2}{4}$.
			
			\begin{conclusion}
				$\mathbb{P}(A)=\frac{1}{2}$.
			\end{conclusion}
		\end{correction}		
		\item 		
		\begin{sujet}
			Calculez $\mathbb{P}(B)$. \begin{bareme} $2$ \end{bareme}
		\end{sujet}
		
		\begin{correction}
			\objectif{Calculons $\mathbb{P}(B)$.}
			
			$B= \{ FG; GF \}$. Il y a équiprobabilité, $B$ est réalisé par $2$ issues, l'univers contient $4$ issues donc: $\mathbb{P}(B) = \frac{2}{4}$.
			
			\begin{conclusion}
				$\mathbb{P}(B)=\frac{1}{2}$.
			\end{conclusion}
		\end{correction}
		\item 
		\begin{sujet}
			Interprétez $A \cap B$ par une phrase puis calculez $\mathbb{P}(A\cap B)$. \begin{bareme} $3$ \end{bareme}
		\end{sujet}
		
		\begin{correction}
			\begin{conclusion}
				$A\cap B$: \og le premier enfant est une fille et la famille n'a qu'un garçon\fg{}.
			\end{conclusion}
			
			\objectif{Calculons $\mathbb{P}(A\cap B)$.}
			
			$A\cap B= \{ FG \}$. Il y a équiprobabilité, $A\cap B$ est réalisé par $1$ issues, l'univers contient $4$ issues donc:
			
			\begin{conclusion}				
				$\mathbb{P}(A \cap B)=\frac{1}{2}$.
			\end{conclusion}
		\end{correction}
		\item 
		\begin{sujet}
			Calculez $\mathbb{P}(A\cup B)$ puis interprétez $A \cup B$ par une phrase. \begin{bareme} $3$ \end{bareme}
		\end{sujet}
		
		\begin{correction}
			\objectif{Calculons $\mathbb{P}(A\cup B)$.}
			
			$\mathbb{P}(A \cup B) = \mathbb{P}(A) + \mathbb{P}(B) - \mathbb{P}(A \cap B) = \frac{1}{2} + \frac{1}{2} -\frac{1}{4}$.
			
			\begin{conclusion}
				$\mathbb{P}(A\cup B)=\frac{3}{4}$.
			\end{conclusion}
			
			\begin{conclusion}
				$A \cup B$: \og le premier enfant et une fille ou la famille n'a qu'un garçon\fg{}.
			\end{conclusion}
		\end{correction}
		\item 
		\begin{sujet}
			Interprétez $\overline{B}$ par un phrase puis calculez $\mathbb{P}\left( \overline{B} \right)$. \begin{bareme} $3$ \end{bareme}
		\end{sujet}
		
		\begin{correction}
			\begin{conclusion}
				$\overline{B}$: \og la famille n'a pas qu'un seul garçon\fg{}.
			\end{conclusion}
			
			\objectif{Calculons $\mathbb{P}(\overline{B})$.}
			
			$\mathbb{P}(\overline{B}) = 1- \mathbb{P}(B) = 1-\frac{1}{2}$.
			
			\begin{conclusion}
				$\mathbb{P}(\overline{B})=\frac{1}{2}$.
			\end{conclusion}
		\end{correction}
	\end{enumerate}
\end{enumerate}


\subsubsection{Exercice 3.}

\begin{sujet}
	On lance deux dés à quatre faces numérotées de $1$ à $4$ et on s'intéresse au produit des deux nombres obtenus.
\end{sujet}

\begin{enumerate}
	\setlength{\parskip}{0pt}
	\setlength{\itemsep}{0pt}
	\item 
	\begin{sujet}
		Représentez l'expérience aléatoire par un tableau double entrée indiquant les produits obtenus. \begin{bareme} 4 \end{bareme}
	\end{sujet}
	
	\begin{correction}
		$\begin{array}{|c|c|c|c|c|}
			\hline
			& 1 & 2 & 3 & 4
			\\
			\hline
			1 & 1 & 2 & 3 & 4
			\\
			\hline
			2 & 2 & 4 &6 & 8
			\\
			\hline
			3 & 3 & 6 & 9 & 12
			\\
			\hline
			4 & 4 & 8 & 12 & 16
			\\
			\hline
		\end{array}$
	\end{correction}
	\item 
	\begin{sujet}
		Calculez la probabilité d'obtenir un nombre supérieur ou égale à $3$. \begin{bareme} 4 \end{bareme}
	\end{sujet}
	
	\begin{correction}
		\objectif{Calculons la probabilité de $E$: \og obtenir un nombre supérieur ou égale à $3$\fg{}.}
		
		L'univers est formé de $16$ couples équiprobables et $\overline{E}=\{ (1,1) , (1,2),(2,1)\}$ contient $3$ issues donc $\mathbb{P}(\overline{E})=\frac{3}{16}$. On en déduit: $\mathbb{P}(E)=1 -\mathbb{P}(\overline{E})=1-\frac{3}{16}$.
		
		\begin{conclusion}
			$\mathbb{P}(E)=\frac{1}{16}$.
		\end{conclusion}
	\end{correction}
	\item 
	\begin{sujet}
		Calculez la probabilité d'obtenir un multiple de $5$. \begin{bareme} 1 \end{bareme}
	\end{sujet}
	
	\begin{correction}
		Aucun des produits obtenus n'est un multiple de $5$.
		
		\begin{conclusion}
			La probabilité d'obtenir un multiple de $5$ est nulle.
		\end{conclusion}
	\end{correction}
\end{enumerate}

\end{document}

\section{Modèles.}

\setlength{\parskip}{0pt}
\setlength{\itemsep}{0pt}

\subsection{Graphique}

\begin{center}
	\begin{tikzpicture}[xscale=1,yscale=1]
	\def\xY{-0.5};
	\def\yY{-0.5};
	\def\xZ{8.5};
	\def\yZ{7};
	\coordinate (Y) at (\xY,\yY);
	\coordinate (Z) at (\xZ,\yZ);
	\draw[xstep=0.1cm, ystep=0.1cm, line width=0.01cm,gray!50!white] (Y) grid (Z);
	\draw[xstep=1cm, ystep=1cm, line width=0.02cm,black!70!white] (Y) grid (Z);
	\draw (0,0)node[below left]{\small $0$};
	\foreach \x in {1, 2} \draw[thick](\x,0.1cm)--(\x,-0.1cm) node[below left]{\footnotesize  \pgfmathparse{\x }\pgfmathprintnumber{\pgfmathresult}};
	\foreach \y in {1,2} \draw[thick](0.1cm,\y)--(-0.1cm,\y) node[below left]{\footnotesize  \pgfmathparse{\y }\pgfmathprintnumber{\pgfmathresult}};
	\draw[ ->,very thick] (\xY, 0) -- (\xZ, 0) node[right]{$x$};
	\draw[ ->,very thick] (0, \yY) -- (0, \yZ) node[above]{$y$};
	\draw[blue, thick][samples=100,domain=0:7] plot(\x,{(\x +1)^2/exp(\x )});
	\draw[blue] (3,2) node[fill=white] {$\mathcal{C}_B$};
	\fill[color=gray , opacity=0.25] (-0.5, {(-(2/9)*((-0.5)*2)*(2*(-0.5))+(4/3)*(2*(-0.5))+4)/2})
	-- plot [domain=-0.5:2] (\x,{(-(2/9)*(\x*2)*(2*\x)+(4/3)*(2*\x)+4)/2})
	-- (2, {(-(2/9)*(2*2)*(2*2)+(4/3)*(2*2)+4)/2})
	-- (2,0) 
	--(-0.5,0)
	-- cycle;
	\draw[blue, thick] plot[smooth] coordinates {(-3,-1)(-2.5,-0.65)};
	\end{tikzpicture}
\end{center}

Pour évaluer la fonction f en a avec tikz: \pgfmathparse{f(a)}\pgfmathresult

%Pour affecter la valeur a à la variable \x: \def\x{a}

\subsection{Graphique nouveau.}


\begin{center}
	
	\begin{tikzpicture}[xscale=1,yscale=1]
	%extremites du graphique
	\def\xcoinbasgauche{-2};
	\def\xcoinhautdroit{4};
	\def\ycoinbasgauche{-4};
	\def\ycoinhautdroit{4};
	%Les deux grilles
	\draw[xstep=0.5cm, ystep=0.5cm, line width=0.01cm,gray!40!white] ({\xcoinbasgauche},{\ycoinbasgauche}) grid ({\xcoinhautdroit},{\ycoinhautdroit});
	\draw[xstep=1cm, ystep=1cm, line width=0.02cm,black!60!white]({\xcoinbasgauche},{\ycoinbasgauche}) grid ({\xcoinhautdroit},{\ycoinhautdroit});
	%Les deux axes
	\draw[ ->,thick,black] (\xcoinbasgauche, 0) -- (\xcoinhautdroit, 0) node[right]{$x$};
	\draw[ ->, thick,black] (0, \ycoinbasgauche) -- (0, \ycoinhautdroit) node[above]{$y$};
	%repere orthonorme
	\coordinate (O) at ({0},{0});
	\draw (O) node[below left] {$O$};
	\draw (O) node {$\bullet$};
	\coordinate (I) at ({1},{0});
	\draw (I) node[below left] {$I$};
	\draw (I) node {$\bullet$};
	\coordinate (J) at ({0},{1});
	\draw (J) node[below left] {$J$};
	\draw (J) node {$\bullet$};
	%Graduations
	\foreach \x in {1, 2} \draw[thick](\x,0.1cm)--(\x,-0.1cm) node[below]{\footnotesize  \pgfmathparse{\x }\pgfmathprintnumber{\pgfmathresult}};
	\foreach \y in {1,2} \draw[thick](0.1cm,\y)--(-0.1cm,\y) node[left]{\footnotesize  \pgfmathparse{\y }\pgfmathprintnumber{\pgfmathresult}};
	%fonction
	\draw[orange, thick][samples=100,domain=-1.2:3.2] plot({\x},{\x*\x*\x-3*\x*\x+2});
	%Points
	\foreach \a/\b in { -1/-2, 0/2, 1/0, 2/-2, 3/2} {\draw [red, thick] ({\a},{\b}) node{$\times$};}
	%Tangentes horizontales
	\def\longueurtangente{0.7};
	\foreach \a/\b in { 0/2, 2/-2}{ \draw[blue, thick][>=latex, <->] ({-\longueurtangente+\a}, {\b}) -- ({\longueurtangente+\a},{\b});}
	%Ligne définie par des points
	\draw[orange, thick] plot[smooth] coordinates {(-1,-1)(1,2)};
	\end{tikzpicture}
	
\end{center}

\subsection{Rectangle en coin.}

\begin{tikzpicture}
	\def\xangledroit{0};
	\def\yangledroit{0};
	\def\longueurangledroit{0.5};
	\draw[fill=green!30,rotate around={{20}:({\xangledroit},{\yangledroit})}] ({\xangledroit},{\yangledroit}) rectangle ({\xangledroit+\longueurangledroit},{\yangledroit+\longueurangledroit});
\end{tikzpicture}

ou bien avec matrice rotation plus translation ici 45 degres et translation de vecteur (1,1).
\begin{tikzpicture}
		\def\code{0.2};
		\draw [cm={cos(-45) ,-sin(-45) ,sin(-45) ,cos(-45) ,(1,1)}]  ({-\code},{0}) -- ({0-\code},{0+\code}) -- (0,{0+\code});
\end{tikzpicture}

\subsection{Pavé droit.}

\begin{center}
	
	\begin{tikzpicture}
	\def\longueur{5};
	\def\hauteur{3};
	\def\profondeur{2};
	\def\angledefuite{30};
	\def\coefficientmultiplicateur{0.8};
	\def\xA{0};
	\def\yA{0};
	%Création des points du bas.
	\coordinate (A) at ({\xA},{\yA});
	\coordinate (B) at ({\xA+\longueur},{\yA});
	\coordinate (C) at ({\xA+\longueur+\profondeur*cos(\angledefuite)},{\yA+\profondeur*sin(\angledefuite)});
	\coordinate (D) at ({\xA+\profondeur*cos(\angledefuite)},{\yA+\profondeur*sin(\angledefuite)});
	%Création des points du haut
	\coordinate (E) at ({\xA},{\yA+\hauteur});
	\coordinate (F) at ({\xA+\longueur},{\yA+\hauteur});
	\coordinate (G) at ({\xA+\longueur+\profondeur*cos(\angledefuite)},{\yA+\profondeur*sin(\angledefuite)+\hauteur});
	\coordinate (H) at ({\xA+\profondeur*cos(\angledefuite)},{\yA+\profondeur*sin(\angledefuite)+\hauteur});
	%Nom des points du bas dans le sens direct
	\draw (A) node [below left] {$A$};
	\draw (B) node [below right] {$B$};
	\draw (C) node [below right] {$C$};
	\draw (D) node [above left] {$D$};
	\draw (E) node [above left] {$E$};
	\draw (F) node [above] {$F$};
	\draw (G) node [above right] {$G$};
	\draw (H) node [above left] {$H$};
	%Les arêtes du bas
	\draw [] (A) -- (B);
	\draw [] (B) -- (C);
	\draw [dashed] (C) -- (D);
	\draw [dashed] (D) -- (A);
	%Les arêtes verticales
	\draw [] (A) -- (E);
	\draw [] (B) -- (F);
	\draw [] (C) -- (G);
	\draw [dashed] (D) -- (H);
	%Les arête du haut
	\draw [] (E) -- (F);
	\draw [] (F) -- (G);
	\draw [] (G) -- (H);
	\draw [] (H) -- (E);
	\end{tikzpicture}
	
\end{center}

\subsection{Dessin.}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (5,-1);
\coordinate (F) at (6,0);
\coordinate (C) at (7,1);
\coordinate (D) at (2,2);
\coordinate (O) at (3.5,0.5);
\coordinate (S) at (3.5,6);
\coordinate (J) at (3.5,3.5);
\coordinate (K) at (3,4.666);
\draw (A) node {$\bullet$};
\draw (B)node {$\bullet$};
\draw (F)node {$\bullet$};
\draw (C)node {$\bullet$};
\draw (D)node {$\bullet$};
\draw (O)node {$\bullet$};
\draw (S)node {$\bullet$};
\draw (J)node {$\bullet$};
\draw (K)node {$\bullet$};
\draw (A)node[below]{$A$};
\draw (B)node[below right]{$B$};
\draw (F)node[right]{$F$};
\draw (C)node[right]{$C$};
\draw (D)node[above right]{$D$};
\draw (O)node[above right]{$O$};
\draw (S)node[above]{$S$};
\draw (J)node[above right]{$J$};
\draw (K)node[below right]{$K$};
\draw[blue, thick](A)--(B)--(C);
\draw[blue, thick,dashed](A)--(D)--(C);
\draw[blue, thick](A)--(S);
\draw[blue, thick](B)--(S);
\draw[blue, thick](C)--(S);
\draw[blue, thick,dashed](D)--(S);
\draw[blue, thick,dashed](O)--(S);
\draw[blue, thick](F)--(S);
\draw[blue, thick,dashed](A)--(C);
\draw[blue, thick,dashed](D)--(B);
\draw[blue, thick,dashed](B)--(J)--(C);
\fill[color=gray , opacity=0.05] (A)--(B)--(C)--(D)--cycle;	
\fill[color=gray , opacity=0.1] (B)--(C)--(S)--cycle;
\fill[color=gray , opacity=0.15] (A)--(D)--(C)--(S)--cycle;
\fill[color=gray , opacity=0.20] (B)--(C)--(J)--cycle;			
\end{tikzpicture}

\subsection{Arbre nouveau 2 niveau.}

\begin{center}
	\begin{tikzpicture}[xscale=1,yscale=1]
	%Écarts entre entre racine et premier niveau
	\def\xA{2};
	%Nombre de nœuds du premiers niveau
	\def\noA{2};
	%Nombre de nœuds du deuxième niveau
	\def\noB{6};
	%Nombre de nœuds par embranchement du deuxième niveau
	\def\noBe{3};
	%Écarts entre nœuds du deuxième niveau
	\def\xB{2+\xA};
	\def\yB{1};
	%Racine
	\coordinate (O) at ({0},{-\yB/2});
	%Pour ne pas écrire les mots above et below
	\def\posA{above};
	\def\posB{below};
	%Position des nœuds du premier niveau
	%Dessin des nœuds branches du premier niveau 
	\foreach \nA/\A/\numero/\contenu/\ponderation/\position in {
		nA1/A1/1/$2^0$/$\np{1}$/\posA,
		nA2/A2/2/$2^1$/$\np{2}$/\posB
	}{
		\coordinate (\A) at ({\xA},{\noB*\yB-(\noBe+1)/2*\yB-\noB*\yB/2-(\numero-1)*\yB*\noBe});
		\draw node (\nA) at (\A) {\contenu};
		\draw (O)--(\nA) node[midway, sloped, \position] {\ponderation};
	};
	%Position des nœuds, dessin des nœuds et des branches du deuxième niveau
	\foreach \nA/\nB/\B/\numero/\contenu/\ponderation/\position in {
		nA1/nB1/B1/1/$3^0$/$\np{1}$/\posA,
		nA1/nB2/B2/2/$3^1$/$\np{2}$/\posB,
		nA1/nB3/B3/3/$3^2$/$\np{1}$/\posA,
		nA2/nB4/B4/4/$3^0$/$\np{2}$/\posB,
		nA2/nB5/B5/5/$3^1$/$\np{1}$/\posA,
		nA2/nB6/B6/6/$3^2$/$\np{2}$/\posB
	}{
		\coordinate (\B) at ({\xB},{(\noB-\numero)*\yB-\noB*\yB/2});
		\draw node (\nB) at (\B) {\contenu};
		\draw (\nA)--(\nB) node[midway, sloped, \position] {\ponderation};
	};
	\end{tikzpicture}
\end{center}

\subsection{Arbre nouveau 3 niveaux.}

\begin{center}
	\begin{tikzpicture}[xscale=1,yscale=1]
	%Écarts entre entre racine et premier niveau
	\def\xA{2};
	%Nombre de nœuds du premiers niveau
	\def\noA{3};
	%Nombre de nœuds du deuxième niveau
	\def\noB{6};
	%Nombre de nœuds par embranchement du deuxième niveau
	\def\noBe{2};
	%Écarts entre nœuds du deuxième niveau
	\def\xB{2+\xA};
	\def\yB{1};
	%Nombre de nœuds du troisième niveau
	\def\noC{12};
	%Nombre de nœuds par embranchement du troisième niveau
	\def\noCe{2};
	%Écarts entre nœuds du troisième niveau
	\def\xC{2+\xB};
	\def\yC{1};
	%Racine
	\coordinate (O) at ({0},{-\yB/2});
	%Pour ne pas écrire les mots above et below
	\def\posA{above};
	\def\posB{below};
	%Position des nœuds du premier niveau
	%Dessin des nœuds branches du premier niveau 
	\foreach \nA/\A/\numero/\contenu/\ponderation/\position in {
		nA1/A1/1/$2^0$/$\np{1}$/\posA,
		nA2/A2/2/$2^1$/$\np{1}$/\posA,
		nA3/A3/3/$2^2$/$\np{1}$/\posB
	}{
		\coordinate (\A) at ({\xA},{\noC*\yC-(\noCe*\noBe+1)/2*\yC-\noC*\yC/2-(\numero-1)*\yC*\noBe*\noCe});
		\draw node (\nA) at (\A) {\contenu};
		\draw (O)--(\nA) node[midway, sloped, \position] {\ponderation};
	};
	%Position des nœuds, dessin des nœuds et des branches du deuxième niveau
	\foreach \nA/\nB/\B/\numero/\contenu/\ponderation/\position in {
		nA1/nB1/B1/1/$3^0$/$\np{1}$/\posA,
		nA1/nB2/B2/2/$3^1$/$\np{1}$/\posB,
		nA2/nB3/B3/3/$3^0$/$\np{1}$/\posA,
		nA2/nB4/B4/4/$3^1$/$\np{1}$/\posB,
		nA3/nB5/B5/5/$3^0$/$\np{1}$/\posA,
		nA3/nB6/B6/6/$3^1$/$\np{1}$/\posB
	}{
		\coordinate (\B) at ({\xB},{\noC*\yC-(\noCe+1)/2*\yC-\noC*\yC/2-(\numero-1)*\yC*\noCe});
		\draw node (\nB) at (\B) {\contenu};
		\draw (\nA)--(\nB) node[midway, sloped, \position] {\ponderation};
	};
	
	%Position des nœuds, dessin des nœuds et des branches du troisième niveau
	\foreach \nB/\nC/\C/\numero/\contenu/\ponderation/\position in {
		nB1/nC1/C1/1/$5^0$/$\np{1}$/\posA,
		nB1/nC2/C2/2/$5^0$/$\np{1}$/\posA,
		nB2/nC3/C3/3/$5^1$/$\np{1}$/\posA,
		nB2/nC4/C4/4/$5^1$/$\np{1}$/\posA,
		nB3/nC5/C5/5/$5^0$/$\np{1}$/\posA,
		nB3/nC6/C6/6/$5^0$/$\np{1}$/\posA,
		nB4/nC7/C7/7/$5^1$/$\np{1}$/\posA,
		nB4/nC8/C8/8/$5^1$/$\np{1}$/\posA,
		nB5/nC9/C9/9/$5^0$/$\np{1}$/\posA,
		nB5/nC10/C10/10/$5^0$/$\np{1}$/\posA,
		nB6/nC11/C11/11/$5^1$/$\np{1}$/\posA,
		nB6/nC12/C12/12/$5^1$/$\np{1}$/\posA
	}{
		\coordinate (\C) at ({\xC},{(\noC-\numero)*\yC-\noC*\yC/2});
		\draw node (\nC) at (\C) {\contenu};
		\draw (\nB)--(\nC) node[midway, sloped, \position] {\ponderation};
	};
	\end{tikzpicture}
\end{center}

\subsection{Arbre.}

\begin{center}
	\begin{tikzpicture}[xscale=1,yscale=1]
	\coordinate (A1) at (4,3);
	\coordinate (A2) at (4,1);
	\coordinate (A3) at (4,-1);
	\coordinate (A4) at (4,-3);
	\coordinate (B1) at (2,2);
	\coordinate (B2) at (2,-2);
	\coordinate (C1) at (0,0);
	\draw node (A11) at (A1) {$1$};	
	\draw node (A12) at (A2) {$2$};
	\draw node (A13) at (A3) {$3$};
	\draw node (A14) at (A4) {$4$};
	\draw node (B11) at (B1) {$1$};
	\draw node (B12) at (B2) {$2$};
	\draw (B11)--(A11)node[midway,sloped,above]{\color{blue}$0,5$};
	\draw (B11)--(A12)node[midway,sloped,below]{\color{blue}$0,5$};
	\draw (B12)--(A13)node[midway,sloped,above]{\color{blue}$0,25$};
	\draw (B12)--(A14)node[midway,sloped,below]{\color{blue}$0,25$};
	\draw (C1)--(B11)node[midway,sloped,above]{\color{blue}$\frac{3}{8}$};
	\draw (C1)--(B12)node[midway,sloped,below]{\color{blue}$\frac{5}{8}$};
	\end{tikzpicture}
\end{center}

\subsection{Arbre bis.}

\begin{center}
	
	\begin{tikzpicture}[scale=0.5]
	%Création des nœuds
	\foreach \A/\ord/\n in {A1/7/1, A2/5/7, A3/3/1, A4/1/7, A5/-1/1, A6/-3/7, A7/-5/1, A8/-7/7} \node (\A) at (8,\ord){\n};
	\foreach \B/\ord/\n in {B1/6/1, B2/2/3, B3/-2/1, B4/-6/3} \node (\B) at (4,\ord) {\n};
	\foreach \C/\ord/\n in {C1/4/1, C2/-4/2} \node (\C) at (0,\ord) {\n};
	\foreach \D/\ord/\n in {D1/7/1, D2/5/7, D3/3/3, D4/1/21, D5/-1/2, D6/-3/14, D7/-5/6, D8/-7/42} \node (\D) at (12,\ord){\n};
	%Branches entre les nœuds
	\foreach \B/\A in {B1/A1, B1/A2, B2/A3, B2/A4, B3/A5, B3/A6, B4/A7, B4/A8} \draw (\B) -- (\A);
	\foreach \C/\B in {C1/B1, C1/B2, C2/B3, C2/B4} \draw (\C) -- (\B);
	\foreach \C in {C1, C2} \draw (-4,0) -- (\C);
	\end{tikzpicture}
	
\end{center}

\subsection{Tab}

\begin{center}
	\begin{tikzpicture}
	\tkzTabInit[lgt=1.6 , espcl=1.6, deltacl=0.5]{$x$ /0.8, $f'$ /0.8, $f$ /1.6}
	{$-\infty$ ,$1$, $+\infty$}
	\tkzTabLine{,+,d,+,}%
	\tkzTabVar {+/ $\mathrm{e}$, -D+ / $0$ / $+\infty$, - / $\mathrm{e}$ / }
	\end{tikzpicture}
\end{center}

\subsection{Tab2.}

\begin{tikzpicture}
\tkzTabInit[lgt=1 , espcl=1.6]{$x$ /0.8, $C_M'$ /0.8, $C_M$ /2.4}
{$-\infty$ ,$-10$, $0$, $5$, $10$, $40$,  $+\infty$}
\tkzTabLine{,+,z,-,d,-,t,-,z,+,t,+,}%
\tkzTabVar {-/$-\infty$, +/$30$,-D+/$-\infty$ /$+\infty$,R/ /,-/$70$, R/ /, +/$+\infty$ }
\tkzTabVal[draw]{3}{5}{0.5}{}{$75$}
\tkzTabVal[draw]{5}{7}{0.5}{}{$\np{92,5}$}
\draw[fill=Red!80,opacity=0.2](M30) rectangle (M63);
\end{tikzpicture}

\subsection{Python}

\begin{center}
	\begin{minipage}{5cm}
		\lstset{emph={fonction}, emphstyle=\color{red},
			emph={[2]variable1,variable2}, emphstyle={[2]\color{orange}}}
		\begin{lstlisting}{style=pythonstyle}
		def fonction(variable1):
		variable2=3
		\end{lstlisting}
	\end{minipage}
\end{center}

\subsection{Bash}

%\begin{minipage}{5cm}
\begin{lstlisting}{style=bashstyle}
sudo apt update
sudo apt upgrade
\end{lstlisting}
\hfill {\tiny \href{http://unemainlavelautre.net/fichier.txt}{Pour copier-coller: clic droit, ouvrir dans une nouvelle fenêtre.}}
%\end{minipage}

\subsection{Pseudocode}

\begin{tabular}{|c|}
	\hline
	\begin{minipage}{8cm}
		\LinesNumbered
		\SetKw{entrer}{entrer}
		\SetKw{prend}{prend la valeur}
		\SetKw{afficher}{afficher}
		\begin{algorithm}[H]
			\SetAlgoLined
			\DontPrintSemicolon
			\entrer pi
			0\;
			\Tq{1}{
				2\;
				\eSi{3}{
					4\;
					5\;
				}{
					6\;
				}
			}
			
			\Pour{7}{
				\Si{8}{
					9\;
				}
			}
		\end{algorithm}
	\end{minipage}
	\\
	\hline
\end{tabular}

\subsection{Tabularx}

Pour center dans une seule cellule \hfill avant et après le texte suffisent

\noindent
\begin{tabularx}{\linewidth}{|m{2.5cm}|*{6}{>{\centering\arraybackslash}X|}}
	\hline
	Nombre affiché sur la face & 1 & 2 & 3 & 4 & 5 & 6
	\\
	\hline
\end{tabularx}

\subsection{Tableau sans une case et diagonale.}


\begin{tabular}{|*{7}{c|}}
	\cline{2-7} \multicolumn{1}{c|}{}& Moyenne & Minimum & Quartile 1 & Médiane &	Quartile 3 & Maximum
	\\
	\hline
	Série $T$ &	\backslashbox{$v_n$}{$u_n$}&	67&	70&	72&	74& 78
	\\
	\hline
	Série $P$ &&&&&& 
	\\
	\hline
\end{tabular}

\subsection{Tableau ligne colonne.}

\begin{tabular}{|*{11}{c|}}
	\hline
	\multirow{2}*{Fournisseur} & \multicolumn{8}{c|}{Critères} & \multirow{2}*{Note globale} & \multirow{2}*{Classement}
	\\
	\cline{2-9}
	& Sécurité &&&&&&&&&
	\\
	\hline
	&  &&&&&&&&&
	\\
	\hline
\end{tabular}\\

\subsection{Retrait dans la marge.}

\hspace*{-1cm}

\subsection{Note dans la marge}

\marginpar{\color{red}$\heartsuit$}

\subsection{Notation modulo.}

$3 \equiv 1 \mod{2}$

\subsection{Diapositive.}

%Pour afficher la page en paysage il faut modifier
%\usepackage[a5paper,landscape]{article} %ACTIVER POUR A5
%\geometry{hscale=0.9,vscale=0.9,centering} %ACTIVER POUR A5

\pagecolor{cyan!25}

\begin{center}
	
	\begin{tikzpicture}
	\coordinate (AA) at (-9,6.5);
	\node (AA) at (AA) {};
	\coordinate (BB) at (9,6.5);
	\node (BB) at (BB) {};
	\coordinate (CC) at (9,-6.5);
	\node (CC) at (CC) {};
	\coordinate (DD) at (-9,-6.5);
	\node (DD) at (DD) {};
	\draw (AA)--(BB)--(CC)--(DD)--(AA);
	\end{tikzpicture}
	
\end{center}

\subsection{Binomiale.}

\begin{enumerate}[*]
	\item Épreuve de Bernoulli.
	
	\begin{enumerate}[$\bullet$]
		\item Expérience: lancer un dé.
		\item Succès: \og Obtenir $6$ \fg{}.
		\item Probabilité de succès: $p=\frac{1}{6}$.
	\end{enumerate}
	
	\item Schéma de Bernoulli.
	
	L'épreuve de Bernoulli précédemment décrite est répétée à l'identique et de façon indépendante $n=3$ fois.
	
	\item Loi binomiale.
	
	$X$ compte le nombre de $6$ parmi les $3$ lancés, donc compte le nombre de succès donc: $X \hookrightarrow \mathscr{B}\left( 3, \frac{1}{6} \right)$.
	
\end{enumerate}

\subsection{Engrenages.}
\newcommand{\roue}[4]{% #1 = rayon, #2 = nombre de dents, #3 = X centre, #4 = Y centre
\foreach \i in {1,2,...,#2}
{
\pgfmathparse{360*(\i-1)/#2}\let\angle\pgfmathresult

\begin{scope}[shift={(#3,#4)}]
\pgfmathparse{#1*cos(90+360/(#2*4))}\let\Ax\pgfmathresult 
\pgfmathparse{#1*sin(90+360/(#2*4))}\let\Ay\pgfmathresult

\pgfmathparse{#1*cos(90-360/(#2*4))}\let\Bx\pgfmathresult
\pgfmathparse{#1*sin(90-360/(#2*4))}\let\By\pgfmathresult

\pgfmathparse{4*#1*cos(90+360/(#2*8))/3}\let\Cx\pgfmathresult
\pgfmathparse{4*#1*sin(90+360/(#2*8))/3}\let\Cy\pgfmathresult

\pgfmathparse{4*#1*cos(90-360/(#2*8))/3}\let\Dx\pgfmathresult
\pgfmathparse{4*#1*sin(90-360/(#2*8))/3}\let\Dy\pgfmathresult

\pgfmathparse{90-360/(#2*4)}\let\a\pgfmathresult
\pgfmathparse{90-1.5*360/(#2*2)}\let\b\pgfmathresult

\draw[rotate=\angle] (\Ax,\Ay) to[bend left=15] (\Cx,\Cy) -- (\Dx,\Dy) to[bend left=15] (\Bx,\By) arc (\a:\b:#1cm); 
\end{scope}
}
}

\begin{tikzpicture}
\roue{3}{20}{0}{0}
\roue{3}{16}{7.4}{2}
\end{tikzpicture}