%!TEX encoding = UTF-8 Unicode

%{{{ Les packages: 
\usepackage{amssymb}
\usepackage{amsmath}
% pour la matrice augmentée:
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother
\usepackage{amsthm}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern, cancel, gensymb, stmaryrd, appendix}
\usepackage{eurosym, bbold, mathrsfs}
\usepackage[np]{numprint}
\usepackage{lscape, multicol}
\usepackage{url, fancyhdr, alphalph}
\usepackage{hyperref}
\usepackage{tabularx, enumerate, enumitem, listings, cases}
\usepackage{algorithmicx, setspace}
%}}}

%{{{ Tikz 
\usepackage{color, framed}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{pgf,tikz, tkz-tab}
\usetikzlibrary{arrows, calc, patterns, shapes}
\usepackage[all]{xy}
\input xy
\xyoption{all}
\tikzstyle{general}=[line width=0.3mm, >=stealth, x=1cm, y=1cm,line cap=round, line join=round]
\tikzstyle{epais}=[line width=0.5mm, line cap=butt]
\tikzstyle{tres epais}=[line width=0.8mm, line cap=butt]
\tikzstyle{axe}=[line width=0.3mm, ->, color=Noir, line cap=rect]
\newcommand{\axeX}[4][0]{\draw[axe] (#2,#1)--(#3,#1); \foreach \x in {#4} {\draw (\x,#1) node {\small $+$}; \draw (\x,#1) node[below] {\small $\x$};}}
\newcommand{\axeY}[4][0]{\draw[axe] (#1,#2)--(#1,#3); \foreach \y in {#4} {\draw (#1, \y) node {\small $+$}; \draw (#1, \y) node[left] {\small $\y$};}}
\newcommand{\axeOI}[3][0]{\draw[axe] (#2,#1)--(#3,#1);  \draw (1,#1) node {\small $+$}; \draw (1,#1) node[below] {\small $I$};}
\newcommand{\axeOJ}[3][0]{\draw[axe] (#1,#2)--(#1,#3); \draw (#1, 1) node {\small $+$}; \draw (#1, 1) node[left] {\small $J$};}
\newcommand{\axeXgraduation}[2][0]{\foreach \x in {#2} {\draw (\x,#1) node {\small $+$};}}
\newcommand{\axeYgraduation}[2][0]{\foreach \y in {#2} {\draw (#1, \y) node {\small $+$}; }}
\newcommand{\origine}{\draw (0,0) node[below left] {\small $0$};}
\newcommand{\origineO}{\draw (0,0) node[below left] {$O$};}

\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}

\newcommand{\croix}{++(-2pt,2pt) -- ++ (4pt,-4pt) ++(-4pt,0) -- ++(4pt,4pt) ++(-2pt,-2pt)}
\newcommand{\gradx}[1]{\foreach \x in {#1} \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$}}
\newcommand{\grady}[1]{\foreach \y in {#1} \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$}}
\newcommand{\gradxsans}[1]{\foreach \x in {#1} \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt)}
\newcommand{\gradysans}[1]{\foreach \y in {#1} \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt)}
%}}}

%{{{ Quelques caractères spéciaux et commandes:
\newcommand{\K}{\mathbb{K}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\U}{\mathbb{U}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\p}{\mathbb{P}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\V}{\mathbb{V}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\M}{\mathcal{M}}
\renewcommand{\S}{\mathscr{S}}
\newcommand{\GL}{\operatorname{GL}}
\newcommand{\sln}{{\mathfrak sl}}
\newcommand{\mf}[1]{\mathfrak{#1}}
\newcommand{\dfy}{\frac{\partial f}{\partial y}}
\newcommand{\id}{\operatorname{Id}}
\newcommand{\Id}{\operatorname{Id}}
\newcommand{\im}{\operatorname{Im}}
\newcommand{\rg}{\operatorname{rg}}
\renewcommand{\d}{\operatorname{d}\!}
\newcommand{\dx}{\operatorname{d}\!x}
\newcommand{\dt}{\operatorname{d}\!t}
\newcommand{\<}{\langle}
\newcommand{\xsymb}{\mathrm{x}}
\renewcommand{\>}{\rangle}
\newcommand{\Mat}{\operatorname{Mat}}
\newcommand{\End}{\operatorname{End}}
\newcommand{\B}{\mathcal B}
\newcommand{\base}[1]{\mathcal #1}
\newcommand{\vect}{\overrightarrow} 
\newcommand{\Vect}{\operatorname{Vect}} 
\newcommand{\tr}{\operatorname{tr}}
\newcommand{\card}{\operatorname{card}}
\newcommand{\vecti}{\overrightarrow \imath}
\newcommand{\vectj}{\overrightarrow \jmath}
\newcommand{\vectk}{\overrightarrow k}
\newcommand{\m}{\,\operatorname{m}}
\newcommand{\cm}{\,\operatorname{cm}}
\newcommand{\km}{\,\operatorname{km}}
\newcommand{\kg}{\,\operatorname{kg}}
\newcommand{\limite}{\underset{n \to +\infty}{\lim}}
\newcommand{\limitea}[1]{\underset{#1}{\lim}\;}
\newcommand{\entiersup}[1]{\llbracket #1;~+\infty[}
\newcommand{\modulo}{\;\operatorname{modulo}\;}
\newcommand{\Oij}{$(O;\,\vect i;\,\vect j)$}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\loinormale}{$\mathcal N(\mu;\,\sigma^2)$\;}
\newcommand{\ET}{\,\operatorname{ET}\,}
\newcommand{\OU}{\,\operatorname{OU}\,}
\newcommand{\NON}{\,\operatorname{NON}\,}
\newcommand{\si}{\operatorname{si}}
\newcommand{\alors}{\operatorname{alors}}
\renewcommand{\i}{\boldsymbol{i}}
\renewcommand{\j}{\boldsymbol{j}}
\renewcommand{\k}{\boldsymbol{k}}
\newcommand{\partieentiere}[1]{\lfloor #1 \rfloor}

\newcommand{\Quotient}[2]{\ensuremath{#1/\!\raisebox{-.65ex}{\ensuremath{#2}} }}

\newcommand{\mequiv}{\underset{L}{\sim}}

% rcases:
\newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}

\newcommand{\etoile}{\hspace{-1.5ex} $\star$\;}

%}}}

%{{{ Couleurs: 
\definecolor{orange}{rgb}{1,0.5,0}
\definecolor{rouge}{rgb}{0.9,0.1,0}
\definecolor{rouge1}{rgb}{0.8,0.0,0}
\definecolor{rouge2}{rgb}{0.65,0.16,0.16}
\definecolor{violet}{rgb}{0.4,0,0.8}
\definecolor{bleu}{rgb}{0,0.2,0.8}
\definecolor{bleu2}{rgb}{0,0.28,0.67}
\definecolor{vert}{rgb}{0,0.8,0.1}
\definecolor{vert2}{rgb}{0.13,0.440.13}
\definecolor{gris}{rgb}{0.55,0.55,0.55}
\definecolor{jaune}{rgb}{0.6,0.6,0}
\definecolor{vybtff}{rgb}{0.35,0.7,1}
\definecolor{ffvvta}{rgb}{1,0.33,0.23}
\definecolor{uuuuuu}{rgb}{0.27,0.27,0.27}
\definecolor{dqfqcq}{rgb}{0.82,0.94,0.75}
\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{A1}{rgb}{0,0,0.7}
\definecolor{B1}{rgb}{0.5,0,0}
\definecolor{C1}{rgb}{0.8,0.2,0}
\definecolor{D4}{rgb}{0.8,0.2,0}
\definecolor{F1}{rgb}{0.9,0,0}
\definecolor{G1}{rgb}{0.7,.7,.7}
\definecolor{H1}{rgb}{0.8,.8,.8}
\definecolor{J4}{rgb}{0.9,0.9,0}
\definecolor{J1}{rgb}{0.9,0.9,0}

%}}}

%{{{ Mise en page des résultats: 

\newmdenv[innerlinewidth=0.5pt, roundcorner=8pt,linecolor=bleu2,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=2pt,innerbottommargin=4pt, backgroundcolor=shadecolor!20]{mybox}
\newmdenv[innerlinewidth=0.5pt, roundcorner=8pt,linecolor=bleu2,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=2pt,innerbottommargin=4pt, backgroundcolor=shadecolor!50]{mybox2}
\newmdenv[innerlinewidth=0.25pt, roundcorner=8pt,linecolor=bleu2,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=2pt,innerbottommargin=4pt]{cadre}

\newmdenv[innerlinewidth=0.25pt, roundcorner=8pt,linecolor=rouge2,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=2pt,innerbottommargin=4pt]{cadrerouge}

\renewcommand{\thempfootnote}{\arabic{mpfootnote}}

\newmdenv[innerlinewidth=0.5pt, roundcorner=8pt,linecolor=gray!5,innerleftmargin=25pt,
innerrightmargin=25pt,innertopmargin=5pt,innerbottommargin=5pt, backgroundcolor=gray!10]{python}


\newtheoremstyle{monexo} 	% name
    {\topsep}                   % Space above
    {1em}                    	% Space below
    {}                   	% Body font
    {}                           % Indent amount
    {\bfseries \color{bleu2}}     % Theorem head font
    {.}                          % Punctuation after theorem head
    {.5em}                       % Space after theorem head
    {}  			 % Theorem head spec (can be left empty, meaning ‘normal’)
%\newtheoremstyle{monexo}{\topsep}{2em}{}{}{\bfseries \color{rouge}}{.}{.5em}{}
\theoremstyle{monexo}
\newtheorem{exo}{Exercice}
\newtheorem*{exo*}{Exercice}
\newtheorem{probleme}{Problème}
\newtheorem*{probleme*}{Problème}


\newtheoremstyle{moncorrige} 	% name
    {\topsep}                   % Space above
    {2em}                    	% Space below
    {}                   	% Body font
    {}                           % Indent amount
    {\bfseries \color{bleu2}}     % Theorem head font
    {}                          % Punctuation after theorem head
    {.5em}                       % Space after theorem head
    {}  			 % Theorem head spec (can be left empty, meaning ‘normal’)
%\newtheoremstyle{monexo}{\topsep}{2em}{}{}{\bfseries \color{rouge}}{.}{.5em}{}
\theoremstyle{moncorrige}
\newtheorem*{corrige}{Corrigé de l'exercice}
\newcommand{\refexo}[1]{{\! \bf \color{bleu2} \ref{#1} }}

\newtheoremstyle{definition} 	% name
    {\topsep}                   % Space above
    {2em}                    	% Space below
    {}                   	% Body font
    {}                           % Indent amount
    {\bfseries \color{vert2}}     % Theorem head font
    {.}                          % Punctuation after theorem head
    {.5em}                       % Space after theorem head
    {}  			 % Theorem head spec (can be left empty, meaning ‘normal’)
\theoremstyle{definition}
	\newtheorem{defi}{Définition}[section]
	\newtheorem*{defi*}{Définition}
	\newtheorem{thm-defi}[defi]{Théorème-définition}
	\newtheorem{prop-defi}[defi]{Proposition-Définition}
	\newtheorem{thm}[defi]{Théorème}
	\newtheorem*{thm*}{Théorème}
	\newtheorem{proposition}[defi]{Proposition}
	\newtheorem*{proposition*}{Proposition}

	\newtheorem{propriété}[defi]{Propriété}
	\newtheorem{propriétés}[defi]{Propriétés}
	\newtheorem{propriété-définition}[defi]{Propriété-Définition}
	\newtheorem{lm}[defi]{Lemme}
    \newtheorem*{lm*}{Lemme}
	\newtheorem{corollaire}[defi]{Corollaire}
    \newtheorem*{corollaire*}{Corollaire}
	\newtheorem*{notationbf}{Notation}
	\newtheorem*{notation}{Notation}
	\newtheorem*{notations}{Notations}
	\newtheorem*{vocabulaire}{Vocabulaire}
	\newtheorem*{methode}{Méthode}
	

\newtheoremstyle{rmq} 	% name
    {\topsep}                   % Space above
    {2em}                    	% Space below
    {}                   	% Body font
    {}                           % Indent amount
    {\it \color{bleu2}}     % Theorem head font
    {.}                          % Punctuation after theorem head
    {.5em}                       % Space after theorem head
    {}  			 % Theorem head spec (can be left empty, meaning ‘normal’)

\theoremstyle{rmq}
	\newtheorem*{exemple}{Exemple}
	\newtheorem*{exemples}{Exemples}
	\newtheorem*{rmq}{Remarque}
	\newtheorem*{rmqs}{Remarques}
	\newtheorem*{preuve}{preuve}
	\newtheorem*{rappels}{Rappels}
	\newtheorem*{rappel}{Rappel}
	\newtheorem*{objectifs}{Objectifs}
	\newtheorem*{objectif}{Objectif}
	\newtheorem*{algorithme}{Algorithme}
	\newtheorem*{enoncé}{\'Enoncé}
	\newtheorem*{digression}{Digression}
    \newtheorem*{convention}{Convention}
%}}}

%{{{ Quelques ajustements: 
\renewcommand\labelitemi{$\bullet$} 
\renewcommand{\labelenumi}{\arabic{enumi})}
\renewcommand{\labelenumii}{\alph{enumii})}  % arabic, alph 

% tabular: 
\renewcommand{\arraystretch}{1}

\setlength\parindent{0pt}
\newcommand{\e}{\,\euro\,}

%\setlength{\oddsidemargin}{0cm}
%\setlength{\evensidemargin}{0cm}
%\setlength{\marginparwidth}{0cm}
%\setlength{\marginparsep}{0cm}
\setlength{\parskip}{.1cm}
\setlength{\topskip}{0cm}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
% multicols
\setlength{\columnsep}{9mm}
%}}}

%{{{ Algorithme:
\newcommand{\algorithmicrequire}{\textbf{Require:}}
\newcommand{\algorithmicensure}{\textbf{Ensure:}}
%\newcommand{\algorithmiccomment}[1]{\{#1\}}
\renewcommand{\algorithmiccomment}[1]{{\hfill$\triangleright\;$\footnotesize\ttfamily\textcolor{vert2}{#1}}}
\newcommand{\algorithmicend}{\textbf{Fin}}
\newcommand{\algorithmicif}{\textbf{Si}}
\newcommand{\algorithmicthen}{\textbf{alors}}
\newcommand{\algorithmicelse}{\textbf{Sinon}}
\newcommand{\algorithmicelsif}{\algorithmicelse\ \algorithmicif}
\newcommand{\algorithmicendif}{\algorithmicend\ \algorithmicif}
\newcommand{\algorithmicfor}{\textbf{Pour}}
\newcommand{\algorithmicforall}{\textbf{Pour tout}}
\newcommand{\algorithmicdo}{\textbf{faire}}
\newcommand{\algorithmicendfor}{\algorithmicend\ \algorithmicfor}
\newcommand{\algorithmicwhile}{\textbf{Tant que}}
% PACKAGES NECESSAIRES POUR ALGO
\usepackage{algorithm}
\makeatletter
\renewcommand{\ALG@name}{Algorithme}
\makeatother
\usepackage{algpseudocode}

% Caractère spéciaux calculatrice:

\newcommand{\casio}{\begin{tikzpicture}[x=4pt, y=4pt] \draw[fill=black!70] (0,0) -- (1,0) -- (1,1) -- (0,0); \end{tikzpicture}}


% Mise en forme du language Python:
\definecolor{mygreen}{rgb}{0,0.6,0}
\usepackage{listingsutf8}
\lstset{
	language=Python,
	breaklines=true, 
	basicstyle=\ttfamily, 
	basicstyle=\small, 
	keywordstyle=\color{blue}, 
	commentstyle=\color{mygreen}, 
	stringstyle=\color{red}, 
	identifierstyle=\ttfamily, 
	showstringspaces=false, 
	tabsize=2, 
	frame=lrbt, 
	inputencoding=utf8, 
	numbers=left,
	numberstyle=\tiny\color{gray},
	literate={é}{{\'e}}1 {è}{{\`e}}1 {à}{{\`a}}1 {ù}{{\`u}}1 {ç}{{\c{c} }}1 {î}{{\^i}}1 {ê}{{\^e}}1 {ô}{{\^o}}1 {û}{{\^u}}1 {â}{{\^a}}1 {É}{{\'E}}1
}
%}}}

%{{{ Mise en page des cours, td et contrôles: 
\usepackage{marginnote}
\reversemarginpar
\newcommand{\bareme}[1]{\marginnote{\scriptsize \tt #1\,pt}}

\newcommand{\reponse}[1]{\underline{\hspace{#1ex} }}
\newcommand{\red}{\color{rouge2}}
\newcommand{\carre}{$\square$}

\newcommand{\titre}[2]{
\vspace{1em}
\begin{center} 
\underline{\sc #1}  \\
\medskip
{\it #2}
\end{center}
\vspace{1em}
\setcounter{exo}{0}
}

\newcommand{\td}[2]{
\newpage
\vspace{1em}
\begin{center} 
\underline{\sc #1}  \\
\medskip
{\it #2} 
\end{center}
\vspace{1em}
\setcounter{exo}{0}
\setcounter{probleme}{0}
}

\newcommand{\devoir}[3]{
\newpage
\vspace{1em}
\begin{center} 
\underline{\sc #1}  \\
\medskip
{\it #2} 

{\it #3}
\end{center}
\vspace{1em}
\setcounter{exo}{0}
\setcounter{probleme}{0}
}

\newcommand{\correction}[1]{
\newpage
\vspace{2em}
\begin{center} 
\underline{\sc #1}  \\
\medskip
{\it corrigé}
\end{center}
\vspace{2em}
\setcounter{exo}{0}
}

\newcommand{\bbox}[1]{%
    \colorlet{currentcolor}{.}%
    {\color{bleu2}%
    \fbox{\color{currentcolor}#1}}%
}

\makeatletter
\newcommand{\bboxed}[1]{\textcolor{bleu2}{%
  \fbox{\normalcolor\m@th$\displaystyle#1$} }}
\makeatother

\newcommand{\attention}{\begin{tikzpicture}[x=2.5ex, y=2.5ex] \begin{scriptsize}
\draw[color=rouge2, thick] (0,0) -- (1,0) -- (60:1) -- cycle;
\draw[color=rouge2, thick] (.5,0) -- (.5,-1pt);
\draw (.5,4pt) node{$!$}; 
\end{scriptsize} \end{tikzpicture}\,}
\newcommand{\coeur}{\hspace{-9em}$\heartsuit$\hspace{8em}}
%}}}

%{{{ Version prof ou élève...

\usepackage[normalem]{ulem}
\newcommand\phantomdash[1]{{\color{gris!85}\uline{\phantom{#1}} }}

\version
% Version élève:
\newcommand{\comment}[1]{}
\newcommand{\hidered}[1]{\quad\phantomdash{#1}\quad\;}
%\newcommand{\hide}[1]{\phantom{#1}}
\newcommand{\hide}[1]{\phantomdash{#1}}
\newcommand{\veleve}[1]{#1}
\newcommand{\vprof}[1]{}
\newcommand{\espace}[1]{\veleve{\begin{cadrerouge} 
\foreach \x in {0,1,...,#1}{

\phantom{blop}

}
\end{cadrerouge}}}
\else
% Version prof:
\newcommand{\comment}[1]{{\color{vert2} \it #1}}
\newcommand{\hidered}[1]{{\color{rouge2} \it #1}}
\newcommand{\hide}[1]{#1}
\newcommand{\veleve}[1]{}
\newcommand{\vprof}[1]{#1}
\newcommand{\espace}[1]{\textcolor{bleu2}{\it (\attention Démonstration au programme)}}
\fi
%}}}

\newcommand{\indication}[1]{{\color{bleu2} {\bf Indication:} \it #1}}

\newcommand{\annee}{2023/2024}
