\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}

\author{Benjamin Bertrand}
\title{Information chiffrée 1 - Exercices}
\date{Septembre 2021}

\begin{document}
\maketitle

\begin{exercise}[subtitle={Égalité de fractions}]
    Déterminer les valeurs manquantes
    \begin{multicols}{4}
        \begin{enumerate}[label=\alph*)]
            %- set A = random_list(["a", "b", "a*c", "b*c"], conditions = ["a != b"], min_max=(2, 9), rejected=[0, 1])
            \item $\dfrac{\Var{A[0]}}{\Var{A[1]}} = \dfrac{\ldots}{\Var{A[3]}}$
                %- set B = random_list(["a", "b", "a*c", "b*c"], conditions = ["a != b"], min_max=(2, 9), rejected=[0, 1])
            \item $\dfrac{\Var{B[0]}}{\Var{B[1]}} = \dfrac{\ldots}{\Var{B[3]}}$
                %- set C = random_list(["a", "b", "a*c", "b*c"], conditions = ["a != b", "a*b>0"], min_max=(-9, 9), rejected=[0, 1])
            \item $\dfrac{\Var{C[0]}}{\Var{C[1]}} = \dfrac{\ldots}{\Var{C[3]}}$
                %- set D = random_list(["a", "b", "a*c", "b*c"], conditions = ["a != b", "a*b<0"], min_max=(-9, 9), rejected=[0, 1])
            \item $\dfrac{\Var{D[0]}}{\Var{D[1]}} = \dfrac{\ldots}{\Var{D[3]}}$
        \end{enumerate}
    \end{multicols}       
\end{exercise}

\begin{solution}
    \begin{multicols}{4}
        \begin{enumerate}[label=\alph*)]
            \item $\dfrac{\Var{A[0]}}{\Var{A[1]}} = \dfrac{\Var{A[2]}}{\Var{A[3]}}$
            \item $\dfrac{\Var{B[0]}}{\Var{B[1]}} = \dfrac{\Var{B[2]}}{\Var{B[3]}}$
            \item $\dfrac{\Var{C[0]}}{\Var{C[1]}} = \dfrac{\Var{C[2]}}{\Var{C[3]}}$
            \item $\dfrac{\Var{D[0]}}{\Var{D[1]}} = \dfrac{\Var{D[2]}}{\Var{D[3]}}$
        \end{enumerate}
    \end{multicols}       
\end{solution}

\begin{exercise}[subtitle={Comparaison}]
    Comparer les fractions suivantes
    \begin{multicols}{4}
        \begin{enumerate}[label=\alph*)]
            %- set A1 = Fraction.random()
            %- set A2 = Fraction.random()
            \item $\Var{A1}$ et $\Var{A2}$
            %- set B1 = Fraction.random()
            %- set B2 = Fraction.random()
            \item $\Var{B1}$ et $\Var{B2}$
            %- set C1 = Fraction.random()
            %- set C2 = Fraction.random()
            \item $\Var{C1}$ et $\Var{C2}$
            %- set D1 = Fraction.random()
            %- set D2 = Fraction.random()
            \item $\Var{D1}$ et $\Var{D2}$
        \end{enumerate}
    \end{multicols}       
\end{exercise}

\begin{solution}
    \begin{multicols}{4}
        \begin{enumerate}[label=\alph*)]
            \item 
                %- if A1 > A2 
                $\Var{A1}$ > $\Var{A2}$
                %- elif A1 < A2
                $\Var{A1}$ < $\Var{A2}$
                %- else
                $\Var{A1}$ = $\Var{A2}$
                %- endif
            \item 
                %- if B1 > B2 
                $\Var{B1}$ > $\Var{B2}$
                %- elif B1 < B2
                $\Var{B1}$ < $\Var{B2}$
                %- else
                $\Var{B1}$ = $\Var{B2}$
                %- endif
            \item 
                %- if C1 > C2 
                $\Var{C1}$ > $\Var{C2}$
                %- elif C1 < C2
                $\Var{C1}$ < $\Var{C2}$
                %- else
                $\Var{C1}$ = $\Var{C2}$
                %- endif
            \item 
                %- if D1 > D2 
                $\Var{D1}$ > $\Var{D2}$
                %- elif D1 < D2
                $\Var{D1}$ < $\Var{D2}$
                %- else
                $\Var{D1}$ = $\Var{D2}$
                %- endif
        \end{enumerate}
    \end{multicols}       
\end{solution}


\begin{exercise}[subtitle={Additions}]
    Faire les calculs suivants
    \begin{multicols}{4}
        \begin{enumerate}[label={\Alph*=}]
            %- set A = Expression.random("{a} / {b} + {c} / {b}", ["a!=b", "c!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{A}$
            %- set B = Expression.random("{a} / {b} + {c} / {b}", ["a!=b", "c!=b", "b > 1"], min_max=(-10, 10))
            \item $\Var{B}$
            %- set C = Expression.random("{a} / {b} + {c}", ["a!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{C}$
            %- set D = Expression.random("{a} / {b} + {c}", ["a!=b", "b > 1"], min_max=(-10, 10))
            \item $\Var{D}$

            %- set E = Expression.random("{a} / {b} + {c} / {k*b}", ["a!=b", "c!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{E}$
            %- set F = Expression.random("{a} / {b} + {c} / {k*b}", ["a!=b", "c!=b", "b > 1", "k > 1"], min_max=(-10, 10))
            \item $\Var{F}$
            %- set G = Expression.random("{a} / {b} + {c} / {d}", ["a!=b", "c!=d", "b > 1", "d > 1"], min_max=(0, 10))
            \item $\Var{G}$
            %- set H = Expression.random("{a} / {b} + {c} / {d}", ["a!=b", "c!=d", "b > 1", "d > 1"], min_max=(-10, 10))
            \item $\Var{H}$

        \end{enumerate}
    \end{multicols}
\end{exercise}

\begin{solution}
        \begin{enumerate}[label={\Alph*=}]
            \item $\Var{A.simplify().explain() | join('=')}$
            \item $\Var{B.simplify().explain() | join('=')}$
            \item $\Var{C.simplify().explain() | join('=')}$
            \item $\Var{D.simplify().explain() | join('=')}$

            \item $\Var{E.simplify().explain() | join('=')}$
            \item $\Var{F.simplify().explain() | join('=')}$
            \item $\Var{G.simplify().explain() | join('=')}$
            \item $\Var{H.simplify().explain() | join('=')}$
        \end{enumerate}
\end{solution}


\begin{exercise}[subtitle={Multiplications}]
    Faire les calculs suivants
    \begin{multicols}{4}
        \begin{enumerate}[label={\Alph*=}]
            %- set A = Expression.random("{a} / {b} * {c}", ["a!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{A}$
            %- set B = Expression.random("{a} / {b} * {c}", ["a!=b", "b > 1"], min_max=(-10, 10))
            \item $\Var{B}$
            %- set C = Expression.random("{a} / {b} * {c} / {b}", ["a!=b", "c!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{C}$
            %- set D = Expression.random("{a} / {b} * {c} / {b}", ["a!=b", "c!=b", "b > 1"], min_max=(-10, 10))
            \item $\Var{D}$

            %- set E = Expression.random("{a} / {b} * {c} / {k*b}", ["a!=b", "c!=b", "b > 1"], min_max=(1, 10))
            \item $\Var{E}$
            %- set F = Expression.random("{a} / {b} * {c} / {k*b}", ["a!=b", "c!=b", "b > 1", "k > 1"], min_max=(-10, 10))
            \item $\Var{F}$
            %- set G = Expression.random("{a} / {b} * {c} / {d}", ["a!=b", "c!=d", "b > 1", "d > 1"], min_max=(0, 10))
            \item $\Var{G}$
            %- set H = Expression.random("{a} / {b} * {c} / {d}", ["a!=b", "c!=d", "b > 1", "d > 1"], min_max=(-10, 10))
            \item $\Var{H}$

        \end{enumerate}
    \end{multicols}
\end{exercise}


\begin{solution}
    \begin{multicols}{2}
        \begin{enumerate}[label={\Alph*=}]
            \item $\Var{A.simplify().explain() | join('=')} = \Var{A.simplify().simplify()}$
            \item $\Var{B.simplify().explain() | join('=')} = \Var{B.simplify().simplify()}$
            \item $\Var{C.simplify().explain() | join('=')} = \Var{C.simplify().simplify()}$
            \item $\Var{D.simplify().explain() | join('=')} = \Var{D.simplify().simplify()}$

            \item $\Var{E.simplify().explain() | join('=')} = \Var{E.simplify().simplify()}$
            \item $\Var{F.simplify().explain() | join('=')} = \Var{F.simplify().simplify()}$
            \item $\Var{G.simplify().explain() | join('=')} = \Var{G.simplify().simplify()}$
            \item $\Var{H.simplify().explain() | join('=')} = \Var{H.simplify().simplify()}$
        \end{enumerate}
        
    \end{multicols}
\end{solution}

\pagebreak

\printsolutions
% 
% \section{Ajouts de fractions}
% 
% \begin{itemize}
%     \item Fraction avec le même dénominateur
%         \Block{set e = Expression.random("{a} / {b} + {c} / {b}", ["b > 1"], min_max=(1, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% 
%     \item Fraction avec un denominateur multiple de l'autre
%         \Block{set e = Expression.random("{a} / {b} + {c} / {b*d}", ["b > 1","d > 1"], min_max=(1, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% 
%     \item Une fraction et un entier
%         \Block{set e = Expression.random("{a} / {b} + {c}", ["b > 1"], min_max=(1, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% 
% \end{itemize}
% 
% 
% \section{Multiplications de fractions}
% \begin{itemize}
%     \item Une fraction et un entier
%         \Block{set e = Expression.random("{c} * {a} / {b}", min_max=(2, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% 
%     \item Fraction avec des dénominateurs quelconques
%         \Block{set e = Expression.random("{a} / {b} * {c} / {d}", ["b > 1","d > 1"], min_max=(1, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% \end{itemize}
% 
% 
% \section{Division de fractions}
% \begin{itemize}
%     \item Une fraction et un entier
%         \Block{set e = Expression.random("{c} / {a} / {b}", min_max=(2, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% 
%     \item Fraction avec des dénominateurs quelconques
%         \Block{set e = Expression.random("({a} / {b}) / ({c} / {d})", ["a != b", "c!= d", "b > 1","d > 1"], min_max=(1, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% \end{itemize}
% 
% \section{Tout mélangé}
% \begin{itemize}
%     \item 
%         \Block{set e = Expression.random("{d}/{e}*({c} / {a} + {b})", min_max=(2, 10))}
%         \begin{align*}
%             A = \Var{e}
%         \end{align*}
%         Solution 
%         \begin{align*}
%             \Var{e.simplify().explain() | join('=')}
%         \end{align*}
% \end{itemize}

\end{document}
