예제 #1
0
 def tex_statement(self):
     exo = [r'\exercice']
     exo.extend([
         r"\psset{unit=5mm, algebraic, dotsize=4pt 4}",
         r"\begin{pspicture*}(-6.2,-5.2)(6.2,5.2)"
     ])
     exo.append(
         r"\psgrid[subgriddiv=1, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]"
     )
     exo.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-6.2,-5.2)(6.2,5.2)")
     exo.append(
         r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-6}{6}{%s}"
         % Priorites3.plotify(repr(self.polynome)))
     exo.append(r"\psdots %s" % " ".join([str(val) for val in self.points]))
     exo.append(r"\end{pspicture*}")
     #=======================================================================
     # print racines(self.polynome, [self.points[i][0] for i in range(3)])
     # print racines(self.polynome, [self.points[i][0] for i in range(3, 6)])
     #=======================================================================
     return exo
예제 #2
0
 def tex_statement(self):
     exo = [r'\exercice']
     exo.extend([r"\psset{unit=5mm, algebraic, dotsize=4pt 4}", r"\begin{pspicture*}(-6.2,-5.2)(6.2,5.2)"])
     exo.append(r"\psgrid[subgriddiv=1, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]")
     exo.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-6.2,-5.2)(6.2,5.2)")
     exo.append(r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-6}{6}{%s}" % Priorites3.plotify(repr(self.polynome)))
     exo.append(r"\psdots %s" % " ".join([str(val) for val in self.points]))
     exo.append(r"\end{pspicture*}")
     #=======================================================================
     # print racines(self.polynome, [self.points[i][0] for i in range(3)])
     # print racines(self.polynome, [self.points[i][0] for i in range(3, 6)])
     #=======================================================================
     return exo
예제 #3
0
def notion_fonction():
    """Créé un exercice bilan sur la notion de fonction"""
    from pyromaths.classes.PolynomesCollege import Polynome
    from pyromaths.outils import Priorites3
    fct = [eval(creer_fonction(1)), eval(creer_fonction(2))]
    ant = [
        randrange(1, 6) * (-1)**fct[0].degre(),
        randrange(1, 6) * (-1)**fct[1].degre(),
        randrange(1, 6) * (-1)**fct[1].degre(),
        randrange(1, 6) * (-1)**fct[0].degre()
    ]
    shuffle(fct)
    val_exo2 = choix_points(nb=7)
    exo = [
        r"\exercice", r"\begin{multicols}{2}", r"\begin{enumerate}",
        u"\\item On donne"
    ]
    exo.append(r"$\begin{array}[t]{l}")
    exo.append(u"f:~x \\longmapsto %s \\\\ g:~x \\longmapsto %s" %
               (fct[0], fct[1]))
    exo.extend([
        r"\end{array}$",
        r"\begin{enumerate}",
    ])
    exo.append(u"\\item Quelle est l'image de $%s$ par la fonction $f$ ?" %
               ant[0])
    cor = [
        r"\exercice", r"\begin{multicols}{2}", r"\begin{enumerate}",
        u"\\item On donne"
    ]
    cor.append(r"$\begin{array}[t]{l}")
    cor.append(u"f:~x \\longmapsto %s \\\\ g:~x \\longmapsto %s" %
               (fct[0], fct[1]))
    cor.extend([
        r"\end{array}$",
        r"\begin{enumerate}",
    ])
    cor.append(u"\\item Quelle est l'image de $%s$ par la fonction $f$ ?" %
               ant[0])
    cor.extend(corrige('f', fct[0], ant[0]))
    exo.append(u"\\item Quelle est l'image de $%s$ par la fonction $g$ ?" %
               ant[1])
    cor.append(u"\\item Quelle est l'image de $%s$ par la fonction $g$ ?" %
               ant[1])
    cor.extend(corrige('g', fct[1], ant[1]))
    exo.append(u"\\item Calculer $f\\,(%s)$." % ant[2])
    cor.append(u"\\item Calculer $f\\,(%s)$." % ant[2])
    cor.extend(corrige('f', fct[0], ant[2]))
    exo.append(u"\\item Calculer $g\\,(%s)$." % ant[3])
    cor.append(u"\\item Calculer $g\\,(%s)$." % ant[3])
    cor.extend(corrige('g', fct[1], ant[3]))
    exo.append(r"\end{enumerate}")
    cor.append(r"\end{enumerate}")
    exo.append(
        u"\\item Voici un tableau de valeurs correspondant à une fonction $h$.\\par"
    )
    exo.append(r"\renewcommand{\arraystretch}{1.5}")
    exo.append(r"\begin{tabularx}{\linewidth}[t]{|c|*7{>{\centering}X|}}")
    exo.append(r"\hline")
    exo.append(r"$x$ & %s \tabularnewline \hline" %
               " & ".join(["$%s$" % c[0] for c in val_exo2]))
    exo.append(r"$h\,(x)$ & %s \tabularnewline \hline" %
               " & ".join(["$%s$" % c[1] for c in val_exo2]))
    exo.append(r"\end{tabularx} \medskip")
    exo.append(r"\begin{enumerate}")
    cor.append(
        u"\\item Voici un tableau de valeurs correspondant à une fonction $h$.\\par"
    )
    cor.append(r"\renewcommand{\arraystretch}{1.5}")
    cor.append(r"\begin{tabularx}{\linewidth}[t]{|c|*7{>{\centering}X|}}")
    cor.append(r"\hline")
    cor.append(r"$x$ & %s \tabularnewline \hline" %
               " & ".join(["$%s$" % c[0] for c in val_exo2]))
    cor.append(r"$h\,(x)$ & %s \tabularnewline \hline" %
               " & ".join(["$%s$" % c[1] for c in val_exo2]))
    cor.append(r"\end{tabularx} \medskip")
    cor.append(r"\begin{enumerate}")
    lpos21 = [i for i in range(7)]
    for dummy in range(3):
        del lpos21[randrange(len(lpos21))]
    shuffle(lpos21)
    lquest = [
        u"Quelle est l'image de $%s$ par la fonction $h$ ?" %
        val_exo2[lpos21[0]][0],
        u"Quel est l'antécédent de $%s$ par la fonction $h$ ?" %
        val_exo2[lpos21[1]][1],
        u"Compléter : $h\\,(%s)=\\ldots\\ldots$" % val_exo2[lpos21[2]][0],
        u"Compléter : $h\\,(\\ldots\\ldots)=%s$" % val_exo2[lpos21[3]][1]
    ]
    lpos22 = [0, 1, 2, 3]
    shuffle(lpos22)
    for i in range(4):
        exo.append(u"\\item %s" % lquest[lpos22[i]])
        if lpos22[i] == 0:
            cor.append(
                u"\\item L'image de $%s$ par la fonction $h$ est $\\mathbf{%s}$."
                % (val_exo2[lpos21[0]][0], val_exo2[lpos21[0]][1]))
        elif lpos22[i] == 1:
            cor.append(
                u"\\item Un antécédent de $%s$ par la fonction $h$ est $\\mathbf{%s}$."
                % (val_exo2[lpos21[1]][1], val_exo2[lpos21[1]][0]))
        if lpos22[i] == 2:
            cor.append(u"\\item $h\\,(%s)=\\mathbf{%s}$." %
                       (val_exo2[lpos21[2]][0], val_exo2[lpos21[2]][1]))
        elif lpos22[i] == 1:
            cor.append(u"\\item $h\\,(\\mathbf{%s})=%s$." %
                       (val_exo2[lpos21[3]][0], val_exo2[lpos21[3]][1]))

    exo.extend([r"\end{enumerate}", r"\columnbreak"])
    cor.append(r"\end{enumerate}")
    val_exo3 = choix_points()
    p = Priorites3.plotify(Priorites3.priorites(Lagrange(val_exo3))[-1])
    exo.extend([
        u"\\item Le graphique ci-dessous représente une fonction $k$ : \\par",
        r"\begin{center}", r"\psset{unit=8mm, algebraic, dotsize=4pt 4}",
        r"\begin{pspicture*}(-4.2,-4.2)(4.2,4.2)"
    ])
    exo.append(
        r"\psgrid[subgriddiv=2, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]"
    )
    exo.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-4.2,-4.2)(4.2,4.2)")
    exo.append(
        r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-4.2}{4.2}{%s}"
        % p)
    exo.append(r"\psdots %s" % " ".join([str(val) for val in val_exo3]))
    exo.extend([r"\end{pspicture*}", r"\end{center}", r"\begin{enumerate}"])
    cor.extend([
        u"\\item Le graphique ci-après représente une fonction $k$ : \\par",
        r"\begin{center}", r"\psset{unit=8mm, algebraic, dotsize=4pt 4}",
        r"\begin{pspicture*}(-4.2,-4.2)(4.2,4.2)"
    ])
    cor.append(
        r"\psgrid[subgriddiv=2, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]"
    )
    cor.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-4.2,-4.2)(4.2,4.2)")
    cor.append(
        r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-4.2}{4.2}{%s}"
        % p)
    cor.append(r"\psdots %s" % " ".join([str(val) for val in val_exo3]))
    lpos31 = [i for i in range(5)]
    for dummy in range(1):
        del lpos31[randrange(len(lpos31))]
    for i in range(4):
        cor.append(
            r"\psline[linestyle=dashed, linecolor=DarkRed](0, %s)(%s, %s)(%s, 0)"
            % (val_exo3[lpos31[i]][1], val_exo3[lpos31[i]][0],
               val_exo3[lpos31[i]][1], val_exo3[lpos31[i]][0]))
    cor.extend([r"\end{pspicture*}", r"\end{center}", r"\begin{enumerate}"])
    shuffle(lpos31)
    lquest = [
        u"Quelle est l'image de $%s$ par la fonction $k$ ?" %
        val_exo3[lpos31[0]][0],
        u"Donner un antécédent de %s par la fonction $k$." %
        val_exo3[lpos31[1]][1],
        u"Compléter : $k\\,(%s)=\\ldots\\ldots$" % val_exo3[lpos31[2]][0],
        u"Compléter : $k\\,(\\ldots\\ldots)=%s$" % val_exo3[lpos31[3]][1]
    ]
    lpos32 = [0, 1, 2, 3]
    shuffle(lpos32)
    for i in range(4):
        exo.append(u"\\item %s" % lquest[lpos32[i]])
        if lpos32[i] == 0:
            cor.append(
                u"\\item L'image de $%s$ par la fonction $k$ est $\\mathbf{%s}$."
                % (val_exo3[lpos31[0]][0], val_exo3[lpos31[0]][1]))
        elif lpos32[i] == 1:
            cor.append(
                u"\\item Un antécédent de $%s$ par la fonction $k$ est $\\mathbf{%s}$."
                % (val_exo3[lpos31[1]][1], val_exo3[lpos31[1]][0]))
        if lpos32[i] == 2:
            cor.append(u"\\item $k\\,(%s)=\\mathbf{%s}$." %
                       (val_exo3[lpos31[2]][0], val_exo3[lpos31[2]][1]))
        elif lpos32[i] == 3:
            cor.append(u"\\item $k\\,(\\mathbf{%s})=%s$." %
                       (val_exo3[lpos31[3]][0], val_exo3[lpos31[3]][1]))
    exo.append(r"\end{enumerate}")
    cor.append(r"\end{enumerate}")

    exo.append(r"\end{enumerate}")
    exo.append(r"\end{multicols}")
    cor.append(r"\end{enumerate}")
    cor.append(r"\end{multicols}")

    return exo, cor
예제 #4
0
def notion_fonction():
    """Créé un exercice bilan sur la notion de fonction"""
    from pyromaths.classes.PolynomesCollege import Polynome
    from pyromaths.outils import Priorites3
    fct = [eval(creer_fonction(1)), eval(creer_fonction(2))]
    ant = [randrange(1, 6) * (-1) ** fct[0].degre(), randrange(1, 6) * (-1) ** fct[1].degre(), randrange(1, 6) * (-1) ** fct[1].degre(), randrange(1, 6) * (-1) ** fct[0].degre()]
    shuffle(fct)
    val_exo2 = choix_points(nb=7)
    exo = [r"\exercice", r"\begin{multicols}{2}", r"\begin{enumerate}", u"\\item On donne"]
    exo.append(r"$\begin{array}[t]{l}")
    exo.append(u"f:~x \\longmapsto %s \\\\ g:~x \\longmapsto %s" % (fct[0], fct[1]))
    exo.extend([r"\end{array}$", r"\begin{enumerate}", ])
    exo.append(u"\\item Quelle est l'image de $%s$ par la fonction $f$ ?" % ant[0])
    cor = [r"\exercice", r"\begin{multicols}{2}", r"\begin{enumerate}", u"\\item On donne"]
    cor.append(r"$\begin{array}[t]{l}")
    cor.append(u"f:~x \\longmapsto %s \\\\ g:~x \\longmapsto %s" % (fct[0], fct[1]))
    cor.extend([r"\end{array}$", r"\begin{enumerate}", ])
    cor.append(u"\\item Quelle est l'image de $%s$ par la fonction $f$ ?" % ant[0])
    cor.extend(corrige('f', fct[0], ant[0]))
    exo.append(u"\\item Quelle est l'image de $%s$ par la fonction $g$ ?" % ant[1])
    cor.append(u"\\item Quelle est l'image de $%s$ par la fonction $g$ ?" % ant[1])
    cor.extend(corrige('g', fct[1], ant[1]))
    exo.append(u"\\item Calculer $f\\,(%s)$." % ant[2])
    cor.append(u"\\item Calculer $f\\,(%s)$." % ant[2])
    cor.extend(corrige('f', fct[0], ant[2]))
    exo.append(u"\\item Calculer $g\\,(%s)$." % ant[3])
    cor.append(u"\\item Calculer $g\\,(%s)$." % ant[3])
    cor.extend(corrige('g', fct[1], ant[3]))
    exo.append(r"\end{enumerate}")
    cor.append(r"\end{enumerate}")
    exo.append(u"\\item Voici un tableau de valeurs correspondant à une fonction $h$.\\par")
    exo.append(r"\renewcommand{\arraystretch}{1.5}")
    exo.append(r"\begin{tabularx}{\linewidth}[t]{|c|*7{>{\centering}X|}}")
    exo.append(r"\hline")
    exo.append(r"$x$ & %s \tabularnewline \hline" % " & ".join(["$%s$" % c[0] for c in val_exo2]))
    exo.append(r"$h\,(x)$ & %s \tabularnewline \hline" % " & ".join(["$%s$" % c[1] for c in val_exo2]))
    exo.append(r"\end{tabularx} \medskip")
    exo.append(r"\begin{enumerate}")
    cor.append(u"\\item Voici un tableau de valeurs correspondant à une fonction $h$.\\par")
    cor.append(r"\renewcommand{\arraystretch}{1.5}")
    cor.append(r"\begin{tabularx}{\linewidth}[t]{|c|*7{>{\centering}X|}}")
    cor.append(r"\hline")
    cor.append(r"$x$ & %s \tabularnewline \hline" % " & ".join(["$%s$" % c[0] for c in val_exo2]))
    cor.append(r"$h\,(x)$ & %s \tabularnewline \hline" % " & ".join(["$%s$" % c[1] for c in val_exo2]))
    cor.append(r"\end{tabularx} \medskip")
    cor.append(r"\begin{enumerate}")
    lpos21 = [i for i in range(7)]
    for dummy in range(3):
        del lpos21[randrange(len(lpos21))]
    shuffle(lpos21)
    lquest = [u"Quelle est l'image de $%s$ par la fonction $h$ ?" % val_exo2[lpos21[0]][0],
              u"Quel est l'antécédent de $%s$ par la fonction $h$ ?" % val_exo2[lpos21[1]][1],
              u"Compléter : $h\\,(%s)=\\ldots\\ldots$" % val_exo2[lpos21[2]][0],
              u"Compléter : $h\\,(\\ldots\\ldots)=%s$" % val_exo2[lpos21[3]][1]]
    lpos22 = [0, 1, 2, 3]
    shuffle(lpos22)
    for i in range(4):
        exo.append(u"\\item %s" % lquest[lpos22[i]])
        if lpos22[i] == 0:
            cor.append(u"\\item L'image de $%s$ par la fonction $h$ est $\\mathbf{%s}$." % (val_exo2[lpos21[0]][0], val_exo2[lpos21[0]][1]))
        elif lpos22[i] == 1:
            cor.append(u"\\item Un antécédent de $%s$ par la fonction $h$ est $\\mathbf{%s}$." % (val_exo2[lpos21[1]][1], val_exo2[lpos21[1]][0]))
        if lpos22[i] == 2:
            cor.append(u"\\item $h\\,(%s)=\\mathbf{%s}$." % (val_exo2[lpos21[2]][0], val_exo2[lpos21[2]][1]))
        elif lpos22[i] == 1:
            cor.append(u"\\item $h\\,(\\mathbf{%s})=%s$." % (val_exo2[lpos21[3]][0], val_exo2[lpos21[3]][1]))

    exo.extend([r"\end{enumerate}", r"\columnbreak"])
    cor.append(r"\end{enumerate}")
    val_exo3 = choix_points()
    p = Priorites3.plotify(Priorites3.priorites(Lagrange(val_exo3))[-1])
    exo.extend([u"\\item Le graphique ci-dessous représente une fonction $k$ : \\par", r"\begin{center}",
                r"\psset{unit=8mm, algebraic, dotsize=4pt 4}", r"\begin{pspicture*}(-4.2,-4.2)(4.2,4.2)"])
    exo.append(r"\psgrid[subgriddiv=2, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]")
    exo.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-4.2,-4.2)(4.2,4.2)")
    exo.append(r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-4.2}{4.2}{%s}" % p)
    exo.append(r"\psdots %s" % " ".join([str(val) for val in val_exo3]))
    exo.extend([r"\end{pspicture*}", r"\end{center}", r"\begin{enumerate}"])
    cor.extend([u"\\item Le graphique ci-après représente une fonction $k$ : \\par", r"\begin{center}",
                r"\psset{unit=8mm, algebraic, dotsize=4pt 4}", r"\begin{pspicture*}(-4.2,-4.2)(4.2,4.2)"])
    cor.append(r"\psgrid[subgriddiv=2, gridwidth=.6pt,subgridcolor=lightgray, gridlabels=0pt]")
    cor.append(r"\psaxes[linewidth=1.2pt,]{->}(0,0)(-4.2,-4.2)(4.2,4.2)")
    cor.append(r"\psplot[plotpoints=200, linewidth=1.5pt, linecolor=DarkRed]{-4.2}{4.2}{%s}" % p)
    cor.append(r"\psdots %s" % " ".join([str(val) for val in val_exo3]))
    lpos31 = [i for i in range(5)]
    for dummy in range(1):
        del lpos31[randrange(len(lpos31))]
    for i in range(4):
        cor.append(r"\psline[linestyle=dashed, linecolor=DarkRed](0, %s)(%s, %s)(%s, 0)" % (val_exo3[lpos31[i]][1], val_exo3[lpos31[i]][0], val_exo3[lpos31[i]][1], val_exo3[lpos31[i]][0]))
    cor.extend([r"\end{pspicture*}", r"\end{center}", r"\begin{enumerate}"])
    shuffle(lpos31)
    lquest = [u"Quelle est l'image de $%s$ par la fonction $k$ ?" % val_exo3[lpos31[0]][0],
              u"Donner un antécédent de %s par la fonction $k$." % val_exo3[lpos31[1]][1],
              u"Compléter : $k\\,(%s)=\\ldots\\ldots$" % val_exo3[lpos31[2]][0],
              u"Compléter : $k\\,(\\ldots\\ldots)=%s$" % val_exo3[lpos31[3]][1]]
    lpos32 = [0, 1, 2, 3]
    shuffle(lpos32)
    for i in range(4):
        exo.append(u"\\item %s" % lquest[lpos32[i]])
        if lpos32[i] == 0:
            cor.append(u"\\item L'image de $%s$ par la fonction $k$ est $\\mathbf{%s}$." % (val_exo3[lpos31[0]][0], val_exo3[lpos31[0]][1]))
        elif lpos32[i] == 1:
            cor.append(u"\\item Un antécédent de $%s$ par la fonction $k$ est $\\mathbf{%s}$." % (val_exo3[lpos31[1]][1], val_exo3[lpos31[1]][0]))
        if lpos32[i] == 2:
            cor.append(u"\\item $k\\,(%s)=\\mathbf{%s}$." % (val_exo3[lpos31[2]][0], val_exo3[lpos31[2]][1]))
        elif lpos32[i] == 1:
            cor.append(u"\\item $k\\,(\\mathbf{%s})=%s$." % (val_exo3[lpos31[3]][0], val_exo3[lpos31[3]][1]))
    exo.append(r"\end{enumerate}")
    cor.append(r"\end{enumerate}")



    exo.append(r"\end{enumerate}")
    exo.append(r"\end{multicols}")
    cor.append(r"\end{enumerate}")
    cor.append(r"\end{multicols}")

    return exo, cor