  \documentclass[12pt]{article}


 \usepackage{ifthen}

  \usepackage[utf8]{inputenc}
% \usepackage{fourier}
\usepackage[T1]{fontenc}
  \usepackage[svgnames]{xcolor}

  \usepackage{geometry}
  \geometry{a4paper,hmargin=1.5cm,vmargin=1cm}

  \setlength{\parindent}{0pt}

  \usepackage{graphicx}
  \usepackage{ifpdf}
   \ifpdf
     \DeclareGraphicsRule{*}{mps}{*}{}
   \fi

 \usepackage{emp} % Le package pour mettre du metapost dans le fichier tex

  \usepackage{multicol}
  \setlength{\multicolsep}{12pt}
  \setlength{\columnsep}{40pt}
  \setlength{\columnseprule}{0.5pt}

  \usepackage{enumitem}
 % \setenumerate{align=left,leftmargin=*,noitemsep}
\setenumerate{align=left,leftmargin=*}
  \setenumerate[2]{label=\alph*),widest=a,ref=\theenumi.\alph*}
  \setitemize{nolistsep}

  \usepackage{amsmath,mathrsfs}
  \usepackage[np]{numprint}

  \usepackage[official,right]{eurosym}
  \usepackage[frenchb]{babel}
  \frenchbsetup{CompactItemize=false}
  \DecimalMathComma

\newcounter{exercice}
\newcounter{refex}
\renewcommand{\therefex}{\arabic{exercice}}
\newcounter{partie}[exercice]
\newcounter{refpart}
\renewcommand{\thepartie}{\Alph{partie}}
\renewcommand{\therefpart}{\Alph{partie}}

\makeatletter
\newenvironment{exercice}[1][]{%
		     \stepcounter{exercice}
		     \refstepcounter{refex}
		     \vspace{0.5em}
		     \par
                     \def\@svsechd{\large \color{white} \colorbox{purple}{\bfseries\arabic{exercice}}}%
                     \@xsect{-1em}%
                     \ifthenelse{\equal{#1}{}}{}{\textbf{#1}\par}%
                     }{\par\vspace{1.5em}}
\makeatother

\newenvironment{partie}[1][]{%
                     \stepcounter{partie}
                     \refstepcounter{refpart}
		      \par \vspace{0.5ex}\noindent
		     \textbf{Partie \thepartie \ifthenelse{\equal{#1}{}}{}{\quad -\quad#1}%
		     }\nopagebreak\par%
                     }{\par\vspace{1em}}



%%%%%%%%%%% Ensembles %%%%%%%%%%%%
\newcommand{\D}{\mathbb{D}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\C}{\mathbb{C}}

%%%%%%%%%%% Intervalles %%%%%%%%%%%%
\newcommand{\intervalleOO}[2]{\left]{#1}\,{;}\,{#2}\right[}
\newcommand{\intervalleOF}[2]{\left]{#1}\,{;}\,{#2}\right]}
\newcommand{\intervalleFO}[2]{\left[{#1}\,{;}\,{#2}\right[}
\newcommand{\intervalleFF}[2]{\left[{#1}\,{;}\,{#2}\right]}

\newcommand{\couple}[2]{\left(#1\,{;}\,{#2}\right)}


\newcommand{\calc}{\mathscr{C}}
\newcommand{\cald}{\mathscr{D}}
\newcommand{\calt}{\mathscr{T}}
%%%%%%%%%%%% Vecteurs %%%%%%%%%%%%%%%
\usepackage[e]{esvect}
\newcommand{\vect}[1]{\vv{#1}}
\newcommand{\repere}[3]{\left(#1\,{;}\,\vect{#2}{,}\,\vect{#3} \right)}
\newcommand{\oijk}{\left(O\,{;}\,\vect{i}{,}\,\vect{j} {,}\,\vect{k} \right)}
\newcommand{\oij}{\repere{O}{\imath}{\jmath}}
\newcommand{\ouv}{\repere{O}{u}{v}}
\newcommand{\barre}[1]{\overline{#1\rule{0.1em}{0ex}}}

%%%%%%%%%%%% Coordonnées %%%%%%%%%%%%%%%
\newcommand{\cp}[2]{%
        \begin{pmatrix}
        #1\\
        #2
        \end{pmatrix}%
        }

%%%%%%%%%%%% Systèmes %%%%%%%%%%%%%%%
\newcommand{\sysd}[2]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
       \end{aligned}
       \right.%
       }

\newcommand{\syst}[3]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
	  #3
       \end{aligned}
       \right.%
       }

\newcommand{\sysq}[4]{%
       \left\{
       \begin{aligned}
          #1\\
          #2\\
	  #3
       \end{aligned}
       \right.%
       }




%%%%%%%%%%%% Divers %%%%%%%%%%%%%%%
\DeclareMathOperator{\card}{Card}


% perso nico

\newcommand{\orth}{\bot} % Pour faire le symbole perpendiculaire
\newcommand{\cm}{\,\mathrm{cm}} 
\newcommand{\pI}{{\ensuremath{+\infty}}} 
\newcommand{\mI}{{\ensuremath{-\infty}}} 

\newcommand{\cala}{\mathscr{A}}
\newcommand{\calb}{\mathscr{B}}
\newcommand{\calp}{\mathscr{P}}
\newcommand{\cale}{\mathscr{E}}
\newcommand{\calf}{\mathscr{F}}
\newcommand{\cals}{\mathscr{S}}
\newcommand{\calh}{\mathscr{H}}


%%%%%%%%%%% Limites %%%%%%%%%%%%olivier
\newcommand{\limn}{\ds\lim_{n\rightarrow +\infty}}
\newcommand{\limo}[1][x]{\ds\lim_{#1\rightarrow 0}}
%\newcommand{\limite}[2][x]{\ds\lim_{#1\rightarrow #2}}  % voir avec olivier
\newcommand{\limpinf}[1][x]{\ds\lim_{#1\rightarrow +\infty}}
\newcommand{\limminf}[1][x]{\ds\lim_{#1\rightarrow -\infty}}
\newcommand{\limiteg}[2][x]{\ds\lim_{x\xrightarrow{<}#2}}
\newcommand{\limited}[2][x]{\ds\lim_{x\xrightarrow{>}#2}}


% pour écrire des limites
\newcommand{\limite}[2]{\displaystyle\lim_{#1\rightarrow #2}}

\newcommand{\ssi}{\Longleftrightarrow} % Pour faire le symbole equivalent
\newcommand{\implique}{\Longrightarrow} % Pour faire le symbole implique

\usepackage{enumitem}
%\usepackage{xypic}

  \usepackage{amsmath}
  \usepackage{amssymb}
  \usepackage{amsfonts}
  \usepackage{mathrsfs}
%  \usepackage{shortlst}


\usepackage{pstricks,pst-plot,pst-text,pst-tree,pst-eps,pst-fill,pst-node,pst-math}
\usepackage{pstricks,pst-plot,pst-3dplot,pstricks-add}
\newtheorem{remarque}{Remarque}
\newtheorem{remarque*}{Remarque}
\newtheorem{theorem*}{Théorème}
\newtheorem{definition*}{Définition}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Insérer une figure en metapost à côté d'un texte
\usepackage{parboxx}
\usepackage{xkeyval}

\makeatletter
\define@key{textefigopt}{margin}{\MP@margefig=#1}
\define@key{textefigopt}{pos}{\def\posv{#1}}
\define@key{textefigopt}{width}{\MP@largeurfigtrue\MP@largfig=#1}
\define@boolkey{textefigopt}[posh]{left}[true]{}
\presetkeys{textefigopt}{margin=1em,pos=T,left=false}{}

\newlength{\MP@largfig}
\newlength{\MP@largfigtmp}
\newlength{\MP@margefig}
\newsavebox{\MP@boiteenonce}
\newsavebox{\MP@boitefig}
\newif\ifMP@largeurfig


\newenvironment{textefig}[1][]
     {\MP@largeurfigfalse%
     \setkeys{textefigopt}{#1}}
     {\par
      \if\posv c \def\MP@bsp{0.3}\def\MP@asp{0.3}\fi
      \if\posv B \def\MP@bsp{0.3}\def\MP@asp{0}\fi
      \if\posv T \def\MP@bsp{0}\def\MP@asp{0.3}\fi
      \vspace{\MP@bsp\baselineskip}
      \noindent
      \ifposhleft
       \usebox{\MP@boitefig}%
       \usebox{\MP@boiteenonce}%
      \else
       \usebox{\MP@boiteenonce}%
       \usebox{\MP@boitefig}%
      \fi
      \par\vspace{\MP@asp\baselineskip}
      }

\newenvironment{figmp}
      {\empdef[fig](0,0)}%
      {\endemp%
       \ifMP@largeurfig
         \relax
       \else
         \setlength{\MP@largfigtmp}{\widthof{\empuse{fig}}+2\MP@margefig}%
         \global\MP@largfig=\MP@largfigtmp
       \fi%
       }

\newenvironment{enonce}%
             {\lrbox{\MP@boiteenonce}
              \begin{minipage}[\posv][\totalheight][\posv]{\linewidth-\MP@largfig}}%
             {\end{minipage}
              \endlrbox
              \lrbox{\MP@boitefig}
              \begin{minipage}[\posv][\totalheight][\posv]{\MP@largfig}
              \centering\empuse{fig}
              \end{minipage}
              \endlrbox}
\makeatother


%%% Fin de textefigure 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555
% --------------------------------------------------------------------------------------------------

%devoir surveillé personalisé
% #1 titre principal, #2 titre milieu haut en petit, #3 titre haut
% gauche, #4 titre haut droit 
\newcommand{\devpers}[4]{
                         %\pagestyle{empty} 
                         \noindent 
                         \begin{minipage}[t]{\linewidth}
                         \textit{#3 } \hfill \textit{ #2} \hfill \textit{#4}
                         \end{minipage}
                         \begin{center}{{\Large\bf #1 }} \end{center} 
                         \vspace{-0.3cm}
                         \rule{\linewidth}{0.5mm} 
                         }




\newenvironment{exnormal}[1]{
                             \addtocounter{exercice}{1}
                             \vspace{1em} \par \noindent
                              {\bf Exercice \arabic{exercice}{\bf #1 } :}
                            }{\vspace{0.25em}}

\newcommand{\ds}{\displaystyle}

\newenvironment{exodev}[2]{
                             \addtocounter{exercice}{1}
                             \vspace{0.5em} \par \noindent
                              {\subsubsection*{Exercice \arabic{exercice}~:{~\bf #2 } }}
                            }{\vspace{0.05em}%\hrule
			    }
%\newcommand{\exo}[1]{\begin{exnormal}{}}
%\newcommand{\finexo}{\end{exnormal}}

%\newcommand{\exo}[1]{\begin{exodev}{}}
%\newcommand{\finexo}{\end{exodev}}
\newcommand{\E}{\text{e}}
\renewcommand{\i}{\text{i}}
% pour faire le conjugué
\newcommand{\conj}[1]{\overline{\rule{0em}{1.5ex}#1\rule{0em}{1.5ex}} }
\usepackage{tabularx}


\usepackage{manfnt}   % pour utiliser des symboles comme danger etc ...
%\reversemarginpar  % pour faire apparaitre le symbole danger à gauche
\newcommand{\danger}{\marginpar[\Large \hfill\dbend]{\LARGE \dbend\hfill}}
%%%%%%%%%%%%%%%%%%%%%%%ù
% pour faire un cours 

\usepackage{amsmath,mathrsfs}
  \usepackage[np]{numprint}

\newcommand{\titrecours}[3]{
                           {\bf
                           {\Large
                           {\noindent Math\'{e}matiques-#2
                            \hfill Ann\'ee scolaire  $\mathbf{#3}$  
                            \noindent\rule{\linewidth}{0.5mm} 
                            \vspace{-1cm}
                            \begin{center}
	                    {\LARGE{#1}}
                            \end{center}
                           }
                           }
                           }
                           \vspace{-.4cm}
                           \noindent \rule{\linewidth}{0.5mm}
                           }          

% les definitions, remarques, theoremes .....

\newtheorem{theoreme}{Th\'eor\`eme}
%\newtheorem*{theoreme*}{Th\'eor\`eme}
\newtheorem{axiome}{Axiome}
%\newtheorem*{axiome*}{Axiome}
\newtheorem{definitiontheoreme}[theoreme]{D\'efinition et Th\'eor\`eme}
\newtheorem{notation}[theoreme]{Notation}
%\newtheorem*{notation*}{Notation}
\newtheorem{proposition}[theoreme]{Proposition}
\newtheorem{corollaire}[theoreme]{Corollaire}
\newtheorem{lemme}[theoreme]{Lemme}
%\theoremstyle{definition}
\newtheorem{propriete}[theoreme]{Propri\'et\'e}
%\newtheorem*{propriete*}{Propri\'et\'e}
\newtheorem{exemple}[theoreme]{\underline {Exemple}} 
%\newtheorem*{exemple*}{\underline {Exemple}} 
\newtheorem{question}{\underline {Question}}
%\newtheorem*{question*}{\underline {Question}}
\newtheorem{definition}[theoreme]{D\'efinition} 
%\newtheorem*{definition*}{D\'efinition} 
\newtheorem{consequence}[theoreme]{Cons\'equence} 
%\newtheorem*{consequence*}{Cons\'equence} 
%\theoremstyle{remark}
%\newtheorem{remarque}[theoreme]{Remarque}
%\newtheorem*{remarque*}{Remarque}
%Pour remetre à jour les commentaire voir le livre de modalidades ou c'est fait comme il faut.



% pour faire des compositions de limites
\newcommand{\composition}[4]{\ensuremath{\renewcommand{\arraystretch}{2}
\left.\begin{array}{l} 
#1 \\
#2 \\
#3 
\end{array} \right\} \implique #4}
\renewcommand{\arraystretch}{1}
}

%demonstration, preuves...
\newenvironment{preuve}{\vskip 2mm\noindent {\it Preuve : }}{\flushright $\Box$ \vskip 2mm}
\newenvironment{dem}{\vskip 2mm\noindent {\it D\'emonstration :}}{\par}


\usepackage{pstricks-add}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%fin de pour faire un cours


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Algorithmes %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xcolor}
\colorlet{LFBcoultable1}{blue!25!black!20}

\usepackage[french,ruled,lined,linesnumbered,inoutnumbered]{algorithm2e}

\SetKwInput{Lire}{Lire}
\SetKwInput{Afficher}{Afficher}

\SetKwFor{VarAlgo}{Variables}{}{finVariables}
\newcommand{\Variables}[1]{\SetAlgoVlined%
                           \VarAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{EntrAlgo}{Entrées}{}{fin}
\newcommand{\Entrees}[1]{\SetAlgoVlined%
                           \EntrAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{TraitAlgo}{Traitement}{}{fin}
\newcommand{\Traitement}[1]{\SetAlgoVlined%
                           \TraitAlgo{}{#1}
                           \SetAlgoLined}

\SetKwFor{SortAlgo}{Sorties}{}{fin}
\newcommand{\Sorties}[1]{\SetAlgoVlined%
                           \SortAlgo{}{#1}
                           \SetAlgoLined}
\makeatletter
\newsavebox{\LFB@lgo}
\newenvironment{algoLFB}[2][0.5]% % 2 parametres : 1-facultatif largeur en proportion 2-titre de l'algo
               {\setlength{\fboxsep}{0pt}\begin{lrbox}{\LFB@lgo}
               \small\begin{minipage}{#1\linewidth}%
                \begin{algorithm}[H]%
                \caption{#2}}%
               {\end{algorithm}%
                \end{minipage}%
                \end{lrbox}%
                \begin{center}
                \fcolorbox{black}{LFBcoultable1}{\usebox{\LFB@lgo}}
%                \fcolorbox{LFBcoultable2}{LFBcoultable1}{\usebox{\LFB@lgo}}
                \end{center}}
\makeatother
\newcommand{\recoit}{\ensuremath{\leftarrow}}

%inserer une figure à droite du texte 
%\textfig{largeur en %}{echelle}figure}
\usepackage{calc}
\newsavebox{\maboite}
\newenvironment{textfig}[3]%
{\savebox{\maboite}{\begin{minipage}{\linewidth-#1\linewidth}
\begin{center}
\includegraphics[scale=#2]{#3}
\end{center}
\end{minipage}}
\begin{minipage}{#1\linewidth}}%
{\end{minipage} \usebox{\maboite}}

\newcommand{\exo}[2]{\begin{exnormal}{~#2}}
\newcommand{\finexo}{\end{exnormal}}

% % % Pour insrer une correction :
%\usepackage{answers}
%\Newassociation{cor}{solution}{correction}
%\Newassociation{help}{aide}{aide}
%\newcommand{\precor}{{$\ $\\ \bf \footnotesize [Exercice corrig\'e]}}
%%\newcommand{\prehelp}{{$\ $\\ \bf \footnotesize [Exercice avec aide à la correction]}}
%%\renewcommand{\solutionlabel}[1]{\bf \emph{Correction #1}}
%
%\renewenvironment{solution}[1]{{\bf Solution de l'exercice #1}
%  \hrulefill \par \vspace{0.5em}
%                    }{\vspace{0.5em}}
%
%
%\renewenvironment{aide}[1]{{\bf Aide sur l'exercice #1}
%  \hrulefill \par \vspace{0.5em}
%                    }{\vspace{0.5em}}

                    
%\input{TexteFigureMP}
\begin{document}
%\Opensolutionfile{correction}[correction1]
%\Opensolutionfile{aide}[aide1]
\pagestyle{empty}
\begin{empfile} % Tout doit être inclus dans cet environnement
                % qui a un paramètre facultatif : le nom du fichier .mp
                % par défaut, c'est le nom du fichier .tex (plus simple)

\begin{empcmds}
    input latexmp;
    input repere;
%     setupLaTeXMP(inputencoding="utf8",
%                  packages="mathdesign[utopia],mathtools,babel[frenchb]",
%                  preamble="\DecimalMathComma");
% color coul[];
% coul1:=(0,0,1);
\end{empcmds}
\devpers{Devoir Mathématiques $N^o$ 1 (30 mn)}{}{2\up{nde}8}{18 septembre 2015}


\setlength{\columnseprule}{.5pt}
\setlength{\columnsep}{30pt}

\setcounter{exercice}{-1}
\begin{exercice}Nom et prénom : \end{exercice}

\begin{exercice}
Compléter directement le tableau suivant avec les solutions de chaque équation. Aucune justification n'est demandée et vous êtes encouragés à faire le calcul de tête.
\begin{center}
\renewcommand{\arraystretch}{2.7}
\noindent\begin{tabular}{|cc|ccc|} 
\hline 
Equations & & & Solutions \phantom{---------------------------------}& 
\tabularnewline 
\hline 
$3x-2=0$& & &   &
\tabularnewline 
\hline 
$5x-7=0$ & & & &
\tabularnewline 
\hline 
$-2x+6=0$& & & &
\tabularnewline 
\hline 
$-8x-2=0$& & & &
\tabularnewline 
\hline
$-x+2=0$& & & & 
\tabularnewline 
\hline
$(6x-2)(2x+1)=0$& & &   &
\tabularnewline 
\hline 
$(9x+4)(4-x)=0$ & & & &
\tabularnewline 
\hline 
$(2x-4)x=0$& & & &
\tabularnewline 
\hline 
$(x+2)^2=0$& & & &
\tabularnewline 
\hline
$(9-3x)(x+7)(4x+3)=0$& & & & 
\tabularnewline 
\hline
\end{tabular}
\end{center}

\end{exercice}

\begin{exercice}
\begin{textefig}
\begin{figmp} 

repere(-4,3,0.9cm,-3,4,0.8cm,60);
  pair O,I,J,A,B,C,H,K,L;
  O=_c(0,0);I=_c(1,0);
  A=_c(-1,2);J=_c(0,2);
  B=_c(-1,-2);C=_c(1,-1);
  K=_c(-2,0); 
  L=_c(0,1);
  draw quadrillage(1,1) withcolor 0.2white;
  nomme.lrt(O);nomme.lrt(J);
  nomme.ulft(I);nomme.lrt(A);
  nomme.lrt(B);nomme.lrt(C);
  nomme.lrt(K);
  nomme.lrt(L);
  %nomme.ulft(K);
fin;
\end{figmp}

\begin{enonce}
 On considère la figure ci-contre.
\begin{enumerate}
   \item Déterminer les coordonnées de $A$, $B$ et $C$ dans le repère $(O,I,J)$ : vous compléterez :\par
On a $A(\ \ \ \ ;\ \ \ \ )$;  $B(\ \ \ \ ;\ \ \ \ )$;  $C(\ \ \ \ ;\ \ \ \ )$;  
%   \item Déterminer les coordonnées de $A$, $B$ et $C$ dans le repère $(I,K,C)$ : vous compléterez :\par
%On a $A(\ \ \ \ ;\ \ \ \ )$;  $B(\ \ \ \ ;\ \ \ \ )$;  $C(\ \ \ \ ;\ \ \ \ )$;  
 \item Les points $O, I, K$ forment-ils un repère du plan ?  (justifiez)
\vspace{2cm}
 %\item Les points $O, A, C$ forment-ils un repère du plan ?  (jusitifiez)
 %\vspace{2cm}
\end{enumerate}

\end{enonce}

\end{textefig}
\end{exercice}


\begin{exercice}
\begin{textefig}
\begin{figmp}
 u:=1cm;
 repere(-4,7,0.5u,-9,2,0.5u);
 pair I,J,O;
 
 I=_c(1,0);J=_c(0,1);O=_c(0,0);
 %draw axes(0,0);
 draw quadrillage(1,1) withcolor 0.5white;
 draw axes(0,0) withpen pencircle scaled 1.5;
 nomme.lrt(I);nomme.lrt(J);nomme.llft(O);
 draw cadre withpen pencircle scaled 1;
 fin;  
   
\end{figmp}
\begin{enonce}
Dans un repère $(O,I,J)$.
  Soit $A(-3;-5)$,$B(6;-2)$, $C(3;1)$, $H(6;-4)$. 
  
  On note $\calc$ le cercle de diamètre $[AB]$. 
  \begin{enumerate}
  \item Placer les points $A$, $B$ et $C$ sur le graphique ci-contre.
  \item Déterminer (par le calcul) les coordonnées de $K$ milieu de $[AB]$.
  \item Tracer le cercle $\calc$.
  \item Le point $C$ est-il un point du cercle $\calc$ ? (vous justifierez par un calcul)
  \item Le point $H$ est-il un point du cercle $\calc$ ? (vous justifierez par un calcul)
%  \item $ABC$ est-il un triangle rectangle ? Justifier.
  \end{enumerate}
  
\end{enonce}
\end{textefig}
\end{exercice}


\end{empfile}
\end{document}


 
