コード例 #1
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def thales(exo, cor):
    typeexo = [-1, 1]
    random.shuffle(typeexo)
    exo.append("\\begin{multicols}{2}")
    cor.append("\\begin{multicols}{2}")
    for i in range(2):
        arrondi = random.randrange(1, 4)
        text_arrondi = ['dix', 'cent', 'mill'][arrondi - 1] + u'ième'
        noms = choix_points(5)  # les noms des sommets
        while True:
            valeurs = valeurs_thales(70, typeexo[i])  # les longueurs en mm
            if valeurs:
                break
        exo.append(tex_enonce_thales(noms, valeurs, text_arrondi))
        exo.append(tex_fig_thales(noms, valeurs))
        cor.append(tex_enonce_thales(noms, valeurs, text_arrondi))
        cor.append(tex_fig_thales(noms, valeurs) +
                 "\n\\par\\dotfill{}")
        cor.append(tex_resolution_thales0(noms))
        cor.append(tex_resolution_thales1(noms, valeurs))
        cor.append(tex_resolution_thales2(noms, valeurs))
        cor.append(tex_resolution_thales3(noms, valeurs, arrondi))
        if not i:
            exo.append("\\columnbreak")
            cor.append("\\columnbreak")
        else:
            exo.append("\\end{multicols}")
            cor.append("\\end{multicols}")
コード例 #2
0
def thales(exo, cor):
    typeexo = [-1, 1]
    random.shuffle(typeexo)
    for i in range(2):
        arrondi = random.randrange(1, 4)
        text_arrondi = ['dix', 'cent', 'mill'][arrondi - 1] + u'ième'
        noms = choix_points(5)  # les noms des sommets
        while True:
            valeurs = valeurs_thales(70, typeexo[i])  # les longueurs en mm
            if valeurs:
                break
        exo.append(r"\figureadroite{%")
        cor.append(r"\figureadroite{%")
        exo.append(tex_fig_thales(noms, valeurs))
        cor.append(tex_fig_thales(noms, valeurs))
        exo.append("}{%")
        cor.append("}{%")
        exo.append(tex_enonce_thales(noms, valeurs, text_arrondi))
        cor.append(tex_enonce_thales(noms, valeurs, text_arrondi))
        exo.append(r"}\par")
        cor.append(r"}\par")
        cor.append(tex_resolution_thales0(noms))
        cor.append(tex_resolution_thales1(noms, valeurs))
        cor.append(tex_resolution_thales2(noms, valeurs))
        cor.append(tex_resolution_thales3(noms, valeurs, arrondi))
コード例 #3
0
def rec_thales(exo, cor):
    noms = choix_points(5)  # les noms des sommets
    valeurs = valeurs_reciproque_thales()
    exo.append(tex_fig_rec_thales(noms, valeurs))
    exo.append(tex_enonce_rec_thales(noms, valeurs) + '\\vspace{2cm}}')  # le dernier '}' ferme le bloc exercice
    cor.append(tex_fig_rec_thales(noms, valeurs))
    cor.append(tex_enonce_rec_thales(noms, valeurs) +
             "\\par\\dotfill{}\\\\}\n")
    cor.append(tex_resolution_rec_thales0(noms, valeurs))
    cor.append(tex_resolution_rec_thales1(noms, valeurs))
コード例 #4
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def rec_thales(exo, cor):
    noms = choix_points(5)  # les noms des sommets
    valeurs = valeurs_reciproque_thales()
    exo.append(tex_fig_rec_thales(noms, valeurs))
    exo.append(tex_enonce_rec_thales(noms, valeurs) + '\\vspace{2cm}}')  # le dernier '}' ferme le bloc exercice
    cor.append(tex_fig_rec_thales(noms, valeurs))
    cor.append(tex_enonce_rec_thales(noms, valeurs) +
             "\\par\\dotfill{}\\\\}\n")
    cor.append(tex_resolution_rec_thales0(noms, valeurs))
    cor.append(tex_resolution_rec_thales1(noms, valeurs))
コード例 #5
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def exo_trigo():
    exo = ["\\exercice"]
    cor = ["\\exercice*"]
    s = choix_points(6)
    n1 = cotes_sommets(s[0:3])
    n2 = cotes_sommets(s[3:6])
    v = valeurs_trigo()
    (l1, l2) = enonce_trigo(((s[0:3], n1, v[0]), (s[3:6], n2, v[1])))
    exo.extend(l1)
    cor.extend(l2)
    return (exo, cor)
コード例 #6
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def exo_thales():
    exo = ["\\exercice"]
    cor = ["\\exercice*"]
    noms = choix_points(5)  # les noms des sommets
    arrondi = random.randrange(1, 4)
    text_arrondi = ['dix', 'cent', 'mill'][arrondi - 1] + u'ième'
    while True:
        valeurs = valeurs_thales(70)  # les longueurs en mm
        if valeurs:
            break
    exo.append(tex_fig_thales(noms, valeurs))
    exo.append(tex_enonce_thales(noms, valeurs, text_arrondi))
    cor.append(tex_fig_thales(noms, valeurs))
    cor.append(tex_enonce_thales(noms, valeurs, text_arrondi))
    cor.append(tex_resolution_thales0(noms, valeurs))
    cor.append(tex_resolution_thales1(noms, valeurs))
    cor.append(tex_resolution_thales2(noms, valeurs))
    cor.append(tex_resolution_thales3(noms, valeurs, arrondi))
    return (exo, cor)
コード例 #7
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def exo_reciproque_pythagore():
    exo = ["\\exercice"]
    cor = ["\\exercice*"]
    while True:
        longueurs = couples_pythagore[random.randrange(len(couples_pythagore))]
        longueurs = [longueurs[i] / 10.0 for i in range(3)]
        if inegalite_triangulaire(longueurs):
            break
    noms = choix_points(3)
    nom_tr = nom_triangle(noms)
    l = [i for i in range(3)]
    n = [l.pop(random.randrange(3 - i)) for i in range(3)]
    c = cotes_sommets(noms)
    recip = (nom_tr, c[n[0]], nombre(longueurs[n[0]]), c[n[1]], nombre(longueurs[n[1]]),
             c[n[2]], nombre(longueurs[n[2]]), nom_tr)
    enonce = \
        """Soit $%s$ un triangle tel que : $\\quad %s=\\unit[%s]{cm}\\quad$, $\\quad %s=\\unit[%s]{cm}\\quad$ et $\\quad %s=\\unit[%s]{cm}$.\\par
Quelle est la nature du triangle $%s$?
""" % \
        recip
    exo.append(enonce)
    cor.append(enonce)
    cor.append("\\par\\dotfill{}\\\\\n")
    cor.append(u"Le triangle %s n'est ni isocèle, ni équilatéral.\\par\n" %
               nom_tr)
    cor.append("$\\left.")
    cor.append("\\renewcommand{\\arraystretch}{2}")
    cor.append("\\begin{array}{l}")

    cor.append(u"\\bullet %s^2=%s^2=%s\\qquad\\text{(}[%s]\\text{ est le plus grand côté.)}\\\\\n" %
               (c[2], nombre(longueurs[2]), nombre(longueurs[2] ** 2), c[2]))
    cor.append("\\bullet  %s^2+%s^2=%s^2+%s^2=%s \n" % (c[0], c[1],
               nombre(longueurs[0]), nombre(longueurs[1]), nombre(longueurs[0] **
               2 + longueurs[1] ** 2)))
    cor.append("\\end{array}")
    cor.append("\\right\\rbrace$")
    cor.append(u"""Donc $%s^2=%s^2+%s^2$.\\par
D'après la \\textbf{réciproque du théorème de Pythagore},
\\fbox{le triangle $%s$ est rectangle en $%s$.}""" %
               (c[2], c[0], c[1], nom_tr, noms[2]))
    return (exo, cor)
コード例 #8
0
def trigo_init(exo, cor):
    s = choix_points(6)
    n1 = cotes_sommets(s[0:3])
    n2 = cotes_sommets(s[3:6])
    v = valeurs_trigo()
    enonce_trigo(exo, cor, ((s[0:3], n1, v[0]), (s[3:6], n2, v[1])))
コード例 #9
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def trigo_init(exo, cor):
    s = choix_points(6)
    n1 = cotes_sommets(s[0:3])
    n2 = cotes_sommets(s[3:6])
    v = valeurs_trigo()
    enonce_trigo(exo, cor, ((s[0:3], n1, v[0]), (s[3:6], n2, v[1])))
コード例 #10
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def exo_pythagore():
    types_exercice = [[2, random.randrange(2)], [0, 1]]
    random.shuffle(types_exercice)
    random.shuffle(types_exercice[0])
    random.shuffle(types_exercice[1])
    exo = ["\\exercice\n\\begin{multicols}{2}\n  \\begin{enumerate}"]
    cor = ["\\exercice*\n\\begin{multicols}{2}\n  \\begin{enumerate}"]
    for j in range(2):
        while True:
            longueurs = couples_pythagore[random.randrange(len(couples_pythagore))]
            longueurs = [longueurs[i] / 10.0 for i in range(3)]
            if inegalite_triangulaire(longueurs):
                break
        noms = choix_points(3)
        angles = fig_tr_rect(longueurs)
        nom_tr = nom_triangle(noms)
        long0 , long1 = types_exercice[j]
        cotes = cotes_sommets(noms)
        enonce = \
            """    \\item Soit $%s$ un triangle rectangle en $%s$ tel que :\\par
$%s=\\unit[%s]{cm}$ et $%s=\\unit[%s]{cm}$.\\par
Calculer la longueur $%s$.""" % \
            enonce_pythagore(noms, angles, longueurs, cotes, nom_tr, long0,
                             long1)
        exo.append(enonce)
        cor.append(enonce)
        cor.append("\\par\\dotfill{}\\par\n")
        cor.append(u"Le triangle $%s$ est rectangle en $%s$.\\par" % \
                   (nom_tr, noms[2]))
        cor.append(u"Son hypoténuse est $[%s]$.\\par" % (cotes[2]))
        cor.append(u"D'après le \\textbf{théorème de Pythagore} :")
        cor.append("\\[%s^2=%s^2+%s^2\\]" % (cotes[2], cotes[0], cotes[1]))
        if long0 == 2 or long1 == 2:
            cor.append("\\[%s^2=%s^2-%s^2\\kern1cm\\text{(On cherche }%s)\\]" %
                       (cotes[(3 - long0) - long1], cotes[2], cotes[((4 -
                       long0) - long1) % 2], cotes[(3 - long0) - long1]))
        if long0 == 2 or long1 == 2:
            cor.append("\\[%s^2=%s^2-%s^2\\]" % (cotes[(3 - long0) - long1],
                       nombre(longueurs[2]), nombre(longueurs[((4 - long0) -
                       long1) % 2])))
        else:
            cor.append("\\[%s^2=%s^2+%s^2\\]" % (cotes[2], nombre(longueurs[0]),
                       nombre(longueurs[1])))
        if long0 == 2 or long1 == 2:
            cor.append("\\[%s^2=%s-%s\\]" % (cotes[(3 - long0) - long1],
                       nombre(longueurs[2] ** 2), nombre(longueurs[((4 -
                       long0) - long1) % 2] ** 2)))
        else:
            cor.append("\\[%s^2=%s+%s\\]" % (cotes[2], nombre(longueurs[0] **
                       2), nombre(longueurs[1] ** 2)))
        if long0 == 2 or long1 == 2:
            cor.append("\\[%s^2=%s\\]" % (cotes[(3 - long0) - long1],
                       nombre(longueurs[2] ** 2 - longueurs[((4 - long0) -
                       long1) % 2] ** 2)))
        else:
            cor.append("\\[%s^2=%s\\]" % (cotes[2], nombre(longueurs[0] **
                       2 + longueurs[1] ** 2)))
        if long0 == 2 or long1 == 2:
            cor.append("\\[ \\boxed{\\text{Donc }%s=\\sqrt{%s}=\\unit[%s]{cm}}\\]" %
                       (cotes[(3 - long0) - long1], nombre(longueurs[2] ** 2 -
                       longueurs[((4 - long0) - long1) % 2] ** 2), nombre(longueurs[(3 -
                       long0) - long1])))
        else:
            cor.append("\\[\\boxed{\\text{Donc }%s=\\sqrt{%s}=\\unit[%s]{cm}}\\]" %
                       (cotes[2], nombre(longueurs[0] ** 2 + longueurs[1] **
                       2), nombre(longueurs[2])))
        if j == 0:
            exo.append("\\columnbreak")
            cor.append("\\columnbreak")
    exo.append("\\end{enumerate}\n\\end{multicols}\n")
    cor.append("\\end{enumerate}\n\\end{multicols}\n")
    return (exo, cor)
コード例 #11
0
ファイル: geometrie.py プロジェクト: Lafrite/pyromaths
def exo_triangle_cercle():
    exo = ["\\exercice"]
    cor = ["\\exercice*"]
    while True:
        longueurs = couples_pythagore[random.randrange(len(couples_pythagore))]
        longueurs = [longueurs[i] / 10.0 for i in range(3)]
        if inegalite_triangulaire(longueurs):
            break
    noms = choix_points(3)
    angles = fig_tr_rect(longueurs)
    nom_tr = nom_triangle(noms)
    long0 = random.randrange(3)
    long1 = (random.randrange(2) + 1 + long0) % 3
    cotes = cotes_sommets(noms)
    enonce = \
        u"""\\begin{minipage}{4cm}
\\begin{pspicture}(-2,-2)(2,2)
\\SpecialCoor\\psset{PointSymbol=none}
\\pstGeonode[PointName=%s,PosAngle=%s](1.5;%s){a}
\\pstGeonode[PointName=%s,PosAngle=%s](1.5;%s){b}
\\pstGeonode[PointName=%s,PosAngle=%s](1.5;%s){c}
\\pspolygon(a)(b)(c)\\pscircle(0,0){1.5}
\\rput(1.8;%s){$\\big(\\mathcal{C}\\big)$}
\\end{pspicture}
\\end{minipage}\\hfill
\\begin{minipage}{13cm}
$\\big(\\mathcal{C}\\big)$ est un cercle de diamètre $[%s]$ et $%s$ est un point de $\\big(\\mathcal{C}\\big)$.\\par
On donne $%s=\\unit[%s]{cm}$ et $%s=\\unit[%s]{cm}$.\\par
Calculer la longueur $%s$.""" % \
        enonce_pythagore(noms, angles, longueurs, cotes, nom_tr, long0,
                         long1, diam=1)
    exo.append(enonce)
    cor.append(enonce)
    cor.append("\\par\\dotfill{}\\\\\n")
    cor.append(u"$[%s]$ est le diamètre du cercle circonscrit au triangle $%s$.\\par" %
               (cotes[2], nom_tr))
    cor.append("\\fbox{Donc le triangle %s est rectangle en %s.}\\\\\n" %
               (nom_tr, noms[2]))
    cor.append(u"D'après le \\textbf{théorème de Pythagore} :")
    cor.append(u"\\[%s^2=%s^2+%s^2\\kern1cm\\text{(car }[%s]\\text{ est \\emph{l'hypoténuse})}\\]" %
               (cotes[2], cotes[0], cotes[1], cotes[2]))
    if long0 == 2 or long1 == 2:
        cor.append("\\[%s^2=%s^2-%s^2\\kern1cm\\text{(On cherche }%s)\\]" %
                   (cotes[(3 - long0) - long1], cotes[2], cotes[((4 -
                   long0) - long1) % 2], cotes[(3 - long0) - long1]))
    if long0 == 2 or long1 == 2:
        cor.append("\\[%s^2=%s^2-%s^2\\]" % (cotes[(3 - long0) - long1],
                   nombre(longueurs[2]), nombre(longueurs[((4 - long0) -
                   long1) % 2])))
    else:
        cor.append("\\[%s^2=%s^2+%s^2\\]" % (cotes[2], nombre(longueurs[0]),
                   nombre(longueurs[1])))
    if long0 == 2 or long1 == 2:
        cor.append("\\[%s^2=%s-%s\\]" % (cotes[(3 - long0) - long1],
                   nombre(longueurs[2] ** 2), nombre(longueurs[((4 -
                   long0) - long1) % 2] ** 2)))
    else:
        cor.append("\\[%s^2=%s+%s\\]" % (cotes[2], nombre(longueurs[0] **
                   2), nombre(longueurs[1] ** 2)))
    if long0 == 2 or long1 == 2:
        cor.append("\\[%s^2=%s\\]" % (cotes[(3 - long0) - long1],
                   nombre(longueurs[2] ** 2 - longueurs[((4 - long0) -
                   long1) % 2] ** 2)))
    else:
        cor.append("\\[%s^2=%s\\]" % (cotes[2], nombre(longueurs[0] **
                   2 + longueurs[1] ** 2)))
    if long0 == 2 or long1 == 2:
        cor.append("\\[\\boxed{\\text{Donc }%s=\\sqrt{%s}=\\unit[%s]{cm}}\\]" %
                   (cotes[(3 - long0) - long1], nombre(longueurs[2] ** 2 -
                   longueurs[((4 - long0) - long1) % 2] ** 2), nombre(longueurs[(3 -
                   long0) - long1])))
    else:
        cor.append("\\[\\boxed{\\text{Donc }%s=\\sqrt{%s}=\\unit[%s]{cm}}\\]" %
                   (cotes[2], nombre(longueurs[0] ** 2 + longueurs[1] **
                   2), nombre(longueurs[2])))
    exo.append("\\end{minipage}\n")
    cor.append("\\end{minipage}\n")
    return (exo, cor)