Merge remote-tracking branch 'origin/dev' into dev

Conflicts:
	DS_gene.py
	example/all_example.pdf
	example/tpl_example.tex
	texenv.py
This commit is contained in:
lafrite 2015-03-19 22:06:19 +01:00
commit 14a7a2982c
5 changed files with 182 additions and 32 deletions

View File

@ -8,8 +8,14 @@ import csv
from path import path
from texenv import texenv
from pymath.random_expression import RdExpression
from pymath.expression import Expression
from pymath.polynom import Polynom
from pymath.fraction import Fraction
pymath_tools = {"Expression":Expression,\
"Polynom":Polynom,\
"Fraction":Fraction,\
}
def main(options):
#template = report_renderer.get_template(options.template)
@ -39,11 +45,14 @@ def main(options):
output = output.name
tmp_pdf = []
for infos in list_infos:
#print("_______" + str(infos))
dest = path(str(infos['num']) + output)
tmp_pdf.append(dest.namebase + ".pdf")
with open( dest, 'w') as f:
f.write(template.render( RdExpression = RdExpression , infos = infos))
f.write(template.render( infos = infos, **pymath_tools ))
if not options.no_compil:
os.system("pdflatex " + dest)
@ -52,9 +61,12 @@ def main(options):
os.system("rm *.aux *.log")
if not options.no_join:
os.system("pdfjam *.pdf -o all" + path(output).namebase + ".pdf")
for infos in list_infos:
os.system("rm " + path(str(infos['num']) + output).namebase + ".pdf")
print(path("./").abspath())
print("pdfjam "+ " ".join(tmp_pdf) + " -o all" + path(output).namebase + ".pdf")
os.system("pdfjam "+ " ".join(tmp_pdf) + " -o all" + path(output).namebase + ".pdf")
#os.system("pdfjam *.pdf -o all" + path(output).namebase + ".pdf")
print("rm " + " ".join(tmp_pdf))
os.system("rm " + " ".join(tmp_pdf))
cwd.cd()

View File

@ -0,0 +1,113 @@
\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{Calcul littéral et statistiques}
% \quatreC \quatreD \troisB \troisPro
\classe{\troisB}
\date{26 septemble 2013}
% DS DSCorr DM DMCorr Corr
\typedoc{DS}
\duree{1 heure}
\sujet{}
\begin{document}
\maketitle
\Calc
Le barème est donné à titre indicatif, il pourra être modifié.
\begin{Exo}[4.5]
Développer et réduire les expressions suivantes:
\begin{eqnarray*}
A &=& \frac{ 1 }{ 2 } + 2 \\
P(x) &=& 6 x - 2 \\
Q(x) &=& 4 x + 11\\
R(x) &=& ( 6 x - 2 ) \times ( 4 x + 11 )
\end{eqnarray*}
Solutions:
\begin{eqnarray*}
A & = & \frac{ 1 }{ 2 } + 2 \\
A & = & \frac{ 1 \times 1 }{ 2 \times 1 } + \frac{ 2 \times 2 }{ 1 \times 2 } \\
A & = & \frac{ 1 + 4 }{ 2 } \\
A & = & \frac{ 5 }{ 2 }
\end{eqnarray*}
\begin{eqnarray*}
P(2) & = & 6 \times 2 - 2 \\
P(2) & = & 12 - 2 \\
P(2) & = & 10
\end{eqnarray*}
\begin{eqnarray*}
Q(2) & = & 4 \times 2 + 11 \\
Q(2) & = & 8 + 11 \\
Q(2) & = & 19
\end{eqnarray*}
\begin{eqnarray*}
P(x) + Q(X) & = & 6 x + 4 x - 2 + 11 \\
P(x) + Q(X) & = & ( 6 + 4 ) x + ( -2 ) + 11 \\
P(x) + Q(X) & = & 10 x + 9
\end{eqnarray*}
\begin{eqnarray*}
P(x) + Q(X) & = & 6 x - 2 + 4 x + 11 \\
P(x) + Q(X) & = & 4 x + 6 x + 11 - 2 \\
P(x) + Q(X) & = & ( 4 + 6 ) x + 11 + ( -2 ) \\
P(x) + Q(X) & = & 10 x + 9
\end{eqnarray*}
\begin{eqnarray*}
R(x) & = & ( 6 x - 2 ) \times ( 4 x + 11 ) \\
R(x) & = & 6 \times 4 x^{ 2 } + ( -2 ) \times 4 x + 6 \times 11 x + ( -2 ) \times 11 \\
R(x) & = & 6 \times 4 x^{ 2 } + ( ( -2 ) \times 4 + 6 \times 11 ) x + ( -2 ) \times 11 \\
R(x) & = & 24 x^{ 2 } + ( ( -8 ) + 66 ) x - 22 \\
R(x) & = & 24 x^{ 2 } + 58 x - 22
\end{eqnarray*}
\end{Exo}
\begin{Exo}
Résoudre l'équation suivante
\begin{eqnarray*}
3 x^{ 2 } + x + 10 & = & 0
\end{eqnarray*}
Solution:
On commence par calculer le discriminant
\begin{eqnarray*}
\Delta & = & b^2-4ac
\end{eqnarray*}
\begin{eqnarray*}
\Delta & = & 1^{ 2 } - 4 \times 3 \times 10 \\
\Delta & = & 1 - 12 \times 10 \\
\Delta & = & 1 - 120 \\
\Delta & = & -119
\end{eqnarray*}
Alors $\Delta = -119$
\end{Exo}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:

View File

@ -1,25 +0,0 @@
Classe;Nom;Prenom;identifiant;mdp
6A;ASSAOUA;Najwa;nassaoua;zajulu
6A;AUDINOT;Lea;laudinot;padito
6A;CARVALHO GOUVEIA;Ana Filipa;acarvalhogo;fekovo
6A;CASALTA;Marine;mcasalta9;wufuzu
6A;CASU;Stella-Maria;scasu;jixuyu
6A;DEBLY;Laura;ldebly;cazema
6A;ERNANDES;Carla;cernandes;kahisi
6A;ETIENNE;Melvin;metienne2;jimico
6A;GAILLARD;Dorian;dgaillard;lazofi
6A;GUIDONI;Dominique;dguidoni4;zojihi
6A;HAMMAMI;Oumaïma;ohammami;sugaga
6A;KHEZAMI;Mohamed;mkhezami2;pomeve
6A;KUREK-PINELLI;Ristituda;rkurekpinel;xawunu
6A;LARROQUE;Nino;nlarroque;jivanu
6A;MABIRE;Luca;lmabire;menazi
6A;MATIC;Veljko;vmatic;pijofa
6A;MOUAOU;Saâd;smouaou;ruroyo
6A;PERRIN;Nicolas;nperrin4;xenige
6A;PIRES NASCIMENTO;Guillaume;gpiresnasci;yixone
6A;QUARDELLE;Olivier;oquardelle;yekezo
6A;RANCUREL;Fabio;francurel;dowabo
6A;SPINOSI;ALEXANDRE;aspinosi;pebidi
6A;VERBEKE;Hugo;hverbeke;xucibo
6A;WATIN;Anthony;awatin;sucavo
1 Classe Nom Prenom identifiant mdp
2 6A ASSAOUA Najwa nassaoua zajulu
3 6A AUDINOT Lea laudinot padito
4 6A CARVALHO GOUVEIA Ana Filipa acarvalhogo fekovo
5 6A CASALTA Marine mcasalta9 wufuzu
6 6A CASU Stella-Maria scasu jixuyu
7 6A DEBLY Laura ldebly cazema
8 6A ERNANDES Carla cernandes kahisi
9 6A ETIENNE Melvin metienne2 jimico
10 6A GAILLARD Dorian dgaillard lazofi
11 6A GUIDONI Dominique dguidoni4 zojihi
12 6A HAMMAMI Oumaïma ohammami sugaga
13 6A KHEZAMI Mohamed mkhezami2 pomeve
14 6A KUREK-PINELLI Ristituda rkurekpinel xawunu
15 6A LARROQUE Nino nlarroque jivanu
16 6A MABIRE Luca lmabire menazi
17 6A MATIC Veljko vmatic pijofa
18 6A MOUAOU Saâd smouaou ruroyo
19 6A PERRIN Nicolas nperrin4 xenige
20 6A PIRES NASCIMENTO Guillaume gpiresnasci yixone
21 6A QUARDELLE Olivier oquardelle yekezo
22 6A RANCUREL Fabio francurel dowabo
23 6A SPINOSI ALEXANDRE aspinosi pebidi
24 6A VERBEKE Hugo hverbeke xucibo
25 6A WATIN Anthony awatin sucavo

View File

@ -14,6 +14,7 @@
\begin{document}
\maketitle
<<<<<<< HEAD
\section{Exercice de simplification de fraction}
\Block{do RdExpression.set_form("exp")}
\Block{set A = RdExpression("{a}/2+2")()}
@ -47,6 +48,54 @@
\beta & = & -\frac{b^2 - 4ac}{4a} =
\end{eqnarray*}
=======
\Calc
Le barème est donné à titre indicatif, il pourra être modifié.
\begin{Exo}[4.5]
\Block{set A = Expression.random("{a} / 2 + 2")}
\Block{set P = Polynom.random(["{b}","{a}"])}
\Block{set Q = Polynom.random(["{b+2}","{a}"])}
\Block{set R = P('x')*Q('x') }
Développer et réduire les expressions suivantes:
\begin{eqnarray*}
A &=& \Var{ A } \\
P(x) &=& \Var{ P } \\
Q(x) &=& \Var{ Q }\\
R(x) &=& \Var{R}
\end{eqnarray*}
Solutions:
\Var{A.simplify() | calculus}
\Var{P(2).simplify() | calculus(name = "P(2)")}
\Var{Q(2).simplify() | calculus(name = "Q(2)")}
\Var{(P+Q) | calculus(name = "P(x) + Q(X)")}
\Var{(P('x')+Q('x')).simplify() | calculus(name = "P(x) + Q(X)")}
\Var{R.simplify() | calculus(name = "R(x)")}
\end{Exo}
\begin{Exo}
\Block{set P = Polynom.random(["{a}", "{b}", "{c}"])}
Résoudre l'équation suivante
\begin{eqnarray*}
\Var{P} & = & 0
\end{eqnarray*}
Solution:
On commence par calculer le discriminant
\begin{eqnarray*}
\Delta & = & b^2-4ac
\end{eqnarray*}
\Block{set Delta = Expression("{b}^2 - 4*{a}*{c}".format(a = P._coef[2], b = P._coef[1], c = P._coef[0]))}
\Var{Delta.simplify()|calculus(name="\\Delta")}
\Block{set Delta = Delta.simplified()}
Alors $\Delta = \Var{Delta}$
\end{Exo}
>>>>>>> origin/dev
\end{document}
@ -56,3 +105,4 @@
%%% TeX-master: "master"
%%% End:

View File

@ -11,7 +11,7 @@ texenv = jinja2.Environment(
variable_start_string = '\Var{',
variable_end_string = '}',
loader = jinja2.FileSystemLoader(os.path.abspath('.')),
extensions=['jinja2.ext.do']
extensions = ['jinja2.ext.do']
)
# Filters
@ -25,7 +25,7 @@ def do_calculus(steps, name = "A"):
"""
ans = "\\begin{eqnarray*}\n"
ans += " \\\\ \n".join([name + " & = & " + s for s in steps])
ans += " \\\\ \n".join([name + " & = & " + str(s) for s in steps])
ans += "\n\\end{eqnarray*}\n"
return ans