\documentclass[12pt]{book}\usepackage{ammaths}\fr\nocolor


\begin{document}%\nocolor
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}

\tableofcontents

\newpage



\chapter*{Analyse}\addcontentsline{toc}{chapter}{Analyse}
\section{Notions de fonctions}

\subsection{Suite d'instructions}
\exo{\tice~On considère l'algorithme ci-dessous : 
\begin{multicols}{2}
\begin{enumerate}
 \item Déterminer l'image de $0$ par cet algorithme.
 \item Déterminer l'image de $-3$ par cet algorithme.
       Quelle modification faudrait-il apporter à l'algorithme pour éviter le problème ?
 \item Soit $f$ la fonction qui à la variable $x$ associe le réel $y$ obtenu après application de l'algorithme. Donner
l'expression algébrique de $f$. Simplifier.
\end{enumerate}
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{7cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$x$, $a$ and $b$ three real numbers \;}
\Begin{\KwIn{$x$ real number \;}
$x+2 \rightarrow a$ \;
$\dfrac{1}{a+1} \rightarrow b$ \;
$a^2+\dfrac{1}{b} \rightarrow y$ \;
\KwOut{$y$ \;}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\end{multicols}
}
\subsection{Tracé d'une courbe B-spline}
\exo{%Tracé d'une courbe B-spline.
\tice~L'algorithme ci-dessous est une simplification du procédé utilisé pour tracer des courbes en CAO.
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{12cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$x$, $a$ and $b$ three real numbers \;}
\Begin{\KwIn{$x$, $a$, $b$ real numbers \;}
\Switch{the value of $x$}{
    \lCase{$x\in [0;1]$ :}{$x \rightarrow a$~; $0 \rightarrow b$ \;}
    \lCase{$x\in [1;2]$ :}{$x \rightarrow a$~; $x-1 \rightarrow b$ \;}
    \lCase{$x\in [2;3]$ :}{$4-x \rightarrow a$~; $x-1 \rightarrow b$ \;}
    \lCase{$x\in [3;4]$ :}{$4-x \rightarrow a$~; $5-x \rightarrow b$ \;}
    \lCase{$x\in [4;5]$ :}{$0 \rightarrow a$~; $5-x \rightarrow b$ \;}
            }
\KwOut{$a$, $b$}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\begin{enumerate}
 \item En utilisant l'algorithme, compléter le tableau de valeur suivant : 
	\begin{center}
	\begin{tabular}{|c|*{11}{p{0.5cm}|}}\hline
	$x$ & 0 & 0.5 &1 &1.5&2&2.5&3&3.5&4&4.5&5\\\hline
	$a$ &   &     &  &   & &   & &   & &   &  \\\hline
	$b$ &   &     &  &   & &   & &   & &   &  \\\hline
	\end{tabular}
	\end{center}
 \item Dans un repère, placer l'ensemble des points de coordonnées $(a;b)$ obtenus ci-dessus.
 \item La courbe obtenue est-elle celle d'une fonction ? Expliquer
\end{enumerate}
}

\newpage
\subsection{Fonction définie sur $\N$ : somme des diviseurs}
\exo{\emph{Une fonction définie sur l'ensemble des entiers}\\
On considère l'algorithme ci-dessous.
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{12cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$n\in\N^*$ , $nb\_div\in\N$ , $sum\_div=0\in\N$\;}
\Begin{\KwIn{$n$, a whole number \; }
$0 \rightarrow  nb\_div$ \;$0 \rightarrow sum\_div$ \;
\While{$n\notin\N^*$}
      {\KwOut{``Warning, $n$ must be a whole number, try again'' \;}
      \KwIn{$n$ \;}}
\For{$i$ from $1$ to $n$ step $1$}
    {\If{$\frac{n}{i}\in\N$}
	  {\KwOut{``$i$ is a divisor of $n$'' \;}
	  $nb\_div+1 \rightarrow nb\_div$ \;
	  $sum\_div+i \rightarrow sum\_div+i$ \;}
    }
\KwOut{$nb\_div$ \;}
\KwOut{$sum\_div$ \;}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\begin{enumerate}
 \item Quel est le rôle de la boucle While ? En quoi est-ce important pour la suite de l'algorithme ?
 \item Appliquer l'algorithme lorsque les valeurs saisies pour $n$ sont successivement $2$; $-2$ puis $1.5$.
 \item Appliquer l'algorithme aux nombres entiers compris entre $1$ et $10$.
 \item Quel semble être le rôle de cet algorithme ?
 \item Tracer la représentation graphique de la fonction $sum\_div$ pour $n$ de $1$ à $10$.
\end{enumerate}
}

\newpage
\section{Variations d'une fonction}
\subsection{Signe d'une fonction sur un intervalle ; algo très boiteux, à modifier}


\begin{multicols}{2}
\exo{\tice\ L'objectif de l'algorithme ci-dessous est de tester si une fonction donnée prend des valeurs négatives sur un intervalle donné.
 \begin{enumerate}
 \item Appliquer l'algorithme avec $f(x)=x^2-2x-3$, $a=-5$ et $b=5$. Vérifier le résultat à l'aide de la calculatrice.
 \item Appliquer l'algorithme avec $f(x)=x^2-x$, $a=-5$ et $b=5$. Vérifier le résultat à l'aide de la calculatrice.
 \item Modifier l'algorithme pour que le pas, c'est-à-dire la différence entre deux valeurs successives dans la boucle While, soit saisi par l'utilisateur.
 \item Comment pourrait-on modifier l'algorithme pour éviter le problème relevé dans la question 2 ?
\end{enumerate}
}
\vspace*{-1cm}
\begin{minipage}[t]{9cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$f$ a function, $a$ and $b$ two real numbers\;}
$0\rightarrow neg$ \;
$a\rightarrow x$ \;
\While{$x\leq b$ and $neg=0$}{
	\If{$f(x)<0$}{$1\rightarrow neg$ \;}
	$x+1\rightarrow x$ \;
}
\eIf{$neg=0$}{\KwOut{``$f(x)$ is never negative over the interval $[a,b]$'' \;}}
{\KwOut{``$f(x)$ is sometimes negative over the interval $[a,b]$'' \;}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{multicols}



\newpage
\section{Fonctions linéaires, fonctions affines}
\subsection{Algo sur le cours}
\exo{\tice~L'algorithme suivant concerne une fonction de la forme $f(x)=ax+b$. Compléter les pointillés.
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{10cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$x$, $a$ and $b$ three real numbers \;}
\Begin{\KwIn{$a$, $b$ nombre réel \;}
\eIf{$a=0$}{\KwOut{``La fonction est \dots`` \;}}
	   {\eIf{$b=0$}{\KwOut{``La fonction est \dots'' \;}}
		       {\KwOut{``la fonction est \dots'' \;}}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
}


\newpage
\section{Fonctions carré et fonctions du second degré}
\subsection{Racines d'un trinôme}

\exo{\tice~Soit $f$ la fonction définie sur $\R$ par $f(x)=2(x-3)(x+4)$.
\begin{enumerate}
 \item \begin{enumerate}
	\item Déterminer les antécédents de $0$.
	\item Donner l'expression développée de la fonction $f$.
	\item Appliquer l'algorithme suivant à la fonction $f$.
	      \begin{center}\vspace*{-15pt}
	      \begin{minipage}[t]{14.5cm}
	      \IncMargin{1em}
	      \begin{algorithm}[H]
	      %\KwData{$x$, $a$ and $b$ three real numbers \;}
	      \Begin{\KwIn{$a$, $b$, $c$, coefficients of a quadratic function \;}
	      $b^2-4ac \rightarrow d$ \;
	      \If{$d \geq 0$}{$\dfrac{-b+\sqrt{d}}{2a}\rightarrow x_1$ \;
			      $\dfrac{-b-\sqrt{d}}{2a}\rightarrow x_2$ \;
			      \KwOut{$x_1$,  $x_2$ \;}}
	      }
	      \end{algorithm}
	      \DecMargin{1em}
	      \end{minipage}
	      \end{center}
	\item Expliquer la condition $d \geq 0$.
	\end{enumerate}
\item Reprendre la question précédente avec la fonction $g(x)=(x+4)(x-7)$. 
\item Reprendre la question précédente avec la fonction $h(x)=2x^2+3x+4$ (on se contentera d'une recherche graphique des antécédents).
\item Quel semble être le rôle de l'algorithme ?
\end{enumerate}
}


\newpage
\section{Fonctions homographiques}
\subsection{Une idée à creuser}

\exo{\tice~
\begin{enumerate}
 \item Draw the graph of the functions $h_1(x)=\dfrac{2x+4}{6x-3}$ and $h_2(x)=\dfrac{5x+1}{4x+2}$.
 \item Used the previous question to fill the dots out in the following algorithm.
	\begin{center}\vspace*{-15pt}
	\begin{minipage}[t]{14.5cm}
	\IncMargin{1em}
	\begin{algorithm}[H]
	%\KwData{$x$, $a$ and $b$ three real numbers \;}
	\Begin{\KwIn{$a$, $b$, $c$, $d$ coefficients of a homographic function \;}
	$-\dfrac{d}{c} \rightarrow v$ \;
	$ad-bc \rightarrow u$ \;
	\eIf{$u \geq 0$}{\KwOut{``The function is decreasing over \dots ''\;}}
			{\KwOut{``The function is increasing over \dots ''\;}}
	}
	\end{algorithm}
	\DecMargin{1em}
	\end{minipage}
	\end{center}
 \item Apply the algorithm with the function $h(x)= $ ? What happens ? Amend the algorithm to avoid this problem ?
\end{enumerate}
}



\subsection{Valeurs critiques d'une fonction homographique}
\exo{\tice~Write, implement and test an algorithm that returns the forbidden value and the zero of a homographic function} 



\newpage
\chapter*{Géométrie}\addcontentsline{toc}{chapter}{Géométrie}
\section{Repérage dans le plan}
\subsection{Translation, homothétie, symétrie}

\exo{\tice~On considère l'algorithme suivant :
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{9cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$(x;y)$  \;}
\Begin{\KwIn{$(x,y)$ coordinates of a point \;}
Place the point $(x,y)$ in black \;
$x+2 \rightarrow a$ \;
$y+1 \rightarrow b$ \;
Place the point $(a,b)$ in red \;}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\begin{enumerate}
\item Appliquer l'algorithme à chacun des points suivants : $(1\ ; \ 1)$ ; $(3\ ; \ 1)$ ; $(4\ ; \
2)$ ; $(5\ ; \ 1)$ ; $(5\ ; \ 3)$ ; $(4\ ; \ 4)$ ; $(5\ ; \ 5)$ ; $(3\ ; \ 5)$ ; $(3\ ; \ 3)$ ; $(1\ ; \ 1)$.
\item Quel semble être le rôle de cet algorithme ?
\item \begin{enumerate}
       \item Reprendre les questions précédentes en considérant l'algorithme similaire dans lequel $2x \rightarrow a$ et $2y \rightarrow b$. On tracera une nouvelle figure.
       \item Reprendre les questions précédentes en considérant l'algorithme similaire dans lequel $y \rightarrow a$ et $x \rightarrow b$. On tracera une nouvelle figure.
      \end{enumerate}
\end{enumerate}
}


\subsection{Milieu}

\begin{minipage}{6cm}
\exo{\tice~Dans l'algorithme ci-dessous, $x_A$ et $y_A$ représentent les coordonnées d'un point $A$ et $x_B$, $y_B$ celles
d'un point $B$.
\begin{enumerate}
\item Faire fonctionner cet algorithme avec les points $A$ et $B$ de coordonnées respectives $(2\ ; \ -1)$ et $(-3\ ; \ 1)$.
\end{enumerate}}
\end{minipage}
\begin{minipage}{10cm}
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{9cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$(x_A;y_A)$ and $(x_B;y_B)$ coordinates of two points \;}
\Begin{\KwIn{$(x_A,y_A)$ and $(x_B,y_B)$ coordinates of two points \;}
Draw a cartesian graph \OIJ~\;
Place point $A(x_A,y_A)$ \;
Place point $B(x_B,y_B)$ \;
$\pa{\frac{x_A+x_B}{2},\frac{y_A+y_B}{2}} \rightarrow (x_I,y_I)$ \;
Place $(x_I,y_I)$ \;}
\end{algorithm}
\DecMargin{1em}
\end{minipage}\end{center}
\end{minipage}



\begin{enumerate}
\item Faire fonctionner cet algorithme avec les points $A$ et $B$ de coordonnées respectives $(2\ ; \ 2)$ et $(-4\ ; \ 6)$.
\item Quel semble être le rôle de cet algorithme ?
\end{enumerate}


\subsection{Distance}
\exo{\tice~En s'inspirant de l'algorithme permettant de calculer les coordonnées du milieu de deux points, écrire un algorithme pour calculer la distance entre deux points dans un repère orthonormé.}


\subsection{Triangle rectangle}
\exo{\tice~Dans l'algorithme ci-dessous, on saisit les coordonnées de trois points $A$, $B$ et $C$ dans un repère orthonormé.
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{14cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$(x_A;y_A)$ ; $(x_B;y_B)$ and $(x_C;y_C)$ coordinates of three points \;}
\Begin{\KwIn{$(x_A,y_A)$ ; $(x_B,y_B)$ and $(x_C,y_C)$ coordinates of three points \;}
$(x_B-x_A)^2+(y_B-y_A)^2 \rightarrow d$ \;
$(x_C-x_B)^2+(y_C-y_B)^2 \rightarrow e$ \;
\eIf{$e=d$}{\KwOut{``the triangle is \dots`` \;}}{\KwOut{``the triangle is not \dots'' \;}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}\end{center}
\begin{enumerate}
\item Que faut-il écrire à la place des pointillés ? Quel est le rôle de cet algorithme ?
\item Proposer une modification de l'algorithme afin qu'il indique si un triangle $ABC$ est isocèle en un des trois sommets.
\end{enumerate}
}

\newpage
\section{Vecteurs (sans coordonnées)}
\subsection{Introduction translation}
\exo{\tice~En s'inspirant de l'algorithme permettant de calculer les coordonnées du milieu de deux points, écrire un algorithme pour calculer la distance entre deux points dans un repère orthonormé.}

\exo{\tice~Dans l'algorithme ci-dessous, on saisit les coordonnées de trois points $A$, $B$ et $C$ dans un repère orthonormé.
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{14cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$(x_A;y_A)$ ; $(x_B;y_B)$ and $(x_C;y_C)$ coordinates of three points \;}
\Begin{\KwIn{$(x_A,y_A)$ ; $(x_B,y_B)$ and $(x_C,y_C)$ coordinates of three points \;}
$(x_B-x_A)^2+(y_B-y_A)^2 \rightarrow d$ \;
$(x_C-x_B)^2+(y_C-y_B)^2 \rightarrow e$ \;
\eIf{$e=d$}{\KwOut{``the triangle is \dots`` \;}}{\KwOut{``the triangle is not \dots'' \;}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}\end{center}
\begin{enumerate}
\item Que faut-il écrire à la place des pointillés ? Quel est le rôle de cet algorithme ?
\item Proposer une modification de l'algorithme afin qu'il indique si un triangle $ABC$ est isocèle en un des trois sommets.
\end{enumerate}
}


\subsection{Translation (version glissement)}
\exo{\tice\ On s'intéresse à l'algorithme ci-dessous : \\
\begin{minipage}{7.5cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\caption{ }
%\Variable{deux nombres $x$ et $y$}
\Begin{\KwIn{$(x_M,y_M)$ coordinates of a point \;}
$x_M+2\rightarrow x_{M'}$ \;
$y_M+3\rightarrow y_{M'}$ \;
\KwOut{$(x_{M'},y_{M'})$ \;}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\begin{minipage}{8cm}
\begin{enumerate}
 \item Appliquer cet algorithme à chacun des points suivants : $A(1;2)$ ; $B(-2;2)$ ; $C(2;-3)$.
\item Placer les points $A$, $B$, $C$ ainsi que les points $A'$, $B'$, $C'$ dans un repère orthonormé.
 \item Quel semble être le rôle de cet algorithme ?
\end{enumerate}
\end{minipage}}

\newpage
\section{Vecteurs (avec coordonnées)}
\subsection{Reconnaitre un parallélogramme}

\exo{\tice\ Consider the algorithm below :
 \begin{enumerate}
 \item Apply the algorithm in the following situations : 
	\begin{enumerate}
	\item $A(-4,3)$ ; $B(1,5)$ ; $C(3,2)$ ; $D(-2,0)$.
	\item $A(-3,3)$ ; $B(0,5)$ ; $C(3,2)$ ; $D(-2,1)$.
	\end{enumerate}
\end{enumerate}

\begin{multicols}{2}
 \begin{enumerate}\setcounter{enumi}{1}
 \item What is the aim of this algorithm ?
 \item \begin{enumerate}
	\item Apply this algorithm to the points $A(-3,3)$ ; $B(2,3)$ ; $C(2,1)$ ; $D(-3,1)$.
	\item What problem are we facing in this situation ?
	\item Find a way to avoid that problem by modifying a part of the algorithm.
       \end{enumerate}
 \item \begin{enumerate}
	\item Apply this algorithm to the points $A(-2;2)$ ; $B(1;3)$ ; $C(7;5)$ ; $D(4;4)$.
	\item Place the points in a Cartesian coordinate system and check the output of the algorithm. Comment the result.
       \end{enumerate}
%\item This algorithm is not always working. Find some input points for which there is a problem.
\end{enumerate}

\begin{minipage}[t]{8cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$(x_A,y_A)$, $(x_B,y_B)$, $(x_C,y_C)$, $(x_D,y_D)$ coordinates of four points\;}
$x_B-x_A\rightarrow a$ \;
$y_B-y_A\rightarrow b$ \;
$x_C-x_D\rightarrow a'$ \;
$y_C-y_D\rightarrow b'$ \;
$\frac{a}{a'}\rightarrow r_1$ \;
$\frac{b}{b'}\rightarrow r_2$ \;
\eIf{$r_1=r_2=1$}{\KwOut{``$ABCD$ is a parallelogram'' \;}}
{\KwOut{``$ABCD$ is not a parallelogram'' \;}}

}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{multicols}}

\subsection{Reconnaitre colinéarité}
\begin{multicols}{2}
\exo{\tice\ The aim of the algorithm on the right-hand side is to decide if three points are collinear or not.
 \begin{enumerate}
 \item Copy and fill the conditional instruction.
 \item Apply the algorithm to the points $A(-2;-1)$ ; $B(1;1)$ ; $C(7;5)$.
 \item Apply the algorithm to the points $A(-2;5)$ ; $B(2;2)$ ; $C(5;0)$.
 \item What instruction should you add at the beginning of the algorithm to make sure that the three points are distinct ?
\end{enumerate}}
\vfill\ 

\begin{minipage}[t]{8cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$(x_A,y_A)$, $(x_B,y_B)$, $(x_C,y_C)$ coordinates of three distinct points\;}
$x_B-x_A\rightarrow a$ \;
$y_B-y_A\rightarrow b$ \;
$x_C-x_A\rightarrow a'$ \;
$y_C-y_A\rightarrow b'$ \;
$\frac{a}{a'}\rightarrow r_1$ \;
$\frac{b}{b'}\rightarrow r_2$ \;
\eIf{\ldots}{\KwOut{\ldots \;}}
{\KwOut{\ldots \;}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{multicols}

\newpage
\section{Équation de droite}
\subsection{Appartenance d'un point à une droite}

\exo{\tice\ Let's look at the algorithm below.
\begin{center}
\begin{minipage}[t]{12cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$a$, $b$, $c$, ordered coefficients of a line equation\; \quad\quad\quad$(x_M,y_M)$ the coordinates of a point $M$ \;}
$ax_M+by_M+c\rightarrow r$ \;
\eIf{$r=0$}{\KwOut{``The point is on the line.''} \;}
{\KwOut{``The point is not on the line.'' \;}}}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}

Apply the algorithm in each of the following situations. 
\begin{enumerate}
 \item $a=-3$, $b=2$, $c=-7$, $(x_M,y_M)=(-1,2)$ ;
 \item $a=-3$, $b=2$, $c=-7$, $(x_M,y_M)=(30,48)$ ;
 \item $a=5$, $b=11$, $c=-19$, $(x_M,y_M)=(-3,3)$ ;
 \item $a=5$, $b=11$, $c=-19$, $(x_M,y_M)=(-16,9)$ ;
 \item $a=-1$, $b=4$, $c=0$, $(x_M,y_M)=(12,3)$ ;
 \item $a=-1$, $b=4$, $c=0$, $(x_M,y_M)=(-3,-6)$ ;
 \item $a=1$, $b=0$, $c=-7$, $(x_M,y_M)=(7,9)$ ;
 \item $a=1$, $b=0$, $c=-7$, $(x_M,y_M)=(9,7)$.
\end{enumerate}
}

\subsection{Tracer une droite selon equation}

\en
\exo{\tice~In this exercise, we will look at two different ways to use the equation of a line to draw it. In each case, we
must find the coordinates of two points on the line.

\probpart{-- Method 1}

\begin{enumerate}
\item The algorithm below gives a method to draw a line whose equation is known.

\begin{center}\vspace*{-15pt}
	      \begin{minipage}[t]{14.5cm}
	      \IncMargin{1em}
	      \begin{algorithm}[H]
	      \Begin{\KwIn{$ax+by+c=0$, a line equation \;}
		Find the value $y_1$ when $x=0$ \;
		Plot the point $P_1(0,y_1)$ \;
		Find the value $x_2$ when $y=0$ \;
		Plot the point $P_2(x_2,0)$ \;
		Draw the line $(P_1P_2)$ \;
	      }
	      \end{algorithm}
	      \DecMargin{1em}
	      \end{minipage}
	      \end{center}
Apply the algorithm to the line equation $2x+3y-6=0$.
\item Apply the algorithm to draw the line whose equations are given below.
\begin{center}
\begin{tabular}{cccc}
$3x+2y-6=0$ ; &  $y=2x+1$ ; & $y=-x+3.2$ ; & $y=-4x$. \\
%$y=2-\frac{11}{3}x$ & $y=4.7$ & $x=2.9$ & \\
\end{tabular}
\end{center}  

\end{enumerate}


\probpart{-- Method 2}

A new figure will be done for this part.

\begin{enumerate}
\item Consider again the line of equation $2x+3y-6=0$. 
	\begin{enumerate}
	\item What is $y$ when $x=0$ ? Deduce the coordinates of a point on the line.
	\item Choose another value of $x$, not too close to $x=0$, and compute the corresponding value of $y$. Deduce
the coordinates of another point on the line.
	\item Draw the line
	\end{enumerate}
\item Use this method to draw the line whose equations are given below.
\begin{center}
\begin{tabular}{cccc}
$3x+2y-6=0.$ &  $y=2x+1$ & $y=-x+3.2$ & $y=-4x$ \\
%$y=2-\frac{11}{3}x$ & $y=4.7$ & $x=2.9$ & \\
\end{tabular}
\end{center} 
\item Check that the lines drawn with the two methods are the same.
\end{enumerate}
}
\fr




\newpage
\section{Droites parrallèles ou sécantes}
\subsection{Résolution d'un système}

\exo{\tice~The algorithm below is about a system of the form $\syst{ax+b}{c}{a'x+b'y}{c'}$ where $a$, $b$, $c$, $a'$, $b'$ and $c'$ and six real numbers, $x$ and $y$ being the unknows.
\begin{center}
\begin{minipage}[t]{14cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$a$, $b$, $c$, $a'$, $b'$, $c'$, six real numbers \;}
$ad-bc\rightarrow \Delta$ \;
\If{$\Delta \neq 0$}{$\dfrac{cb'-c'b}{\Delta}\rightarrow x$ \;
		      $\dfrac{ac'-a'c}{\Delta}\rightarrow y$ \;		      
		      \KwOut{$x$,$y$ \;}
		     } 
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\begin{enumerate}
 \item \begin{enumerate}
       \item Apply the algorithm to the system $\syst{2x+3y}{7}{3x+2y}{8}$.
       \item Try and find the aim of this algorithm. Check your answer.                                                                                                                                              \end{enumerate}
 \item Same questions with the system $\syst{x+y}{9}{x-y}{-1}$.
 \item Explain the necessity of the condition $ad-bc=0$. What happens for the system in this case ? To answer this question, you could find out a system in which $ad-bc=0$ then draw the lines corresponding to it.
\end{enumerate}
}



\chapter*{Statistique}\addcontentsline{toc}{chapter}{Statistique}
\newpage
\section{Représentation d'une série statistique}
\subsection{Calcul d'une moyenne}

\exo{\tice~On s'intéresse à l'algorithme ci-contre : 
\begin{multicols}{2}
\begin{enumerate}
 \item Appliquer cet algorithme avec $a=13$ et $b=16$.
 \item Que fait cet algorithme ?
 \item Quelles modifications faudrait-il apporter à l'algorithme pour qu'il calcule la moyenne de deux notes l'une
coefficient 2, l'autre coefficient 1 ?
\end{enumerate}
\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{7cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$a$, $b$ two numbers between 0 and 20 \;}
$a+b \rightarrow c$ \;
$\frac{c}{2} \rightarrow m$ \;
\KwOut{$m$ \;}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
\end{multicols}
\begin{enumerate}\setcounter{enumi}{3}
 \item Quelles modifications faudrait-il apporter à l'algorithme pour qu'il calcule la moyenne de deux notes, avec des
coefficients saisis par l'utilisateur ?
\end{enumerate}
}


\newpage
\section{Indicateurs d'une série statistique}
\subsection{Verification de la médiane}

\exo{\tice~{\bf \textsf{An algorithm to check the median}}

\begin{center}\vspace*{-15pt}
\begin{minipage}[t]{12cm}
\IncMargin{1em}
\begin{algorithm}[H]
%\KwData{$(x;y)$  \;}
\Begin{\KwIn{$S$, a statistical series \; 
$n$, the number of values in the series \;
$m$, a possible value for the median \;}
$l$ takes the value $0$ \;
$g$ takes the value $0$ \;
\For{every term $t$ in the series $S$}{
	\eIf{$t\leq m$}{$l$ takes the value $l+1$ \;}{$g$ takes the value $g+1$ \;}
     }
%\KwOut{\eIf{$l\geq\frac{n}{2}$ and $g\geq\frac{n}{2}$}{``$m$ is a median of this series.''}{``$m$ is not a median of this series.''}}}
\eIf{$l\geq\frac{n}{2}$ and $g\geq\frac{n}{2}$}{\KwOut{`$m$ is a median of this series.'' \;}}
						{\KwOut{`$m$ is not a median of this series.'' \;}}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}

\begin{enumerate}
\item After applying this algorithm to a certain statistical series such that $n=13$, we get, at the end of the {\bf for} loop, the values $l=2$ and $m=11$. What will be the output of the algorithm ?
\item In this question, the statistical series entered is $S={2,5,3,7,2,9,8,9,11,3}$.
	\begin{enumerate}
	\item What is the value of $n$ ?
	\item Apply the algorithm with $m=2$, showing the successive values of $l$ and $g$ in a table with two rows. What is the output ?
	\item Apply the algorithm with $m=6$, showing the successive values of $l$ and $g$ in a table with two rows. What is the output ?
	\item Are there other values of $m$ for which the output will be the same as in the previous question ?
	\end{enumerate}
\item How would you modify the algorithm to check the value of the first quartile, instead of the median ?
\end{enumerate}
}

\newpage
\section{Probabilités}
\subsection{Lancés succesifs d'une pièce de monnaie}
\exo{\tice\ A coin is thrown repeatedly, a certain number of times.
\begin{enumerate}
\item If the coin is thrown just once, what is the probability of getting a head ?
\item If the coin is thrown 2 times, what is the probability of getting only heads ?
\item If the coin is thrown 3 times, what is the probability of getting only heads ?
\item If the coin is thrown $n$ times, with $n$ a natural number, what is the probability of getting only heads ?
\item How many times must the coin be thrown so that the probability of getting only heads is less than 0.001 ?
\item Consider the algorithm below :
\begin{center}
\begin{minipage}[t]{12cm}
\IncMargin{1em}
\begin{algorithm}[H]
\Begin{\KwIn{$e$, a real number \;}
$1\rightarrow n$ \;
$0.5\rightarrow p$ \;
\While{$p\geq e$}{$n+1\rightarrow n$ \;
	$0.5^n\rightarrow p$ \;}
\KwOut{$n$ \;}
}
\end{algorithm}
\DecMargin{1em}
\end{minipage}
\end{center}
	\begin{enumerate}
	\item Apply the algorithm with $e=0.1$, with $e=0.01$ and with $e=0.001$.
	\item What is the aim of this algoritm ?
	\item How would you modify the algorithm for a biaised coin, where the probability of getting a head is entered by the user ?
	\end{enumerate}


\end{enumerate}
}



\newpage
\section{Échantillonnage et Simulations}
\subsection{Random walks on an axis}
\exo{\tice~{\bf\textsf{Random walks on an axis}}
% Simulation with the calculator, probabilities, algorithm, margin of error, confidence interval
% 2 hours


\begin{center}
\psset{xunit=2cm,yunit=1cm}
\begin{pspicture}(-3.5,0)(3.5,1)
\psaxes(0,0)(-3.5,0)(3.5,0)
\uput[u](0,0.5){\includegraphics[width=0.7cm]{flea.eps}}
\end{pspicture}
\end{center}

A flea is moving along an axis. It starts from the origin and, after each jump, lands one unit to the right or one unit
to the left, randomly and with the same probability.

A sequence of jumps is called a \emph{walk}. For example, if the flea is always jumping to the right, the walk will be
noted RRRR. If it alternates between right and left, the walk will be noted RLRL.

\probpart{-- Simulations of 4-jumps walks}

The ``Random'' or ``Alea'' function on your calculator delivers a random decimal number between $0$ and $1$.

\begin{enumerate}
\item Devise a method to simulate a 4-jumps walk using the ``Random'' function.
\item Simulate 25 walks and note the final position of the flea at the end of each walk.
\item What are the possible final positions on the axis ? Explain why some are impossible.
\item Count the number of walks for each final position and show the counts in a table.
\item Add a row to the previous table with the absolute frequencies for the whole class.
\item Compute the relative frequencies for the whole class.
\item Compute the average final position of the flea at the end of a 4-jumps walk.
\end{enumerate}


\probpart{-- An algorithm}

\begin{multicols}{2}

A random walk can be described by the algorithm shown on the right-hand side, where the alea function delivers a random
number in the interval $[0,1[$. Parts of the algorithm have been omitted on purpose.

\begin{enumerate}
\item Explain the functions of the integers $x$ and $i$ in this algorithm.
\item Fill the two incomplete lines.
\item Here are the results of applying the algorithm once. What is the final position of the flea at
the end of this walk ?
\begin{center}
\begin{tabular}{c|c|c|c|c|c}
$i$ & & $1$ & $2$ & $3$ & $4$ \\
\hline
alea & & $0.37$ & $0.01$ & $0.93$ & $0.11$ \\
\hline
$x$ & $0$ & $1$ & $2$ & $1$ & $2$ \\
\hline
\end{tabular}
\end{center}
\end{enumerate}

\begin{center}
\begin{minipage}{7cm}\IncMargin{1em}
\begin{algorithm}[H]
\Begin{$0\rightarrow x$ \;
    $1\rightarrow i$ \;
    \While{$i\leq 4$}{
    \eIf{alea < $0.5$}{
      	$\ldots\ldots\ldots\rule{0pt}{15pt} \rightarrow x$ \;
      	}{
      	$\ldots\ldots\ldots\rule{0pt}{15pt} \rightarrow x$ \;
      	}
	$i+1\rightarrow i$ \;
	}
   \KwOut{$x$ \;}
}
\end{algorithm}\DecMargin{1em}
\end{minipage}
\end{center}

\end{multicols}

\begin{enumerate}\setcounter{enumi}{3}
\item Apply the algorithm to create five new walks, using the random function of your calculator and displaying all the
steps of the algorithm like in the example of the previous question.
\item How would you change the algorithm to simulate a $30$-jumps walk ?
\end{enumerate}



\probpart{-- Probabilistic study}

In this part, we will use probabilities to study the situation and compare the theoretical results to the frequencies
we found in part A.

\begin{enumerate}
\item Draw a tree to show all the possible 4-jumps walks. At the end of each branch, write the final position of the
flea.
\item Use the tree to compute the probability of each final position and give the results in a probability table.
\item Compute the margin of error at $95\%$ confidence for your sample of 25 random walks.
\item For each probability, count in the class how many samples of 25 walks gave a frequency within the margin of error.
\end{enumerate}
}

\subsection{A birth policy}
\exo{\tice~{\bf\textsf{A birth policy}}
% Simulation, algorithm, sampling, margin of error, confidence interval
% 2 hours
\vspace*{-10pt}
\begin{multicols}{2}

A government has decided to impose a strict birth policy. Births in a family must stop as soon as a boy is born or
after the birth of the fourth child.

We consider in this exercise that the probabilities of giving birth to a girl or a boy are equal and that each birth is
independant from the previous births in the same family.

This birth policy can be represented as a tree, where the possible families are boxed.\par

\begin{center}
\begin{tabular}{c@{\hskip 0.1cm}c@{\hskip 0.1cm}c@{\hskip 0.1cm}c@{\hskip 0.1cm}c@{\hskip 0.1cm}c}
    & \rnode{n1}{$\emptyset$} & & & & \\[0.5cm]
    \rnode{n21}{\fbox{B}} & & \rnode{n22}{G} & & & \\[0.5cm]
    & \rnode{n31}{\fbox{GB}} & & \rnode{n32}{GG} & & \\[0.5cm]
    & & \rnode{n41}{\fbox{GGB}} & & \rnode{n42}{GGG} & \\[0.5cm]
    & & & \rnode{n51}{\fbox{GGGB}} & & \rnode{n52}{\fbox{GGGG}}\\
\end{tabular}
\end{center}

\psset{nodesep=2pt} \ncline{->}{n1}{n21} \ncline{->}{n1}{n22}
\ncline{->}{n22}{n31} \ncline{->}{n22}{n32} \ncline{->}{n32}{n41}
\ncline{->}{n32}{n42} \ncline{->}{n42}{n51} \ncline{->}{n42}{n52}

\end{multicols}


\probpart{-- Simulation and statistical approach}


\begin{enumerate}
\item Discuss in the class to conjecture a value for the percentage of girls generated by this policy.
\item Devise a method to simulate the composition of a family with the calculator.
\item Simulate and write down the composition of 100 families. Count the number of children per family and show the
results in a table with absolute and relative frequencies.
\item Compute the arithmetic mean $m_4$ and the median $d_4$ for the number of children per family in your sample of
$100$ families.
\item Compute the arithmetic mean $M_4$ and the median $D_4$ for all the families in the class.
\end{enumerate}


\probpart{-- An algorithm}

\begin{multicols}{2}

This process can be described as an algorithm. The output is then a list of digits, with $0$ representing a girl and $1$
representing a boy.
\begin{enumerate}
\item Explain the functions of the whole numbers $x$ and $i$ in this algorithm.
\item Explain the condition ``$x\neq 1$ and $i\leq 4$''. Does it ensure that the algorithm will always stop ?
\item What is the function of the list $L$ in this algorithm ?
\item Explain the notation $L(i)$.
\end{enumerate}


\begin{center}
\begin{minipage}{7cm}\IncMargin{1em}
\begin{algorithm}[H]
  \Begin{
  Clear list $L$ ; $0\rightarrow x$ ; $1\rightarrow i$ \;
  \While{$x\neq 1$ and $i\leq 4$}{
    \eIf{alea < $0.5$}{
      	$0\rightarrow x$ \;
      	}{
      	$1\rightarrow x$ \;
      	}
      	$x\rightarrow L(i)$ \;
      	$i+1\rightarrow i$ \;
	}
   \KwOut{$L$ \;}}
\end{algorithm}\DecMargin{1em}
\end{minipage}
\end{center}
\end{multicols}

\begin{multicols}{2}
\begin{enumerate}\setcounter{enumi}{4}
\item Here are the results of applying the algorithm once.
Apply the algorithm to get 5 families, displaying all the
steps of the algorithm like in the example. 
\end{enumerate}

\begin{center}
\begin{tabular}{c|c|c|c|c}
$i$ & & $1$ & $2$ & $3$ \\
\hline
alea & & $0.37$ & $0.01$ & $0.93$ \\
\hline
$x$ & $0$ & $0$ & $0$ & $1$ \\
\hline
$L$ & $()$ & $(0)$ & $(0,0)$ & $(0,0,1)$ \\
\hline
\end{tabular}
\end{center}

\end{multicols}

\probpart{-- The percentage of girls}

The aim of this part is to study the percentage of girls $g$ induced by this birth policy, and therefore check the
answer to the first question of part A. To do so, we will first use the simulations of part A, and then the
probabilities of part C.  

\begin{enumerate}
\item Use the value conjectured by the class at the beginning of the exercise to compute the fluctuation interval at
$95\%$ confidence in a sample of 100 families.
\item Compute the percentage of girls in your 100 simulated families. According to this result, would you reject the
hypothesis formulated by the class ?
\item Answer the previous questions with the sample made of all the families simulated in the class. Is the conclusion
the same ?
\end{enumerate}


\probpart{-- Probabilistic study}

\begin{enumerate}
\item Copy the tree at the beginning of the exercise and add the probabilities.
\item Compute the probability of each type of family.
\item Show in a table the possible numbers of children and their probabilities. Are these probabilities consistent
with the frequencies found at the end of part A ?
\item Use the table to compute the expected value for the number of children in a family.
\item Compute the expected values of the numbers of girls and boys in a family. Deduce the theoretical proportion of
girls. Was your initial hypothesis correct ?
\end{enumerate}




}


\subsection{Random walks on a tetrahedron}

\exo{\tice~{\bf\textsf{Random walks on a tetrahedron}}
% Simulation, probabilities, margin of error, confidence interval
% 2h

\begin{minipage}{10cm}
An ant is walking on the edges of a tetrahedron $ABCD$, starting from vertex $A$. When it gets to a vertex, it chooses
randomly the next edge it will walk on. The aim of this exercise is to study the time it will take for the ant to go
back to vertex $A$, assuming that it walks along one edge in exactly 1 minute.
\end{minipage}
\begin{minipage}{5.6cm}
    \begin{center}
    \psset{unit=0.6cm}
    \pspicture(0,0.5)(7,5.5)
    \pspolygon(1,2)(5,1)(6,3)(3,5)
    \psline(5,1)(3,5)
    \psline[linestyle=dashed](1,2)(6,3)
    \cput(0.5,2){$A$}
    \uput[d](5,1){$B$}
    \uput[r](6,3){$C$}
    \uput[u](3,5){$D$}
    \endpspicture
    \end{center}
\end{minipage}

A walk will be noted as a succession of vertices, as in the example below :
$$A\rightarrow D\rightarrow B\rightarrow C\rightarrow A.$$

A walk will always start from $A$ and stop as soon as the ant comes back to $A$.



\probpart{-- Simulations}

\begin{enumerate}
\item Devise a method to simulate a random walk.
\item Simulate 25 random walks and count the duration of each one. Gather the data in a table with the absolute
frequency of each duration (from 1 to 20 minutes).
\item Explain the value in the column for 1 minute.
\item Is the duration necessarily less than 20 minutes ?
\item Find out the minimum, maximum, range, mean and median of this data.
\item Carry out the previous computations for all the simulated walks in the class.
\end{enumerate}

\probpart{-- Probabilistic study}

We can illustrate the situation with a probabilistic graph. The vertices B, C, D, for which
the walk doesn't end, have been gathered as a single vertex noted BCD.
From vertex A, the only possibility is to go to BCD, while from BCD it's possible to go to A or stay in BCD.

\begin{center}
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=*,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt
2,arrowinset=0.25}
\begin{pspicture*}(-0.72,-0.4)(7.66,2.68)
\pscircle(0.22,1.04){0.46}
\rput{-0.73}(4.71,1.03){\psellipse(0,0)(0.92,0.47)}
\rput[tl](0.08,1.22){A}
\rput[tl](4.32,1.20){BCD}
\parametricplot{1.0305922595526105}{2.1616224923228797}{
1*2.95*cos(t)+0*2.95*sin(t)+2.36|0*2.95*cos(t)+1*2.95*sin(t)+-0.97}
\parametricplot{4.19943498692105}{5.199866644868201}{1*3.27*cos(t)+0*3.27*sin(t)+2.33|0*3.27*cos(t)+1*3.27*sin(t)+3.47}
\parametricplot{-2.7287925292108506}{2.603954909218935}{1*0.7*cos(t)+0*0.7*sin(t)+6.34|0*0.7*cos(t)+1*0.7*sin(t)+0.92}
\psline{->}(0.97,1.63)(0.68,1.4)
\psline{->}(3.66,0.48)(3.94,0.64)
\psline{->}(5.79,0.49)(5.62,0.76)
\end{pspicture*}
    \end{center}

\begin{enumerate}
\item Compute the probabilities to go to A and to stay in BCD when you are in BCD. Write theses probabilities on the
edges of the graph.
\item Build a probability tree to illustrate a four-steps random walk. 
\item Compute the probabilities of a 2-minutes, a 3-minutes and a 4-minutes walk.
\item Without adding a level to the tree, conjecture a value for the probability of a 5-minutes walk. Deduce the
probability of a walk lasting 5 minutes or less.
\end{enumerate}}


\end{document}




