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

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

\xsimsetup{
    solution/print = false
}

\begin{document}

\begin{exercise}[subtitle={Réductions}]
    Développer puis réduire les expressions suivantes
    \begin{multicols}{3}
        \begin{enumerate}[label={\Alph*=}]
            %- set a = Expression.random("{a}x + {b} + {c}x + {d}")
            \item $\Var{a}$
            %- set b = Expression.random("{a}x + {b} + {c}x + {d}")
            \item $\Var{b}$

            %- set c = Expression.random("{a}x^2 + {b} + {c}x^2 + {d} + {d}x + {e}")
            \item $\Var{c}$
            %- set d = Expression.random("{a}x + {b} + {c}x + {d} + {e}x + {f}x")
            \item $\Var{d}$

                %- set e = Expression.random("{a}*x + {b} + {c}x + {d}x + {e}", min_max=(2, 20))
            \item $\Var{e}$
            %- set f = Expression.random("{a}x + {b} + {c}x + {d}", conditions=["a+c==0"])
            \item $\Var{f}$
        \end{enumerate}
    \end{multicols}
\end{exercise}

\begin{solution}
    \begin{multicols}{3}
        \begin{flalign*}
            A =& \Var{a.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            B =& \Var{b.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            C =& \Var{c.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            D =& \Var{d.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            E =& \Var{e.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            F =& \Var{f.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
    \end{multicols}
\end{solution}

\begin{exercise}[subtitle={Simple développement}]
    Développer puis réduire les expressions suivantes
    \begin{multicols}{3}
        \begin{enumerate}[label={\Alph*=}]
            %- set a = Expression.random("{a}*(x + {b})", rejected=[-1,0,1])
            \item $\Var{a}$
                %- set b = Expression.random("{a}*({c}x + {d})", rejected=[-1,0,1])
            \item $\Var{b}$
                %- set c = Expression.random("{a}*({c}x + {d})", rejected=[-1,0,1])
            \item $\Var{c}$

                %- set d = Expression.random("{c}*x*({a}x + {b})", rejected=[-1,0,1])
            \item $\Var{d}$
                %- set e = Expression.random("{a}*x*({b}x + {c}) + {d}", rejected=[-1,0,1])
            \item $\Var{e}$
                %- set f = Expression.random("{c}*x + {d}*x*({a}x + {b})", rejected=[-1,0,1])
            \item $\Var{f}$
        \end{enumerate}
    \end{multicols}
\end{exercise}

\begin{solution}
    \begin{multicols}{3}
        \begin{flalign*}
            A =& \Var{a.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            B =& \Var{b.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            C =& \Var{c.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            D =& \Var{d.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            E =& \Var{e.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            F =& \Var{f.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
    \end{multicols}
\end{solution}

\begin{exercise}[subtitle={Double développement}]
    Développer puis réduire les expressions suivantes
    \begin{multicols}{3}
        \begin{enumerate}[label={\Alph*=}]
            %- set a = Expression.random("(x + {a})*(x + {b})", rejected=[-1,0,1])
            \item $\Var{a}$
                %- set b = Expression.random("({a}x + {b})*({c}x + {d})", rejected=[-1,0,1])
            \item $\Var{b}$
                %- set c = Expression.random("({a}x + {b})*({c}x + {d})", rejected=[-1,0,1])
            \item $\Var{c}$

                %- set d = Expression.random("({c}*x + {d})*({a}x + {b})", rejected=[-1,0,1])
            \item $\Var{d}$
                %- set e = Expression.random("({b}x + {c})^2", rejected=[-1,0,1])
            \item $\Var{e}$
                %- set f = Expression.random("({a}x + {b})^2", rejected=[-1,0,1])
            \item $\Var{f}$
        \end{enumerate}
    \end{multicols}
\end{exercise}

\begin{solution}
    \begin{multicols}{3}
        \begin{flalign*}
            A =& \Var{a.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            B =& \Var{b.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            C =& \Var{c.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            D =& \Var{d.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            E =& \Var{e.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            F =& \Var{f.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
    \end{multicols}
\end{solution}

\begin{exercise}[subtitle={Double développement}]
    Développer puis réduire les expressions suivantes
    \begin{multicols}{3}
        \begin{enumerate}[label={\Alph*=}]
            %- set a = Expression.random("{a}*x + {c}/{b} + {c}*x + {d}/{b}", rejected=[-1,0,1])
            \item $\Var{a}$
                %- set b = Expression.random("{c}({a}x + {b}/{d})", rejected=[-1,0,1])
            \item $\Var{b}$
                %- set c = Expression.random("({a}/{b}x + {b})*({c}x + {d}/{e})", rejected=[-1,0,1])
            \item $\Var{c}$

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

\begin{solution}
    \begin{multicols}{3}
        \begin{flalign*}
            A =& \Var{a.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            B =& \Var{b.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
        \begin{flalign*}
            C =& \Var{c.simplify().explain() | join('\\\ =& ')}
        \end{flalign*}
    \end{multicols}
\end{solution}

\printcollection{exercise}

\newpage

\printsolutionstype{exercise}

\end{document}
