Import work from year 2013-2014
This commit is contained in:
61
4e/DS/4eC/04_dev/04_dev.tex
Normal file
61
4e/DS/4eC/04_dev/04_dev.tex
Normal file
@@ -0,0 +1,61 @@
|
||||
\documentclass[a4paper,12pt,landscape, twocolumn]{/media/documents/Cours/Prof/Enseignements/Archive/2013-2014/tools/style/classExo}
|
||||
|
||||
% Title Page
|
||||
\title{Contrôle}
|
||||
\author{}
|
||||
\date{}
|
||||
|
||||
\fancyhead[L]{Nom prénom}
|
||||
\fancyhead[C]{\Thetitle}
|
||||
\fancyhead[R]{Classe: \hspace{2cm}}
|
||||
|
||||
|
||||
\begin{document}
|
||||
\thispagestyle{fancy}
|
||||
|
||||
\begin{Exo}
|
||||
Réduire les produits suivants
|
||||
\begin{eqnarray*}
|
||||
%{{exo.red_prod() %}}
|
||||
\end{eqnarray*}
|
||||
\end{Exo}
|
||||
\begin{Exo}
|
||||
Réduire les sommes suivantes
|
||||
\begin{eqnarray*}
|
||||
%{{exo.red_somme() %}}
|
||||
\end{eqnarray*}
|
||||
\end{Exo}
|
||||
\begin{Exo}
|
||||
Développer les expressions suivantes (on ne demande pas de réduire)
|
||||
\begin{eqnarray*}
|
||||
%{{exo.simple_prod() %}} &=& \cdots \times \cdots + \cdots \times \cdots \\[1cm]
|
||||
%{{exo.double_prod() %}}&=& \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots \\[0.4cm]
|
||||
\end{eqnarray*}
|
||||
\end{Exo}
|
||||
|
||||
\vfill\eject
|
||||
|
||||
\begin{Exo}
|
||||
Développer puis réduire
|
||||
|
||||
\begin{eqnarray*}
|
||||
%{{exo.double_prod()%}} &=& \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots \\[0.4cm]
|
||||
&=& \hspace{2cm} + \hspace{2cm} + \hspace{2cm} + \hspace{2cm} \\[0.4cm]
|
||||
&=& \hspace{2cm} + \hspace{2cm} + \hspace{2cm} \\[0.6cm]
|
||||
%{{exo.double_prod() %}}&=& \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots + \cdots \times \cdots \\[0.4cm]
|
||||
&=& \hspace{2cm} + \hspace{2cm} + \hspace{2cm} + \hspace{2cm} \\[0.4cm]
|
||||
&=& \hspace{2cm} + \hspace{2cm} + \hspace{2cm} + \hspace{2cm} \\[0.4cm]
|
||||
&=& \hspace{2cm} + \hspace{2cm} + \hspace{2cm} \\[0.6cm]
|
||||
%{{exo.double_prod() %}} & = & \\[5cm]
|
||||
%{{ exo.carre_prod() %}} & = &
|
||||
\end{eqnarray*}
|
||||
\end{Exo}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
%%% Local Variables:
|
||||
%%% mode: latex
|
||||
%%% TeX-master: "master"
|
||||
%%% End:
|
||||
|
||||
BIN
4e/DS/4eC/04_dev/04_dev_subj.pdf
Normal file
BIN
4e/DS/4eC/04_dev/04_dev_subj.pdf
Normal file
Binary file not shown.
62
4e/DS/4eC/04_dev/exercices.py
Normal file
62
4e/DS/4eC/04_dev/exercices.py
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
|
||||
from random_expression import RdExpression
|
||||
|
||||
def red_prod():
|
||||
form1 = "{a}x \\times {b}"
|
||||
cond1 = ["{a} != 1", "{b} > 1"]
|
||||
rdExp1 = RdExpression(form1, cond1, with_Exp = False)
|
||||
exp1 = rdExp1()
|
||||
|
||||
form2 = "{a}x \\times {b}x"
|
||||
cond2 = ["{a} != 1", "{b} > 1"]
|
||||
rdExp2 = RdExpression(form2, cond2, with_Exp = False)
|
||||
exp2 = rdExp2()
|
||||
|
||||
ans = exp1 + "= \\parbox{1cm}{\\dotfill} \\hspace{2cm} " + exp2 + "= \\parbox{1cm}{\\dotfill}"
|
||||
return ans
|
||||
|
||||
def red_somme():
|
||||
form1 = "{a}x + {b} + {c}x"
|
||||
cond1 = ["{a} != 1","{c} > 1"]
|
||||
rdExp1 = RdExpression(form1, cond1, with_Exp = False)
|
||||
exp1 = rdExp1()
|
||||
|
||||
form2 = "{a}x + {b} + {c}x"
|
||||
cond2 = ["{a} != 1","{c} > 1"]
|
||||
rdExp2 = RdExpression(form2, cond2, with_Exp = False)
|
||||
exp2 = rdExp2()
|
||||
|
||||
ans = exp1 + " = \\parbox{3cm}{\\dotfill} = \\parbox{2cm}{\\dotfill} \\\\[0.5cm]"
|
||||
ans += exp2 + " = \\parbox{3cm}{\\dotfill} = \\parbox{2cm}{\\dotfill} \\\\[0.5cm]"
|
||||
return ans
|
||||
|
||||
def simple_prod():
|
||||
form = "{a}({b}x + {c})"
|
||||
cond = ["{a} != 1", "{b} != 1", "{c} > 1"]
|
||||
rdExp = RdExpression(form, cond, with_Exp = False)
|
||||
return rdExp()
|
||||
|
||||
def double_prod():
|
||||
form = "({a}x - {d})({b}x + {c})"
|
||||
cond = ["{a} != 1", "{b} != 1", "{d} > 1", "{c} > 1"]
|
||||
rdExp = RdExpression(form, cond, with_Exp = False)
|
||||
return rdExp()
|
||||
|
||||
def carre_prod():
|
||||
form = "({a}x + {d})^2"
|
||||
cond = ["{a} != 1", "{d} > 1"]
|
||||
rdExp = RdExpression(form, cond, with_Exp = False)
|
||||
return rdExp()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||
# cursor: 16 del
|
||||
19
4e/DS/4eC/04_dev/index.rst
Normal file
19
4e/DS/4eC/04_dev/index.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
Notes sur 04 dev
|
||||
################
|
||||
|
||||
: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 04_dev.tex <04_dev.tex>`_
|
||||
|
||||
`Lien vers number_rotation.py <number_rotation.py>`_
|
||||
|
||||
`Lien vers 04_dev_subj.pdf <04_dev_subj.pdf>`_
|
||||
|
||||
`Lien vers exercices.py <exercices.py>`_
|
||||
72
4e/DS/4eC/04_dev/number_rotation.py
Executable file
72
4e/DS/4eC/04_dev/number_rotation.py
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import jinja2, random, os
|
||||
import sys
|
||||
import optparse
|
||||
|
||||
|
||||
from exercices import red_somme, red_prod, simple_prod, double_prod, carre_prod
|
||||
|
||||
exo = {'red_somme':red_somme, 'red_prod': red_prod, 'simple_prod': simple_prod, 'double_prod': double_prod, 'carre_prod': carre_prod}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
||||
cwd = os.getcwd()
|
||||
|
||||
if options.output:
|
||||
output_name = options.output
|
||||
else:
|
||||
tpl_base = os.path.splitext(options.template)[0]
|
||||
output_name = tpl_base + "_"
|
||||
|
||||
output_dir = os.path.dirname(output_name)
|
||||
output_basename = os.path.basename(output_name)
|
||||
output_tplname = output_basename.split("/")[-1]
|
||||
|
||||
os.chdir(output_dir)
|
||||
|
||||
for subj in range(options.num_subj):
|
||||
subj = subj+1
|
||||
dest = output_tplname + str(subj) + '.tex'
|
||||
with open( dest, 'w') as f:
|
||||
f.write(template.render(exo = exo ,infos = {"subj" : subj}))
|
||||
os.system("pdflatex " + dest)
|
||||
|
||||
if not options.dirty:
|
||||
os.system("rm *.aux *.log")
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user