Import work from year 2013-2014

This commit is contained in:
Benjamin Bertrand
2017-06-16 09:46:40 +03:00
commit 32262a4ecf
1788 changed files with 113187 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
\documentclass[a4paper,10pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{%{{infos.subj%}}}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\begin{document}
\maketitle
Le barème est donné à titre indicatif, il pourra être modifié.
\begin{Exo}[4]
Dire si les triangles suivants sont rectangles. S'ils sont rectangles, préciser quel est l'angle droit et quel est l'hypoténuse.
\begin{enumerate}
\item Le triangle $ABC$ dessiné ci-dessous
\begin{center}
\includegraphics[scale=0.3]{./fig/triangle%{{infos.subj%}}}
\end{center}
\item Le triangle $EFG$ tel que $EF = 9m$, $FG = 40m$ et $GE = 41m$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{eqnarray*}
A & = & %{{ exo.add_frac1() %}} \\
B & = & %{{ exo.add_frac3() %}} \\
C & = & %{{ exo.mult_frac1() %}} \\
D & = & %{{ exo.mult_frac2() %}}
\end{eqnarray*}
\end{Exo}
\begin{Exo}[5]
Voici la recette du cocktail Apple Fizz pour 3 personnes
\begin{itemize}
\item 3 cuillères à café de sucre vanillé
\item $\frac{3}{50}$L de jus de citron
\item $\frac{1}{4}$L de jus de pomme.
\item 2 cuillères à café de cannelle en poudre
\item 3 tranches de pomme
\end{itemize}
Répondre aux questions suivantes en donnant le résultat sous forme de \textbf{fraction} en explicitant les calculs.
\begin{enumerate}
\item Quelle est la quantité d'éléments liquides dans ce cocktail?
\item Quelle quantité de jus de citron faut-il pour faire ce cocktail pour 15 personnes?
\item Quelle quantité de jus de pomme faut-il pour faire ce cocktail pour 2 personnes?
\item On décide de personnaliser un peu la recette en ajoutant $\frac{4}{15}$ L de jus de poire à la recette. Quelle est la quantité d'éléments liquides dans cette nouvelle recette?
\end{enumerate}
\end{Exo}
\begin{Exo}[2]
Évaluer les expressions suivantes:
\begin{eqnarray*}
%{{ exo.exp1(letter = "A")%}} \\
%{{ exo.exp2(letter = "B") %}}
\end{eqnarray*}
\end{Exo}
\pagebreak
\begin{Exo}
\exo{Bonus}
On crée des motifs de la façon suivante:
\begin{center}
\includegraphics[scale=0.3]{./fig/carre.pdf}
\end{center}
\begin{enumerate}
\item Dessiner le motif 4 et 5. Combien y a-t-il de petits carrés sur chacune de ces figures?
\item Combien de petits carrés y a-t-il dans le motif $n$?
\item Combien de petits carrés y a-t-il dans le motif 10 000?
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

Binary file not shown.

View File

@@ -0,0 +1,88 @@
\documentclass[a4paper,10pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{1}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\begin{document}
\maketitle
Le barème est donné à titre indicatif, il pourra être modifié.
\begin{Exo}[4]
Dire si les triangles suivants sont rectangles. S'ils sont rectangles, préciser quel est l'angle droit et quel est l'hypoténuse.
\begin{enumerate}
\item Le triangle $ABC$ dessiné ci-dessous
\begin{center}
\includegraphics[scale=0.3]{./fig/triangle1}
\end{center}
\item Le triangle $EFG$ tel que $EF = 9m$, $FG = 40m$ et $GE = 41m$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{eqnarray*}
A & = & \frac{9}{10}-\frac{-13}{10} \\
B & = & -\frac{11}{5}-\frac{-2}{6} \\
C & = & 10 \times \frac{-1}{13} \\
D & = & -9 \times \frac{-2}{11} + \frac{1}{11}
\end{eqnarray*}
\end{Exo}
\begin{Exo}[5]
Voici la recette du cocktail Apple Fizz pour 3 personnes
\begin{itemize}
\item 3 cuillères à café de sucre vanillé
\item $\frac{3}{50}$L de jus de citron
\item $\frac{1}{4}$L de jus de pomme.
\item 2 cuillères à café de cannelle en poudre
\item 3 tranches de pomme
\end{itemize}
Répondre aux questions suivantes en donnant le résultat sous forme de \textbf{fraction} en explicitant les calculs.
\begin{enumerate}
\item Quelle est la quantité d'éléments liquides dans ce cocktail?
\item Quelle quantité de jus de citron faut-il pour faire ce cocktail pour 15 personnes?
\item Quelle quantité de jus de pomme faut-il pour faire ce cocktail pour 2 personnes?
\item On décide de personnaliser un peu la recette en ajoutant $\frac{4}{15}$ L de jus de poire à la recette. Quelle est la quantité d'éléments liquides dans cette nouvelle recette?
\end{enumerate}
\end{Exo}
\begin{Exo}[2]
Évaluer les expressions suivantes:
\begin{eqnarray*}
A = -7x + 6 & \mbox{avec} & x = 9 \\
B = -9x(8x + 9) & \mbox{avec} & x = 5
\end{eqnarray*}
\end{Exo}
\pagebreak
\begin{Exo}
\exo{Bonus}
On crée des motifs de la façon suivante:
\begin{center}
\includegraphics[scale=0.3]{./fig/carre.pdf}
\end{center}
\begin{enumerate}
\item Dessiner le motif 4 et 5. Combien y a-t-il de petits carrés sur chacune de ces figures?
\item Combien de petits carrés y a-t-il dans le motif $n$?
\item Combien de petits carrés y a-t-il dans le motif 10 000?
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

Binary file not shown.

View File

@@ -0,0 +1,88 @@
\documentclass[a4paper,10pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{1}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\begin{document}
\maketitle
Le barème est donné à titre indicatif, il pourra être modifié. Des points sont réservés à la présentation et à la rédaction.
\begin{Exo}[4]
Dire si les triangles suivants sont rectangles. S'ils sont rectangles, préciser quel est l'angle droit et quel est l'hypoténuse.
\begin{enumerate}
\item Le triangle $ABC$ dessiné ci-dessous
\begin{center}
\includegraphics[scale=0.3]{./fig/triangle1}
\end{center}
\item Le triangle $EFG$ tel que $EF = 0,9m$, $FG = 4m$ et $GE = 4,1m$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{eqnarray*}
A & = & \frac{9}{10}-\frac{-13}{10} \\
B & = & -\frac{11}{5}-\frac{-2}{6} \\
C & = & 10 \times \frac{-1}{13} \\
D & = & -9 \times \frac{-2}{11} + \frac{1}{11}
\end{eqnarray*}
\end{Exo}
\begin{Exo}[5]
Voici la recette du cocktail Apple Fizz pour 3 personnes
\begin{itemize}
\item 3 cuillères à café de sucre vanillé
\item $\frac{3}{50}$L de jus de citron
\item $\frac{1}{4}$L de jus de pomme.
\item 2 cuillères à café de cannelle en poudre
\item 3 tranches de pomme
\end{itemize}
Répondre aux questions suivantes en donnant le résultat sous forme de \textbf{fraction} en explicitant les calculs.
\begin{enumerate}
\item Quelle est la quantité d'éléments liquides dans ce cocktail?
\item Quelle quantité de jus de citron faut-il pour faire ce cocktail pour 15 personnes?
\item Quelle quantité de jus de pomme faut-il pour faire ce cocktail pour 2 personnes?
\item On décide de personnaliser un peu la recette en ajoutant $\frac{4}{15}$ L de jus de poire à la recette. Quelle est la quantité d'éléments liquides dans cette nouvelle recette?
\end{enumerate}
\end{Exo}
\begin{Exo}[3]
Évaluer les expressions suivantes:
\begin{eqnarray*}
A = -7x^2 + 2x + 6 & \mbox{avec} & x = 9 \\
B = -9x(8x + 9) & \mbox{avec} & x = 5
\end{eqnarray*}
\end{Exo}
\pagebreak
\begin{Exo}
\exo{Bonus}
On crée des motifs de la façon suivante:
\begin{center}
\includegraphics[scale=0.3]{./fig/carre.pdf}
\end{center}
\begin{enumerate}
\item Dessiner le motif 4 et 5. Combien y a-t-il de petits carrés sur chacune de ces figures?
\item Combien de petits carrés y a-t-il dans le motif $n$?
\item Combien de petits carrés y a-t-il dans le motif 10 000?
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

View File

@@ -0,0 +1,175 @@
\documentclass[a4paper,12pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{1}
% DS DSCorr DM DMCorr Corr
\typedoc{DSCorr}
\begin{document}
\maketitle
\begin{Exo}[4]
\begin{enumerate}
\item Vérifions si le triangle $ABC$ est rectangle:
\begin{eqnarray*}
AB^2 & = & 15\times15 = 225 \\
AC^2 & = & 17\times17 = 289 \\
BC^2 & = & 7 \times 7 = 49
\end{eqnarray*}
On ajoute le carré des longueurs des deux plus petits côtés: $AB^2 + BC^2 = 225 + 49 = 274 \neq 289 = AC^2$. Donc d'après le théorème de Pythagore, \textbf{le triangle $ABC$ n'est pas rectangle.}
\item Vérifions si le triangle $EFG$ est rectangle:
\begin{eqnarray*}
EF^2 & = & 0.9\times0.9 = 0.81 \\
FG^2 & = & 4\times4 = 16\\
GE^2 & = & 4.1 \times 4.1 = 16.81
\end{eqnarray*}
On ajoute le carré des longueurs des deux plus petits côtés: $EF^2 + FG^2 = 0.81 + 16 = 16.81 = GE^2$. Donc d'après le théorème de Pythagore, le triangle $EFG$ est rectangle en $F$. Et l'hypoténuse est $[GE]$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{minipage}[h]{0.5\textwidth}
\begin{eqnarray*}
A & = & \frac{9}{10}-\frac{-13}{10} \\
A & = & \frac{ 9 - (-13) }{ 10 } \\
A & = & \frac{ 9 + 13 }{ 10 } \\
A & = & \frac{ 22 }{ 10 } \\
A & = & \frac{ 11 \times 2 }{ 5 \times 2 } \\
A & = & \frac{ 11 }{ 5 }
\end{eqnarray*}
\end{minipage}
\begin{minipage}[h]{0.5\textwidth}
\begin{eqnarray*}
B & = & -\frac{11}{5}-\frac{-2}{6} \\
B & = & \frac{-11 \times 6}{5 \times 6} - \frac{-2 \times 5}{6 \times 5} \\
B & = & \frac{-66}{30} - \frac{-10}{30} \\
B & = & \frac{-66 - (-10)}{30} \\
B & = & \frac{-56}{30} \\
B & = & \frac{-28 \times 2}{15 \times 2} \\
B & = & \frac{-28}{15}
\end{eqnarray*}
\end{minipage}
\begin{minipage}[h]{0.5\textwidth}
\begin{eqnarray*}
C & = & 10 \times \frac{-1}{13} \\
C & = & \frac{ 10 \times ( -10 ) }{ 13 } \\
C & = & \frac{ -100 }{ 13 }
\end{eqnarray*}
\end{minipage}
\begin{minipage}[h]{0.5\textwidth}
\begin{eqnarray*}
D & = & -9 \times \frac{-2}{11} + \frac{1}{11} \\
D & = & \frac{ ( -9 ) \times ( -2 ) }{ 11 } + \frac{ 1 }{ 11 } \\
D & = & \frac{ 18 }{ 11 } + \frac{ 1 }{ 11 } \\
D & = & \frac{ 18 + 1 }{ 11 } \\
D & = & \frac{ 19 }{ 11 }
\end{eqnarray*}
\end{minipage}
\end{Exo}
\begin{Exo}[5]
\begin{enumerate}
\item Quantité d'éléments liquides:
\begin{eqnarray*}
\frac{3}{50} + \frac{1}{4} & = & \frac{ 3 \times 2 }{ 50 \times 2 } + \frac{ 1 \times 25 }{ 4 \times 25 } \\
& = & \frac{ 6 + 25 }{ 100 }\\
& = & \frac{ 31 }{ 100 }
\end{eqnarray*}
Il y a $\frac{31}{100}$L d'éléments liquides.
\item Comme la recette de ce cocktail est donnée pour 3 personnes, il faut multiplier les quantités par 5 pour en faire pour 15 personnes.
\begin{eqnarray*}
5 \times \frac{1}{4} & = & \frac{5 \times 1}{4} \\
& = & \frac{5}{4} \\
\end{eqnarray*}
Il faudra donc $\frac{5}{4}$L de jus de pommes.
\item Comme la recette du cocktail est donnée pour 3 personnes, il faut diviser les quantités par 3 pour en faire pour une personne.
\begin{eqnarray*}
\frac{3}{50} : 3 & = & \frac{3}{50\times 3} = \frac{1}{50}
\end{eqnarray*}
Il faudra donc $\frac{1}{50}$L de jus de citron.
\item Maintenant que l'on connait les quantités de jus de citron pour faire le cocktail pour une personne, il suffit de multiplier cette quantité par 2 pour avoir la quantité pour 2 personnes.
\begin{eqnarray*}
2 \times \frac{1}{50} = \frac{2 \times 1}{50} = \frac{2}{50} = \frac{1}{25}
\end{eqnarray*}
Il faudra donc $\frac{1}{25}$L de jus de citron.
\item Quantité d'éléments liquides dans cette nouvelle recette:
\begin{eqnarray*}
\frac{31}{100} + \frac{4}{15} & = & \frac{ 31 \times 3 }{ 100 \times 3 } + \frac{ 4 \times 20 }{ 15 \times 20 } \\
& = &\frac{ 93 + 80 }{ 300 } \\
& = &\frac{ 173 }{ 300 }
\end{eqnarray*}
Dans cette nouvelle recette, il y aura $\frac{173}{300}$L d'éléments liquides.
\end{enumerate}
\end{Exo}
\begin{Exo}[3]
\begin{eqnarray*}
A = -7x^2 + 2x + 6 & = & -7\times 9^2 + 2 \times 9 + 6 \\
A & = & -7 \times 81 + 18 + 6 \\
A & = & -567 + 24 \\
A & = & - 543
\end{eqnarray*}
\begin{eqnarray*}
B = -9x(8x + 9) & = & -9 \times 5 \times ( 8 \times 5 + 9 ) \\
B & = & ( -9 ) \times 5 \times ( 8 \times 5 + 9 ) \\
B & = & ( -45 ) \times ( 40 + 9 ) \\
B & = & ( -45 ) \times 49 \\
B & = & -2205
\end{eqnarray*}
\end{Exo}
\begin{Exo}
\exo{Bonus}
\begin{enumerate}
\item pour compter la fraction de vélos rouges ou noirs, il faut ajouter les fractions correspondant aux deux groupes:
\begin{eqnarray*}
\frac{4}{11} + \frac{3}{22} & = & \frac{8}{22} + \frac{3}{22} \\
& = & \frac{8 + 3}{22} = \frac{11}{22} \\
&=& \frac{1}{2}
\end{eqnarray*}
Donc la moitié des vélos sont soit rouge soit noirs.
\item La fraction du reste des vélos est donc elle aussi de $\frac{1}{2}$. Parmi ces derniers, $\frac{5}{11}$ sont des vélos blancs donc en tout la fraction de vélos blancs est de
\begin{eqnarray*}
\frac{1}{2} \times \frac{5}{11} & = & \frac{1\times5}{2\ties11} = \frac{5}{22}
\end{eqnarray*}
\item Fractions de vélos soit rouges, soit noirs, soit blancs:
\begin{eqnarray*}
\frac{11}{22} + \frac{5}{22} & = & \frac{11 + 5}{22} = \frac{16}{22} = \frac{8}{11}
\end{eqnarray*}
Donc la fraction des vélos ni rouges, ni noirs ni blancs est de
\begin{eqnarray*}
1 - \frac{8}{11} & = & \frac{11}{11} - \frac{8}{11°\\
&=& \frac{11 - 8}{11}\\
&=& \frac{3}{11}
\end{eqnarray*}
Les vélos ni rouges ni noirs ni blancs représentent $\frac{3}{11}$.
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

Binary file not shown.

View File

@@ -0,0 +1,88 @@
\documentclass[a4paper,10pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{2}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\begin{document}
\maketitle
Le barème est donné à titre indicatif, il pourra être modifié.
\begin{Exo}[4]
Dire si les triangles suivants sont rectangles. S'ils sont rectangles, préciser quel est l'angle droit et quel est l'hypoténuse.
\begin{enumerate}
\item Le triangle $ABC$ dessiné ci-dessous
\begin{center}
\includegraphics[scale=0.3]{./fig/triangle2}
\end{center}
\item Le triangle $EFG$ tel que $EF = 9m$, $FG = 40m$ et $GE = 41m$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{eqnarray*}
A & = & \frac{-17}{2}+\frac{-15}{2} \\
B & = & \frac{17}{6}+\frac{-19}{5} \\
C & = & 9 \times \frac{-1}{11} \\
D & = & 10 \times \frac{1}{3} + \frac{10}{3}
\end{eqnarray*}
\end{Exo}
\begin{Exo}[5]
Voici la recette du cocktail Apple Fizz pour 3 personnes
\begin{itemize}
\item 3 cuillères à café de sucre vanillé
\item $\frac{3}{50}$L de jus de citron
\item $\frac{1}{4}$L de jus de pomme.
\item 2 cuillères à café de cannelle en poudre
\item 3 tranches de pomme
\end{itemize}
Répondre aux questions suivantes en donnant le résultat sous forme de \textbf{fraction} en explicitant les calculs.
\begin{enumerate}
\item Quelle est la quantité d'éléments liquides dans ce cocktail?
\item Quelle quantité de jus de citron faut-il pour faire ce cocktail pour 15 personnes?
\item Quelle quantité de jus de pomme faut-il pour faire ce cocktail pour 2 personnes?
\item On décide de personnaliser un peu la recette en ajoutant $\frac{4}{15}$ L de jus de poire à la recette. Quelle est la quantité d'éléments liquides dans cette nouvelle recette?
\end{enumerate}
\end{Exo}
\begin{Exo}[2]
Évaluer les expressions suivantes:
\begin{eqnarray*}
A = -9x + 2 & \mbox{avec} & x = -4 \\
B = 6x(4x + 3) & \mbox{avec} & x = -9
\end{eqnarray*}
\end{Exo}
\pagebreak
\begin{Exo}
\exo{Bonus}
On crée des motifs de la façon suivante:
\begin{center}
\includegraphics[scale=0.3]{./fig/carre.pdf}
\end{center}
\begin{enumerate}
\item Dessiner le motif 4 et 5. Combien y a-t-il de petits carrés sur chacune de ces figures?
\item Combien de petits carrés y a-t-il dans le motif $n$?
\item Combien de petits carrés y a-t-il dans le motif 10 000?
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

Binary file not shown.

View File

@@ -0,0 +1,88 @@
\documentclass[a4paper,10pt]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classDS}
\usepackage{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/2013_2014}
% Title Page
\titre{3}
% \quatreC \quatreD \troisB \troisPro
\classe{\quatreC}
\date{13 janvier 2014}
\duree{1 heure}
\sujet{2}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\begin{document}
\maketitle
Le barème est donné à titre indicatif, il pourra être modifié. Des points sont réservés à la présentation et à la rédaction.
\begin{Exo}[4]
Dire si les triangles suivants sont rectangles. S'ils sont rectangles, préciser quel est l'angle droit et quel est l'hypoténuse.
\begin{enumerate}
\item Le triangle $ABC$ dessiné ci-dessous
\begin{center}
\includegraphics[scale=0.3]{./fig/triangle2}
\end{center}
\item Le triangle $EFG$ tel que $EF = 2m$, $FG = 2,1m$ et $GE = 2,8m$.
\end{enumerate}
\end{Exo}
\begin{Exo}[5]
Calculer sans utiliser de nombres à virgule,les opérations suivantes:
\begin{eqnarray*}
A & = & \frac{-17}{2}+\frac{-15}{2} \\
B & = & \frac{17}{6}+\frac{-19}{5} \\
C & = & 9 \times \frac{-1}{11} \\
D & = & 10 \times \frac{1}{3} + \frac{10}{3}
\end{eqnarray*}
\end{Exo}
\begin{Exo}[5]
Voici la recette du cocktail Apple Fizz pour 3 personnes
\begin{itemize}
\item 3 cuillères à café de sucre vanillé
\item $\frac{3}{50}$L de jus de citron
\item $\frac{1}{4}$L de jus de pomme.
\item 2 cuillères à café de cannelle en poudre
\item 3 tranches de pomme
\end{itemize}
Répondre aux questions suivantes en donnant le résultat sous forme de \textbf{fraction} en explicitant les calculs.
\begin{enumerate}
\item Quelle est la quantité d'éléments liquides dans ce cocktail?
\item Quelle quantité de jus de citron faut-il pour faire ce cocktail pour 15 personnes?
\item Quelle quantité de jus de pomme faut-il pour faire ce cocktail pour 2 personnes?
\item On décide de personnaliser un peu la recette en ajoutant $\frac{4}{15}$ L de jus de poire à la recette. Quelle est la quantité d'éléments liquides dans cette nouvelle recette?
\end{enumerate}
\end{Exo}
\begin{Exo}[3]
Évaluer les expressions suivantes:
\begin{eqnarray*}
A = 9x^2 + 2x + 2 & \mbox{avec} & x = -4 \\
B = 6x(4x + 3) & \mbox{avec} & x = -9
\end{eqnarray*}
\end{Exo}
\pagebreak
\begin{Exo}
\exo{Bonus}
On crée des motifs de la façon suivante:
\begin{center}
\includegraphics[scale=0.3]{./fig/carre.pdf}
\end{center}
\begin{enumerate}
\item Dessiner le motif 4 et 5. Combien y a-t-il de petits carrés sur chacune de ces figures?
\item Combien de petits carrés y a-t-il dans le motif $n$?
\item Combien de petits carrés y a-t-il dans le motif 10 000?
\end{enumerate}
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

View File

@@ -0,0 +1,219 @@
#!/usr/bin/env python
# encoding: utf-8
from random import randint, random
"""Classe which generate randomly fractions sums
Types of sums
1 -> b / a + c / a
2 -> b / a + c / ka
3 -> b / a + e / d
4 -> f + b / a or b / a + f
where:
a integer > 2
b integer different from 0 (could be coprime with a)
c integer different from 0 (could be coprime with a or ka)
e integer different from 0 (could be coprime with d)
d integer > 2 ( a not divisible by d and d not divisible by a)
k integer > 2
f integer different from 0
Signs can be mod
"""
def a(min_ = 2, max_ = 10):
"""Generate randomly a
:param min_: minimum value for a
:param max_: maximum value for a
:returns: a value
"""
return randint(min_, max_)
def k(min_ = 2, max_ = 5):
"""Generate randomly k
:param min_: minimum value for k
:param max_: maximum value for k
:returns: k value
"""
return randint(min_, max_)
def b(a_ = 0, min_ = -20, max_ = 20):
"""Generate randomly b
:param a: the value of a if b has to be coprime with a (default 0 which means not necessarily coprime)
:param min_: minimum value for b (default -20)
:param max_: maximum value for b (default 20)
:returns: b value
"""
b_ = 0
while b_ == 0 or not coprime:
b_ = randint(min_, max_)
if a_ == 0:
coprime = 1
elif b_ != 0:
gcd_ = gcd(abs(a_),abs(b_))
coprime = (gcd_ == 1)
return b_
def c(a_ = 0, k_ = 1, min_ = -20, max_ = 20):
"""Generate randomly c
:param a: the value of a if c has to be coprime with a (default 0 which means not necessarily coprime)
:param k: the value of a if c has to be coprime with ak (default 0 which means not necessarily coprime)
:param min_: minimum value for c (default -20)
:param max_: maximum value for c (default 20)
:returns: c value
"""
return b(a_ = a_*k_, min_ = min_, max_ = max_)
def e(d_ = 0, min_ = -20, max_ = 20):
"""Generate randomly e
:param d: the value of a if e has to be coprime with a (default 0 which means not necessarily coprime)
:param min_: minimum value for e (default -20)
:param max_: maximum value for e (default 20)
:returns: e value
"""
return b(a_ = d_, min_ = min_, max_ = max_)
def d(a_, min_ = 2, max_ = 10):
"""Generate randomly d
:param a: the value of a
:param min_: minimum value for d
:param max_: maximum value for d
:returns: d value
"""
d_ = randint(min_, max_)
div = (not a_ % d_) or (not d_ % a_)
while div:
d_ = randint(min_, max_)
div = (not a_ % d_) or (not d_ % a_)
return d_
def f(min_ = -10, max_ = 10):
"""Generate randomly f
:param min_: minimum value for f
:param max_: maximum value for f
:returns: f value
"""
f_ = randint(min_, max_)
while f_ == 0:
f_ = randint(min_, max_)
return f_
def plusOrMinus(p = 0.5):
"""Return plus with prob p and minus otherwise
"""
pm = random()
return "+"*(pm >= p) + "-"*(pm < p)
def nothingOrMinus(p = 0.5):
"""Return nothing with prob p and minus otherwise
"""
pm = random()
return ""*(pm >= p) + "-"*(pm < p)
def type1():
"""@todo: Docstring for type1
:returns: @todo
"""
a_ = a()
b_ = b(a_=a_)
c_ = c(a_=a_)
return nothingOrMinus() + "\\frac{" + str(b_) + "}{" + str(a_) + "}" + plusOrMinus() + "\\frac{" + str(c_) + "}{" + str(a_) + "}"
def type2():
"""@todo: Docstring for type2
:returns: @todo
"""
a_ = a()
b_ = b(a_=a_)
k_ = k()
c_ = c(a_=a_, k_ = k_)
return nothingOrMinus() + "\\frac{" + str(b_) + "}{" + str(a_) + "}" + plusOrMinus() + "\\frac{" + str(c_) + "}{" + str(k_*a_) + "}"
def type3():
"""@todo: Docstring for type3
:returns: @todo
"""
a_ = a()
b_ = b(a_=a_)
c_ = c(a_=a_)
d_ = d(a_)
return nothingOrMinus() + "\\frac{" + str(b_) + "}{" + str(a_) + "}" + plusOrMinus() + "\\frac{" + str(c_) + "}{" + str(d_) + "}"
def type4():
"""@todo: Docstring for type4
:returns: @todo
"""
a_ = a()
b_ = b(a_=a_)
f_ = f()
return str(f_) + plusOrMinus() + "\\frac{" + str(b_) + "}{" + str(a_) + "}"
def gcd(a_, b_):
"""Compute gcd(a,b)
:param a: first number
:param b: second number
:returns: the gcd
"""
if a_ > b_:
c_ = a_ % b_
else:
c_ = b_ % a_
if c_ == 0:
return min(a_,b_)
elif a_ == 1:
return b_
elif b_ == 1:
return a_
else:
return gcd(min(a_,b_), c_)
if __name__ == '__main__':
# print(a())
# print(b())
# print(c())
# print(d(3))
# print(e())
# print(f())
print(type1())
print(type2())
print(type3())
print(type4())
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

View File

@@ -0,0 +1,163 @@
#!/usr/bin/env python
# encoding: utf-8
from random import randint, uniform
from math import sqrt
from jinja2 import Template
"""
Generate expression for litteral calculous
3 types of expression (a, b, c != 0, 1)
1 -> ax + b and eval for x != -b / a
2 -> ax(bx + c) and eval for x != 0 and x != -c / b
3 -> ax^2 + b and eval for x != +-sqrt(b/a) (if a and b have same sign)
"""
def gene_type1(min_ = -10, max_ = 10):
"""@todo: Docstring for gene_type1
:param min_: @todo
:param max_: @todo
:returns: @todo
"""
a, b = 0, 0
while (b in [0]) or (a in [0, 1]):
a = randint(min_, max_)
b = randint(1, max_)
return "{}x + {}".format(a,b), [-b/a]
def gene_type2(min_, max_):
"""@todo: Docstring for gene_type2
:param min_: @todo
:param max_: @todo
:returns: @todo
"""
a, b, c = 0, 0, 0
while (a in [0, 1]) or (b in [0, 1]) or c in [0]:
a = randint(min_, max_)
b = randint(min_, max_)
c = randint(1, max_)
return "{}x({}x + {})".format(a,b,c), [0, -c/b]
def gene_type3(min_ = -10, max_ = 10):
"""@todo: Docstring for gene_type3
:param min_: @todo
:param max_: @todo
:returns: @todo
"""
a, b = 0, 0
while (b in [0]) or (a in [0, 1]):
a = randint(min_, max_)
b = randint(1, max_)
if a*(-b) > 0:
VI = [-sqrt(-b/a), sqrt(-b/a)]
else:
VI = []
return "{}x^2 + {}".format(a,b), VI
def get_goodX(VI, approx = 0, min_ = -10, max_ = 10):
"""@todo: Docstring for get_goodX
:param VI: @todo
:returns: @todo
"""
x = uniform(min_, max_)
if approx == 0:
x = int(x)
else:
x = round(x,approx)
while x in VI:
x = uniform(min_, max_)
if approx == 0:
x = int(x)
else:
x = round(x,approx)
return x
def fullExo(min_ = -10 , max_ = 10):
"""Generate the whole exo
:param min_: @todo
:param max_: @todo
:returns: @todo
"""
template = Template("""
\\begin{equation*}
A = {{type1}} \\qquad B = {{type2}} \\qquad C = {{type3}}
\\end{equation*}
Évaluer $A$, $B$ et $C$ pour $x = {{x1}}$ puis $x = {{x2}}$""")
type1, VI1 = gene_type1(min_, max_)
type2, VI2 = gene_type2(min_, max_)
type3, VI3 = gene_type3(min_, max_)
VI = VI1 + VI2 + VI3
x1, x2 = get_goodX(VI), get_goodX(VI, approx = 1)
info = {"type1": type1, "type2": type2, "type3": type3, "x1":x1, "x2":x2}
exo = template.render(**info)
return exo
def exp1(min_ = -10, max_ = 10, letter = "A"):
"""@todo: Docstring for exp1
:param min: @todo
:param max: @todo
:returns: @todo
"""
exp, VI = gene_type1(min_,max_)
x = get_goodX(VI)
tpl = Template("{{A}} = {{exp}} & \\mbox{avec} & x = {{x}}")
return tpl.render(A = letter, exp = exp, x = x)
def exp2(min_ = -10, max_ = 10, letter = "A"):
"""@todo: Docstring for exp1
:param min: @todo
:param max: @todo
:returns: @todo
"""
exp, VI = gene_type2(min_,max_)
x = get_goodX(VI)
tpl = Template("{{A}} = {{exp}} & \\mbox{avec} & x = {{x}}")
return tpl.render(A = letter, exp = exp, x = x)
if __name__ == '__main__':
print(fullExo())
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

Binary file not shown.

View File

@@ -0,0 +1,480 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1790.0562"
height="458.86859"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="carre.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.39107937"
inkscape:cx="812.02997"
inkscape:cy="436.97452"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1364"
inkscape:window-height="748"
inkscape:window-x="0"
inkscape:window-y="274"
inkscape:window-maximized="1"
fit-margin-top="10"
fit-margin-left="10"
fit-margin-right="10"
fit-margin-bottom="10" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-2.6617935,-400.90067)">
<rect
style="fill:none;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-4"
width="87.994865"
height="87.994865"
x="62.565792"
y="677.79578" />
<g
id="g3947"
transform="translate(28.790808,2.1888406e-5)">
<g
transform="matrix(1.1508674,0,0,1.1508674,101.20168,130.22774)"
id="g3822"
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
id="g3794"
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
id="g3794-9"
transform="matrix(0,-1.1508674,1.1508674,0,-236.42714,975.77835)"
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-1-4"
width="76.459602"
height="76.459602"
x="259.1832"
y="475.78723" />
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-7-8"
width="76.459602"
height="76.459602"
x="182.4604"
y="475.78723" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3990"
transform="matrix(1.1508674,0,0,1.1508674,205.48365,94.312669)">
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
transform="translate(329.83303,30.931413)"
id="g3822-2">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-45"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-5">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-1"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-7"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-9-1"
transform="matrix(0,-1,1,0,36.46403,765.63865)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-1-4-1"
width="76.459602"
height="76.459602"
x="259.1832"
y="475.78723" />
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-7-8-5"
width="76.459602"
height="76.459602"
x="182.4604"
y="475.78723" />
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27"
transform="translate(406.32072,30.931416)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27-2"
transform="translate(252.17588,30.133169)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6-2"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1-1">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42-6"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3-8"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27-2-5"
transform="matrix(0,-1,1,0,36.218278,689.10708)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6-2-7"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1-1-6">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42-6-1"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3-8-8"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</g>
<text
xml:space="preserve"
style="font-size:57.15011597px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="7.0528221"
y="848.96002"
id="text4050"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4052"
x="7.0528221"
y="848.96002">Motif 0</tspan></text>
<text
xml:space="preserve"
style="font-size:57.15011597px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="285.1582"
y="848.96002"
id="text4054"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="285.1582"
y="848.96002"
id="tspan3910">Motif 1</tspan></text>
<text
xml:space="preserve"
style="font-size:57.15011597px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="739.79376"
y="848.96002"
id="text4058"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4060"
x="739.79376"
y="848.96002">Motif 2</tspan></text>
<g
id="g3326"
transform="translate(0,12.312357)">
<g
id="g3277">
<rect
style="fill:none;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-4-8"
width="87.994865"
height="87.994865"
x="1160.41"
y="664.57935" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3990-4"
transform="matrix(1.1508674,0,0,1.1508674,837.93733,82.000312)">
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
transform="translate(329.83303,30.931413)"
id="g3822-2-2">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-45-9"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-5-8">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-1-2"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-7-4"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-9-1-9"
transform="matrix(0,-1,1,0,36.46403,765.63865)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-1-4-1-5"
width="76.459602"
height="76.459602"
x="259.1832"
y="475.78723" />
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-7-8-5-0"
width="76.459602"
height="76.459602"
x="182.4604"
y="475.78723" />
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27-4"
transform="translate(406.32072,30.931416)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6-7"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1-7">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42-68"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3-2"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27-2-51"
transform="translate(252.17588,30.133169)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6-2-73"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1-1-3">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42-6-6"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3-8-4"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3822-27-2-5-7"
transform="matrix(0,-1,1,0,36.218278,689.10708)">
<rect
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-6-2-7-4"
width="76.459602"
height="76.459602"
x="105.65327"
y="475.78723" />
<g
style="stroke-width:4.34454918;stroke-miterlimit:4;stroke-dasharray:none"
id="g3794-1-1-6-0">
<rect
y="475.78723"
x="259.1832"
height="76.459602"
width="76.459602"
id="rect3753-1-42-6-1-9"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
y="475.78723"
x="182.4604"
height="76.459602"
width="76.459602"
id="rect3753-7-3-8-8-3"
style="fill:none;stroke:#000000;stroke-width:4.34454918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</g>
<rect
style="fill:none;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3753-4-8-1"
width="87.994865"
height="87.994865"
x="1692.223"
y="665.4834" />
</g>
<rect
y="401.08832"
x="1427.2754"
height="87.994865"
width="87.994865"
id="rect3753-4-8-0"
style="fill:none;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
<text
xml:space="preserve"
style="font-size:57.15011597px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="1371.1942"
y="848.96002"
id="text4058-0"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4060-5"
x="1371.1942"
y="848.96002">Motif 3</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1052.3622"
height="744.09448"
id="svg4634"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Nouveau document 8">
<defs
id="defs4636" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.80366138"
inkscape:cx="526.18109"
inkscape:cy="372.04724"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1364"
inkscape:window-height="748"
inkscape:window-x="0"
inkscape:window-y="274"
inkscape:window-maximized="0" />
<metadata
id="metadata4639">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-308.2677)">
<g
id="g5182"
transform="matrix(1.3936818,0,0,1.3936818,-137.18814,-267.62204)">
<path
transform="translate(-94.567192,247.29675)"
d="m 791.37807,426.17453 c 0,129.53923 -105.0123,234.55153 -234.55153,234.55153 -129.53923,0 -234.55153,-105.0123 -234.55153,-234.55153 0,-129.53923 105.0123,-234.55153 234.55153,-234.55153 129.53923,0 234.55153,105.0123 234.55153,234.55153 z"
sodipodi:ry="234.55153"
sodipodi:rx="234.55153"
sodipodi:cy="426.17453"
sodipodi:cx="556.82654"
id="path5150"
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
sodipodi:type="arc" />
<g
transform="translate(18.042406,317.91998)"
id="g5172">
<path
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 420.57514,47.283596 47.2836,0"
id="path5152"
inkscape:connector-curvature="0"
transform="translate(0,308.2677)" />
<path
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 444.21694,331.9095 0,47.2836"
id="path5152-0"
inkscape:connector-curvature="0" />
</g>
<path
transform="translate(0,308.2677)"
inkscape:connector-curvature="0"
id="path5176"
d="M 461.63721,365.82572 640.81715,211.53188"
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text5178"
y="584.50342"
x="513.89801"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="584.50342"
x="513.89801"
id="tspan5180"
sodipodi:role="line">r</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="611.54016"
height="527.1261"
id="svg3375"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="triangle1.svg">
<defs
id="defs3377" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="411.99776"
inkscape:cy="165.78447"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="10"
fit-margin-left="10"
fit-margin-right="10"
fit-margin-bottom="10"
inkscape:window-width="1364"
inkscape:window-height="748"
inkscape:window-x="0"
inkscape:window-y="274"
inkscape:window-maximized="0" />
<metadata
id="metadata3380">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-15.401787,-157.57925)">
<path
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 277.14286,230.93361 -201.428574,410 L 557.14286,346.6479 z"
id="path3385"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="127.14286"
y="370.93362"
id="text4155"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4157"
x="127.14286"
y="370.93362">15</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="414.28571"
y="250.93361"
id="text4159"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4161"
x="414.28571"
y="250.93361">7</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="351.42856"
y="558.07648"
id="text4163"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4165"
x="351.42856"
y="558.07648">17</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="-34.285713"
y="462.32645"
id="text3120"
sodipodi:linespacing="125%"
transform="translate(59.6875,212.37892)"><tspan
sodipodi:role="line"
id="tspan3122"
x="-34.285713"
y="462.32645">A</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="198.57143"
y="-16.244978"
id="text3124"
sodipodi:linespacing="125%"
transform="translate(59.6875,212.37892)"><tspan
sodipodi:role="line"
id="tspan3126"
x="198.57143"
y="-16.244978">B</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="534.28571"
y="153.75502"
id="text3128"
sodipodi:linespacing="125%"
transform="translate(59.6875,212.37892)"><tspan
sodipodi:role="line"
id="tspan3130"
x="534.28571"
y="153.75502">C</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="591.93915"
height="514.38611"
id="svg3375"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="triangle2.svg">
<defs
id="defs3377" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="52.885531"
inkscape:cy="162.92731"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="10"
fit-margin-left="10"
fit-margin-right="10"
fit-margin-bottom="10"
inkscape:window-width="1364"
inkscape:window-height="748"
inkscape:window-x="0"
inkscape:window-y="274"
inkscape:window-maximized="0" />
<metadata
id="metadata3380">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-30.717075,-167.46207)">
<path
style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 277.14286,230.93361 -201.428574,410 L 557.14286,346.6479 z"
id="path3385"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="127.14286"
y="370.93362"
id="text4155"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4157"
x="127.14286"
y="370.93362">35</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="414.28571"
y="250.93361"
id="text4159"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4161"
x="414.28571"
y="250.93361">12</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="351.42856"
y="558.07648"
id="text4163"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4165"
x="351.42856"
y="558.07648">37</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="198.57143"
y="-6.2449775"
id="text3028"
sodipodi:linespacing="125%"
transform="translate(59.6875,212.37892)"><tspan
sodipodi:role="line"
id="tspan3030"
x="198.57143"
y="-6.2449775">A</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="36.830357"
y="671.84821"
id="text3032"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3034"
x="36.830357"
y="671.84821">B</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="530"
y="146.61217"
id="text3036"
sodipodi:linespacing="125%"
transform="translate(59.6875,212.37892)"><tspan
sodipodi:role="line"
id="tspan3038"
x="530"
y="146.61217">C</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -0,0 +1,45 @@
Notes sur 01 pyth frac litt
###########################
:date: 2014-07-01
:modified: 2014-07-01
:tags: DS
:category: 4e
:authors: Benjamin Bertrand
:summary: Pas de résumé, note créée automatiquement parce que je ne l'avais pas bien fait...
`Lien vers 01_pyth_frac_litt_1_.tex <01_pyth_frac_litt_1_.tex>`_
`Lien vers 01_pyth_frac_litt.tex <01_pyth_frac_litt.tex>`_
`Lien vers 01_pyth_frac_litt_2_.pdf <01_pyth_frac_litt_2_.pdf>`_
`Lien vers 01_pyth_frac_litt_1.pdf <01_pyth_frac_litt_1.pdf>`_
`Lien vers 01_pyth_frac_litt_1_corr.tex <01_pyth_frac_litt_1_corr.tex>`_
`Lien vers mult_frac.py <mult_frac.py>`_
`Lien vers 01_pyth_frac_litt_1.tex <01_pyth_frac_litt_1.tex>`_
`Lien vers number_rotation.py <number_rotation.py>`_
`Lien vers 01_pyth_frac_litt_1_.pdf <01_pyth_frac_litt_1_.pdf>`_
`Lien vers 01_pyth_frac_litt_2.pdf <01_pyth_frac_litt_2.pdf>`_
`Lien vers 01_pyth_frac_litt_2_.tex <01_pyth_frac_litt_2_.tex>`_
`Lien vers call_litt.py <call_litt.py>`_
`Lien vers 01_pyth_frac_litt_2.tex <01_pyth_frac_litt_2.tex>`_
`Lien vers add_frac.py <add_frac.py>`_
`Lien vers fig/triangle2.pdf <fig/triangle2.pdf>`_
`Lien vers fig/triangle1.pdf <fig/triangle1.pdf>`_
`Lien vers fig/carre.pdf <fig/carre.pdf>`_

View File

@@ -0,0 +1,160 @@
#!/usr/bin/env python
# encoding: utf-8
from random import randint, random
"""Classe which generate randomly fractions multiplications
Types of multiplications
1 -> a x b / c
2 -> a x b / c + d / c
3 -> a x b / c + d / e >>> TODO
4 -> e / f x g / h >>> TODO
5 -> i / j x k / l >>> TODO
where:
a integer differente from -1, 0, 1
b integer different from 0
c integer different from 0 and 1 (could be coprime with b or a)
d integer different from 0
e, g integer different from 0
f, g integer different from 0 and 1 such that e*g is coprime with f*h
i, k integer different from 0
j, l integer different from 0 and 1 such that i*k and j*l have divisor in common
Signs can be mod
"""
def a(min_ = -10, max_ = 10, notIn = [-1,0,1]):
"""Generate randomly a
:param min_: minimum value for a
:param max_: maximum value for a
:param notIn: value that can't take a
:returns: a value
"""
a_ = randint(min_, max_)
while a_ in notIn:
a_ = randint(min_, max_)
return a_
def b(min_ = -10, max_ = 10, notIn = [0]):
"""Generate randomly b
:param min_: minimum value for b
:param max_: maximum value for b
:param notIn: value that can't take b
:returns: a value
"""
return a(min_, max_, notIn)
def c(b_ = 0, min_ = 2, max_ = 20):
"""Generate randomly c
:param a_: the value of b if c has to be coprime with b (default 0 which means not necessarily coprime)
:param min_: minimum value for b (default -20)
:param max_: maximum value for b (default 20)
:returns: c value
"""
c_ = 0
while c_ == 0 or not coprime:
c_ = randint(min_, max_)
if b_ == 0:
coprime = 1
elif c_ not in [-1,0,1]:
gcd_ = gcd(abs(c_),abs(b_))
coprime = (gcd_ == 1)
return c_
def d(min_ = -10, max_ = 10, notIn = [0]):
"""Generate randomly d
:param min_: minimum value for d
:param max_: maximum value for d
:param notIn: value that can't take d
:returns: a value
"""
return a(min_, max_, notIn)
def plusOrMinus(p = 0.5):
"""Return plus with prob p and minus otherwise
"""
pm = random()
return "+"*(pm >= p) + "-"*(pm < p)
def nothingOrMinus(p = 0.5):
"""Return nothing with prob p and minus otherwise
"""
pm = random()
return ""*(pm >= p) + "-"*(pm < p)
def type1():
"""@todo: Docstring for type1
:returns: @todo
"""
a_ = a()
b_ = b()
c_ = c(b_=b_*a_)
return str(a_) + " \\times \\frac{" + str(b_) + "}{" + str(c_) + "}"
def type2():
"""@todo: Docstring for type2
:returns: @todo
"""
a_ = a()
b_ = b()
c_ = c(b_=b_*a_)
d_ = d()
return str(a_) + " \\times \\frac{" + str(b_) + "}{" + str(c_) + "} + \\frac{" + str(d_) + "}{" + str(c_) + "}"
def gcd(a_, b_):
"""Compute gcd(a,b)
:param a: first number
:param b: second number
:returns: the gcd
"""
if a_ > b_:
c_ = a_ % b_
else:
c_ = b_ % a_
if c_ == 0:
return min(a_,b_)
elif a_ == 1:
return b_
elif b_ == 1:
return a_
else:
return gcd(min(a_,b_), c_)
if __name__ == '__main__':
# print(a())
# print(b())
# print(c())
# print(d(3))
# print(e())
# print(f())
print(type1())
print(type2())
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env python
# encoding: utf-8
import jinja2, random, os
import sys
import optparse
def randfloat(approx = 1, low = 0, up = 10):
""" return a random number between low and up with approx floating points """
ans = random.random()
ans = ans*(up - low) + low
ans = round(ans, approx)
return ans
random.randfloat = randfloat
def gaussRandomlist(mu = 0, sigma = 1, size = 10, manip = lambda x:x):
""" return a list of a gaussian sample """
ans = []
for i in range(size):
ans += [manip(random.gauss(mu,sigma))]
return ans
random.gaussRandomlist = gaussRandomlist
def gaussRandomlist_strInt(mu = 0, sigma = 1, size = 10):
return gaussRandomlist(mu, sigma, size, manip = lambda x: str(int(x)))
random.gaussRandomlist_strInt = gaussRandomlist_strInt
# ------------------
# Spécial exo!
from add_frac import type1, type3, type4
exo = {"add_frac1": type1, "add_frac3": type3, "add_frac4": type4}
from mult_frac import type1, type2
exo["mult_frac1"] = type1
exo["mult_frac2"] = type2
from call_litt import exp1, exp2
exo["exp1"] = exp1
exo["exp2"] = exp2
report_renderer = jinja2.Environment(
block_start_string = '%{',
block_end_string = '%}',
variable_start_string = '%{{',
variable_end_string = '%}}',
loader = jinja2.FileSystemLoader(os.path.abspath('.'))
)
def main(options):
template = report_renderer.get_template(options.template)
if options.output:
output_basename = options.output
else:
tpl_base = os.path.splitext(options.template)[0]
output_basename = tpl_base + "_"
for subj in range(options.num_subj):
subj = subj+1
dest = output_basename + str(subj) + '.tex'
with open( dest, 'w') as f:
f.write(template.render(random = random, infos = {"subj" : subj}, exo = exo))
os.system("pdflatex " + dest)
if not options.dirty:
os.system("rm *.aux *.log")
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option("-t","--tempalte",action="store",type="string",dest="template", help="File with template")
parser.add_option("-o","--output",action="store",type="string",dest="output",help="Base name for output (without .tex or any extension))")
parser.add_option("-n","--number_subjects", action="store",type="int", dest="num_subj", default = 2, help="The number of subjects to make")
parser.add_option("-d","--dirty", action="store_true", dest="dirty", help="Do not clean after compilation")
(options, args) = parser.parse_args()
if not options.template:
print("I need a template!")
sys.exit(0)
main(options)
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del