% magnolia-maths.tex
% Mathématiques
%
% Copyright François Fayard
% Protégé par la GNU GPL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                               Disposition                                   %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\let\dsp=\displaystyle
\let\tst=\textstyle
\let\spt=\scriptstyle

%% Quelques lettres grecques et autres caracteres plus jolis que la version
%% originale grace a AMS-LaTeX
\newcommand{\oldepsilon}{\epsilon}
\renewcommand{\epsilon}{\varepsilon}
\renewcommand{\emptyset}{\varnothing}
\renewcommand{\phi}{\varphi}
\renewcommand{\leq}{\leqslant}
\renewcommand{\geq}{\geqslant}
\newcommand{\upp}{\uparrow}
\newcommand{\downn}{\downarrow}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                     Logique, ensembles, dénombrement                        %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Logique
\newcommand{\et}{\quad \text{et} \quad}
\newcommand{\ou}{\quad \text{ou} \quad}
\newcommand{\non}{{\rm non}}
\newcommand{\implique}{\Rightarrow}
\newcommand{\ssi}{\Longleftrightarrow}
\newcommand{\donc}{\text{donc}}

%% Ensembles, opérations, applications, familles
\newcommand{\p}[1]{\left(#1\right)}
\newcommand{\cro}[1]{\left[#1\right]}
\newcommand{\ens}[1]{\left\{#1\right\}}
\newcommand{\enstq}[2]{\left\{#1 : #2\right\}}
\newcommand{\parties}[1]{\mathcal{P}\p{#1}}
\newcommand{\appli}[5]{#1 : #2 \rightarrow #3, #4 \mapsto #5}
\newcommand{\dspappli}[5]{#1 : 
\vtop{ \halign{ ##        &             ##        & ##                 \cr
   \hfil $\dsp{#2}$ \hfil &   $\longrightarrow$   &$\dsp{#3}$ \hfil    \cr
   \hfil $\dsp{#4}$ \hfil & $\longmapsto$         &\hfil$\dsp{#5}$\hfil\cr$}}}
\newcommand{\restri}[2]{#1|_{#2}}
\newcommand{\uple}[3]{\ensuremath{#1_{#2},\ldots,#1_{#3}}}
\newcommand{\nuple}[1]{\uple{#1}{1}{n}}

%% Dénombrement
\DeclareMathOperator{\card}{Card}

%% Pour écrire des récurrences
\newenvironment{recurrence}
{%
  \begin{center}%
    $\mathcal{H}_n$~:\ \flqq
    \begin{varwidth}[t]{0.7\linewidth}
}{\end{itemize}}
\newcommand{\recinit}{\end{varwidth} \frqq\end{center}
  \begin{itemize}\item $\mathcal{H}_0$ est vraie ~: }
\newcommand{\rechere}{\item $\mathcal{H}_n \implique \mathcal{H}_{n+1}$~: }

%% Ensembles de nombres
\newcommand{\N}{\mathbb{N}}
\newcommand{\Ns}{\N^*}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Zs}{\Z^*}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Qs}{\Q^*}
\newcommand{\QP}{\Q_+}
\newcommand{\QPs}{\Q_+^*}
\newcommand{\QM}{\Q_-}
\newcommand{\QMs}{\Q_-^*}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Rbar}{\overline{\R}}
\newcommand{\Rs}{\R^*}
\newcommand{\RP}{\R_+}
\newcommand{\RPs}{\R_+^*}
\newcommand{\RM}{\R_-}
\newcommand{\RMs}{\R_-^*}
% \newcommand{\C}{\mathbb{C}}
\newcommand{\Cs}{\C^*}
\newcommand{\RouC}{\text{$\R$ (ou $\C$)}}
%\newcommand{\U}[1][!*!,!]
%  {\mathbb{U}\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}}
\newcommand{\Ha}{\mathbb{H}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                  Algèbre                                    %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Entiers
\newcommand{\intere}[2]{\left\llbracket #1,#2\right\rrbracket}
\newcommand{\kro}[2]{\delta_{#1,#2}}
\DeclareMathOperator{\pgcd}{pgcd}
\DeclareMathOperator{\ppcm}{ppcm}
\newcommand{\ent}[1]{E\p{#1}}

%% Arithmétique
\newcommand{\egmodulo}[2]{\equiv #1\,\cro{#2}}
\newcommand{\modulo}[1]{\,\cro{#1}}

%% Somme sur un indice
\newcommand{\som}[1]{\substack{\sum \\ #1}}

%% Systèmes linéaires
\def\syslin#1{\left\{
    \vcenter{\ialign{&$\hfil{}##{}$\crcr
                     #1\crcr}}
    \right.}

%% Nombres complexes
\newcommand{\abs}[1]{\left|#1\right|}
\renewcommand{\Re}[1]{\mathop{\rm Re}#1}
\renewcommand{\Im}[1]{\mathop{\rm Im}#1}
\newcommand{\conj}[1]{\overline{#1}}
\newcommand{\sgn}{\mathop{\rm sgn}}

%% Structures
\newcommand{\K}{\ensuremath{\mathbb{K}}}
\newcommand{\KL}{\ensuremath{\mathbb{L}}}
\newcommand{\Ks}{\ensuremath{\mathbb{K}^*}}
\newcommand{\zz}[1]{\ensuremath{\Z/{#1}\Z}}% Ensemble $Z/kZ$
\newcommand{\znz}{\ensuremath{\Z/n\Z}}% Abreviation pour $Z/nZ$
\newcommand{\gsym}[1]{\mathcal{S}_{#1}}
\newcommand{\galt}[1]{\mathcal{A}_{#1}}
\newcommand{\signat}[1]{\oldepsilon\p{#1}}

%% Polynômes, fractions rationnelles
\newcommand{\polyK}[1][!*!,!]{\K\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}[X]}
\newcommand{\polyZ}[1][!*!,!]{\K\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}[X]}
\newcommand{\polyQ}[1][!*!,!]{\Q\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}[X]}
\newcommand{\polyR}[1][!*!,!]{\R\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}[X]}
\newcommand{\polyC}[1][!*!,!]{\C\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}[X]}
\newcommand{\fracK}[1][!*!,!]{\K\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}(X)}
\newcommand{\fracQ}[1][!*!,!]{\Q\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}(X)}
\newcommand{\fracR}[1][!*!,!]{\R\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}(X)}
\newcommand{\fracC}[1][!*!,!]{\C\ifthenelse{\equal{#1}{!*!,!}}{}{_{#1}}(X)}

%% Algèbre linéaire
\newcommand{\Rev}{$\R$-espace vectoriel\xspace}
\newcommand{\Revs}{$\R$-espaces vectoriels\xspace}
\newcommand{\Cev}{$\C$-espace vectoriel\xspace}
\newcommand{\Cevs}{$\C$-espaces vectoriels\xspace}
\newcommand{\Kev}{$\K$-espace vectoriel\xspace}
\newcommand{\Kevs}{$\K$-espaces vectoriels\xspace}
\newcommand{\Lev}{$\KL$-espace vectoriel\xspace}
\newcommand{\Ralg}{$\R$-algèbre\xspace}
\newcommand{\lin}[2]{\mathcal{L}\p{#1,#2}}
\newcommand{\Endo}[1]{\mathcal{L}\p{#1}}
\newcommand{\com}[1]{\mathcal{C}\p{#1}}
\renewcommand{\ker}{\mathop{\rm Ker}}
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\vect}{Vect}
\DeclareMathOperator{\rg}{rg}
\DeclareMathOperator{\codim}{codim}

%% Matrices
\newcommand{\mat}[2]{\mathcal{M}_{#1}\p{#2}}
\newcommand{\gl}[2]{GL_{#1}\p{#2}}
\DeclareMathOperator{\id}{Id}
\def\trans#1{\ifmmode\setbox9=\hbox{$#1$}\vphantom{\copy9}^t\!\box9%
  \else\penalty1000\ #1\fi}
\DeclareMathOperator{\tr}{tr}
\renewcommand{\det}{\mathop{\rm det}}
\newcommand{\Com}{\mathop{\rm Com}}
\newcommand{\Sp}[1]{\mathop{\rm Sp}\left(#1\right)}
\newcommand{\diag}[1]{\mathop{\rm{Diag}}\left(#1\right)}
\newcommand{\commutant}[1]{\mathop{\rm Com}\left(#1\right)}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                Géométrie                                    %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% Géométrie affine
\DeclareMathOperator{\bary}{Bar}
\newcommand{\ga}[1]{\mathop{\rm GA}\p{#1}}
\newcommand{\aff}[1]{\mathop{\rm Aff}\p{#1}}
\newcommand{\is}[1]{\mathop{\rm Is}\p{#1}}
\newcommand{\isp}[1]{\mathop{\rm Is}^+\p{#1}}

%% Géométrie euclidienne
\newcommand{\ve}[1]{\kern 2pt\overrightarrow{\kern -2pt#1}}
\newcommand{\ps}[2]{\left<#1|#2\right>}
\newcommand{\norme}[1]{\left\|#1\right\|}
\newcommand{\pmixte}[1]{\left[#1\right]}
\newcommand{\mesa}[1]{\overline{#1}}
\newcommand{\pvect}[2]{#1\wedge #2}
\newcommand{\Det}[2]{{\rm Det}\p{#1,#2}}

%% Coordonnées
\newcommand{\coorddd}[2]{\left|\begin{array}{l}\!\!#1 \\\!\!#2\end{array}\right.}
\newcommand{\coordtd}[3]{\left(\begin{array}{l}\!\!#1 \\\!\!#2\\\!\!#3\end{array}\right)}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                  Analyse                                    %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Fonctions
\newcommand{\dom}{\mathcal{D}}

%% Fonctions usuelles
\DeclareMathOperator{\cotan}{cotan}
\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\sh}{sh}
%%\DeclareMathOperator{\coth}{coth}
\DeclareMathOperator{\argch}{Argch}
\DeclareMathOperator{\argsh}{Argsh}
\DeclareMathOperator{\argth}{Argth}
\DeclareMathOperator{\argcoth}{Argcoth}

%% Parties de R
\newcommand{\Rb}{\overline{\R}}
\newcommand{\interf}[2]{\left[#1,#2\right]}
\newcommand{\intero}[2]{\left]#1,#2\right[}
\newcommand{\interfo}[2]{\left[#1,#2\right[}
\newcommand{\interof}[2]{\left]#1,#2\right]}
\newcommand{\intergf}[2]{\text{\flqq $\left[#1,#2\right]$\frqq}}
\newcommand{\intergo}[2]{\left]#1,#2\right[}
\newcommand{\intergfo}[2]{\left[#1,#2\right[}
\newcommand{\intergof}[2]{\left]#1,#2\right]}

%% Limites
\newcommand{\limite}[1]{\lim_{\substack{#1}}}
\newcommand{\tendvers}[2]{\xrightarrow[#1\rightarrow #2]{}}
\newcommand{\tendversdp}[2]{\xrightarrow[
                            \substack{#1\rightarrow #2 \\ #1>#2}]{}}
\newcommand{\tendversp}[2]{\xrightarrow[
                           \substack{#1\rightarrow #2 \\ #1\not=#2}]{}}
\DeclareMathOperator{\DL}{DL}
\DeclareMathOperator{\DA}{DA}
\newcommand{\petito}[3]{\underset{#1 \rightarrow #2}{o}\left(#3\right)}
\newcommand{\petitov}[4]{\underset{\substack{#1 \rightarrow #3\\#1 #2 #3}}{o}%
  \left(#4\right)}
\newcommand{\petitozero}[2]{\underset{#1 \rightarrow 0}{o}\left(#2\right)}
\newcommand{\petitozerop}[2]{\underset{\substack{#1 \rightarrow 0\\#1\neq 0}}{o}%
  \left(#2\right)}
\newcommand{\grando}[3]{\underset{#1 \rightarrow #2}{O}\left(#3\right)}
\newcommand{\equi}[2]{\underset{#1\rightarrow #2}{\sim}}

%% Suites
\newcommand{\suite}[1]{\p{#1}_{n\in\N}}
\newcommand{\equiS}{\underset{n\rightarrow\infty}{\sim}}

%% Dérivation
\newcommand{\derd}[2]{\frac{\text{d}#1}{\text{d}#2}}
\newcommand{\classed}[1]{\mathcal{D}^{#1}}
\newcommand{\classec}[1]{\mathcal{C}^{#1}}
\newcommand{\classecinf}{\classec{\infty}}
\newcommand{\fracd}[2]{\frac{{\rm d}#1}{{\rm d}#2}}

%% Intégration, primitives
\newcommand{\integ}[4]{\int_{#1}^{#2} #3\,\text{d}#4}
\newcommand{\integinv}[4]{\int_{#1}^{#2} \frac{\text{d}#4}{#3}}
\newcommand{\integppdi}[5]{\int_{#1}^{#2} \underbrace{#3}_{\text{d\'erive}}
                           \overbrace{#4}^{\text{int\`egre}}\,\text{d}#5}
\newcommand{\integppid}[5]{\int_{#1}^{#2} \overbrace{#3}^{\text{int\`egre}}
                           \underbrace{#4}_{\text{d\'erive}}\,\text{d}#5}
\newcommand{\evaldiff}[3]{\left[ #1 \right]_{#2}^{#3}}
\newcommand{\prim}[2]{\integ{}{}{#1}{#2}}
\newcommand{\priminv}[2]{\integinv{}{}{#1}{#2}}
\newcommand{\primppdi}[3]{\integppdi{}{}{#1}{#2}{#3}}
\newcommand{\primppid}[3]{\integppid{}{}{#1}{#2}{#3}}

%% Fonctions de plusieurs variables
\newcommand{\parfrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\integd}[4]{\int\!\!\!\!\int_{#1} #2\,\text{d}#3\text{d}#4}
\newcommand{\integdinv}[4]{\int\!\!\!\!\int_{#1}
   \frac{\text{d}#3\text{d}#4}{#2}}

%% Topologie
\def\build#1_#2^#3{\mathrel{\mathop{\kern0pt#1}\limits_{#2}^{#3}}}
\newcommand{\rond}[1]{\build#1_{}^{\>\circ}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                   Autres                                    %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\og{\leavevmode\raise.3ex\hbox{$\sst\langle\!\langle$}}
\def\fg{\leavevmode\raise.3ex\hbox{$\sst\,\rangle\!\rangle$}}
\newcommand{\cc}{\mathcal{C}}
\newcommand{\cd}{\mathcal{D}}
\newcommand{\ce}{\mathcal{E}}
\newcommand{\cf}{\mathcal{F}}
\newcommand{\cg}{\mathcal{G}}
