def tex_systeme(v, p=None): # renvoie l'écriture au format tex d'un système d'équations. v[] est de la forme ((a0, b0, c0), (a1, b1, c1), (x,y)) if p == None: tv = (tex_coef(v[0][0], 'x'), signe(v[0][1]), tex_coef(abs(v[0][1]), 'y'), v[0][2], tex_coef(v[1][0], 'x'), signe(v[1][1]), tex_coef(abs(v[1][1]), 'y'), v[1][2]) return '''\\left\\lbrace \\begin{array}{rcrcl} %s & %s & %s & = & %s \\\\\n %s & %s & %s & = & %s \\end{array} \\right.''' % \ tv else: tv = ( tex_coef(v[0][0], 'x'), signe(v[0][1]), tex_coef(abs(v[0][1]), 'y'), v[0][2], '\\qquad\\hbox{\\footnotesize$\\mathit{(\\times %s)}$}' % tex_coef(p[0], '', bpn=1), tex_coef(v[1][0], 'x'), signe(v[1][1]), tex_coef(abs(v[1][1]), 'y'), v[1][2], '\\qquad\\hbox{\\footnotesize$\\mathit{(\\times %s)}$}' % tex_coef(p[1], '', bpn=1), ) return '''\\left\\lbrace \\begin{array}{rcrcll} %s & %s & %s & = & %s & %s \\\\\n %s & %s & %s & = & %s & %s \\end{array} \\right.''' % \ tv
def main(): exo = ["\\exercice", "Effectuer sans calculatrice :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] cor = ["\\exercice*", "Effectuer sans calculatrice :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] modules = (plus, moins, plus, div) calculs = [i for i in range(20)] for i in range(20): j = random.randrange(0, len(calculs)) (a, b) = modules[calculs[j] // 5](10) if calculs[j] // 5 == 0: choix_trou(a, tex_coef(b, '', bpn=1), a + b, '+', exo, cor) if calculs[j] // 5 == 1: choix_trou(a, tex_coef(b, '', bpn=1), a - b, '-', exo, cor) if calculs[j] // 5 == 2: choix_trou(a, tex_coef(b, '', bpn=1), a * b, '\\times', exo, cor) if calculs[j] // 5 == 3: choix_trou(a, tex_coef(b, '', bpn=1), a // b, '\\div', exo, cor) calculs.pop(j) exo.extend([" \\end{enumerate}", "\\end{multicols}"]) cor.extend([" \\end{enumerate}", "\\end{multicols}"]) return (exo, cor)
def calcul_mental(): exo = [ "\\exercice", "Effectuer sans calculatrice :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}" ] cor = [ "\\exercice*", "Effectuer sans calculatrice :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}" ] modules = (plus, moins, plus, div) calculs = [i for i in range(20)] for i in range(20): j = random.randrange(0, len(calculs)) (a, b) = modules[calculs[j] // 5](10) if calculs[j] // 5 == 0: choix_trou(a, tex_coef(b, '', bpn=1), a + b, '+', exo, cor) if calculs[j] // 5 == 1: choix_trou(a, tex_coef(b, '', bpn=1), a - b, '-', exo, cor) if calculs[j] // 5 == 2: choix_trou(a, tex_coef(b, '', bpn=1), a * b, '\\times', exo, cor) if calculs[j] // 5 == 3: choix_trou(a, tex_coef(b, '', bpn=1), a // b, '\\div', exo, cor) calculs.pop(j) exo.extend([" \\end{enumerate}", "\\end{multicols}"]) cor.extend([" \\end{enumerate}", "\\end{multicols}"]) return (exo, cor)
def tex_equation4(valeurs): # renvoie l'ecriture de l'equation avec l'inconnue d'un cote de l'egalite texte = tex_coef(valeurs[4][0] + valeurs[4][2] * valeurs[3][1], 'x') + tex_coef(-valeurs[4][4], 'x', bplus=1) texte = texte + '=' + tex_coef(valeurs[4][5], '') + \ tex_coef(-valeurs[4][1] - valeurs[4][3] * valeurs[3][1], '', bplus=1) return texte
def tex_systeme( v, p=None ): # renvoie l'écriture au format tex d'un système d'équations. v[] est de la forme ((a0, b0, c0), (a1, b1, c1), (x,y)) if p == None: tv = (tex_coef(v[0][0], 'x'), signe(v[0][1]), tex_coef(abs(v[0][1]), 'y'), v[0][2], tex_coef(v[1][0], 'x'), signe(v[1][1]), tex_coef(abs(v[1][1]), 'y'), v[1][2]) return '''\\left\\lbrace \\begin{array}{rcrcl} %s & %s & %s & = & %s \\\\\n %s & %s & %s & = & %s \\end{array} \\right.''' % \ tv else: tv = ( tex_coef(v[0][0], 'x'), signe(v[0][1]), tex_coef(abs(v[0][1]), 'y'), v[0][2], '\\qquad\\hbox{\\footnotesize$\\mathit{(\\times %s)}$}' % tex_coef(p[0], '', bpn=1), tex_coef(v[1][0], 'x'), signe(v[1][1]), tex_coef(abs(v[1][1]), 'y'), v[1][2], '\\qquad\\hbox{\\footnotesize$\\mathit{(\\times %s)}$}' % tex_coef(p[1], '', bpn=1), ) return '''\\left\\lbrace \\begin{array}{rcrcll} %s & %s & %s & = & %s & %s \\\\\n %s & %s & %s & = & %s & %s \\end{array} \\right.''' % \ tv
def relatifs(): exo = ["\\exercice", _("Effectuer sans calculatrice :"), "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] cor = ["\\exercice*", _("Effectuer sans calculatrice :"), "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] modules = (plus, moins,) modules_dec = (plus_dec, moins_dec,) calculs = [i for i in range(20)] random.shuffle(calculs) for j in range(4): (a, b) = modules[calculs[j] // 10](10) choix_trou(a, tex_coef(b, '', bpn=1), a + b, '+', exo, cor) for j in range(4, 14): (a, b) = modules[calculs[j] // 10](10) if calculs[j] // 10 == 0: choix_trou(a, tex_coef(b, '', bpn=1), a + b, '+', exo, cor) if calculs[j] // 10 == 1: choix_trou(a, tex_coef(b, '', bpn=1), a - b, '-', exo, cor) for j in range(14, 20): (a, b) = modules_dec[calculs[j] // 10](10) if calculs[j] // 10 == 0: choix_trou(TeX(a), tex_coef(b, '', bpn=1), TeX(a + b), '+', exo, cor) if calculs[j] // 10 == 1: choix_trou(TeX(a), tex_coef(b, '', bpn=1), TeX(a - b), '-', exo, cor) exo.extend([" \\end{enumerate}", "\\end{multicols}"]) cor.extend([" \\end{enumerate}", "\\end{multicols}"]) return (exo, cor)
def tex_comb3(v): if v[0]: tv = (tex_coef(v[0], 'x'), tex_coef(v[2], '')) else: tv = (tex_coef(v[1], 'y'), tex_coef(v[2], '')) return '%s=%s' % tv
def tex_comb4(v): if v[0]: tv = (tex_coef(1, 'x'), v[2], v[0], tex_coef(v[2] // v[0], '')) else: tv = (tex_coef(1, 'y'), v[2], v[1], tex_coef(v[2] // v[1], '')) return '%s=\\frac{%s}{%s}=%s' % tv
def tex_equation5( valeurs ): # renvoie l'ecriture reduite de l'equation avec l'inconnue d'un cote de l'egalite texte = tex_coef( (valeurs[4][0] + valeurs[4][2] * valeurs[3][1]) - valeurs[4][4], 'x') texte = texte + '=' + tex_coef( (valeurs[4][5] - valeurs[4][1]) - valeurs[4][3] * valeurs[3][1], '') return texte
def tex_equation4( valeurs ): # renvoie l'ecriture de l'equation avec l'inconnue d'un cote de l'egalite texte = tex_coef(valeurs[4][0] + valeurs[4][2] * valeurs[3][1], 'x') + tex_coef(-valeurs[4][4], 'x', bplus=1) texte = texte + '=' + tex_coef(valeurs[4][5], '') + \ tex_coef(-valeurs[4][1] - valeurs[4][3] * valeurs[3][1], '', bplus=1) return texte
def tex_proprietes_neg(): exo = ["\\exercice", u"Écrire sous la forme d'une puissance de 10 puis donner l'écriture", u" décimale de ces nombres :", "\\begin{multicols}{2}", " \\noindent%", " \\begin{enumerate}"] cor = ["\\exercice*", u"Écrire sous la forme d'une puissance de 10 puis donner l'écriture", u" décimale de ces nombres :", "\\begin{multicols}{2}", " \\noindent%", " \\begin{enumerate}"] lexos = [0, 1, 2, 3, 0, 1, 2, 3] # 0: a^n*a^p ; 1: (a^n)^p ; 2:a^n/a^p for dummy in range(len(lexos)): lexp = [randrange(-6, 6) for dummy in range(2)] j = lexos.pop(randrange(len(lexos))) # FIXME : À finir if j == 0: while abs(lexp[0] + lexp[1]) > 10: lexp = [randrange(-6, 6) for dummy in range(2)] exo.append("\\item $10^{%s} \\times 10^{%s} = \\dotfill$" % tuple(lexp)) cor.append("\\item $10^{%s}\\times 10^{%s}=" % tuple(lexp)) cor.append("10^{%s+%s}=" % (lexp[0], tex_coef(lexp[1], '', bpn=1))) cor.append("10^{%s}=%s$" % (lexp[0] + lexp[1], decimaux(10 ** (lexp[0] + lexp[1]), 1))) elif j == 1: while abs(lexp[0] * lexp[1]) > 10: lexp = [randrange(-6, 6) for dummy in range(2)] exo.append("\\item $(10^{%s})^{%s}=\\dotfill$" % (lexp[0], lexp[1])) cor.append("\\item $(10^{%s})^{%s}=" % tuple(lexp)) cor.append("10^{%s \\times %s}=" % (lexp[0], tex_coef(lexp[1], '', bpn=1))) cor.append("10^{%s}=%s$" % (lexp[0] * lexp[1], decimaux(10 ** (lexp[0] * lexp[1]), 1))) elif j == 2: while abs(lexp[0] - lexp[1]) > 10: lexp = [randrange(-6, 6) for dummy in range(2)] exo.append("\\item $\\dfrac{10^{%s}}{10^{%s}}=\\dotfill$" % tuple(lexp)) cor.append("\\item $\\dfrac{10^{%s}}{10^{%s}}=" % tuple(lexp)) cor.append("10^{%s-%s}=" % (lexp[0], tex_coef(lexp[1], '', bpn=1))) cor.append("10^{%s}=%s$" % (lexp[0] - lexp[1], decimaux(10 ** (lexp[0] - lexp[1]), 1))) exo.append("\\end{enumerate}") exo.append("\\end{multicols}\n") cor.append("\\end{enumerate}") cor.append("\\end{multicols}\n") return (exo, cor)
def exo_entier1(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % (v[1] ** 2 * v[4])), tex_coef(v[2], '\\sqrt{%s}' % (v[3] ** 2 * v[4]))) exo.append(u'\\[ \\thenocalcul = ' + '\\frac{%s}{%s}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\frac{%s}{%s}' % a + '\\] ') a = (v[0], v[1] ** 2, v[4], v[2], v[3] ** 2, v[4]) cor.append(u'\\[ \\thenocalcul = ' + '\\frac{%s\\times\\sqrt{%s}\\times\\cancel{\\sqrt{%s}}}{%s\\times\\sqrt{%s}\\times\\cancel{\\sqrt{%s}}}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\frac{%s\\times %s}{%s\\times %s}' % v[0:4] + '\\] ') cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % (((v[0] * v[1]) // v[2]) // v[3]) + '} \\] ')
def exo_entier0(exo, cor, v): a = (v[0], tex_coef(v[1], '\\sqrt{%s}' % v[2], bplus=1), v[0], tex_coef(-v[1], '\\sqrt{%s}' % v[2], bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)\\left( %s%s \\right)' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)\\left( %s%s \\right)' % a + '\\] ') a = (tex_coef(v[0], '', bpc=1), tex_coef(abs(v[1]), '\\sqrt{%s}' % v[2], bpc=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s^2-%s^2' % a + '\\] ') a = (v[0] ** 2, v[1] ** 2, v[2]) cor.append(u'\\[ \\thenocalcul = ' + '%s-%s\\times %s' % a + '\\] ') cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % (v[0] ** 2 - v[1] ** 2 * v[2]) + '} \\] ')
def exo_aPbRc(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % v[1]), tex_coef(v[2], '\\sqrt{%s}' % v[3], bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)^2' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)^2' % a + '\\] ') if v[2] > 0: sgn = '+' else: sgn = '-' a = (tex_coef(v[0], '\\sqrt{%s}' % v[1], bpc=1), sgn, tex_coef(v[0], '\\sqrt{%s}' % v[1]), tex_coef(abs(v[2]), '\\sqrt{%s}' % v[3]), tex_coef(abs(v[2]), '\\sqrt{%s}' % v[3], bpc=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s^2%s2\\times%s\\times%s+%s^2' % a + '\\] ') a = (v[0]**2, v[1], tex_coef((2 * v[0]) * v[2], '\\sqrt{%s}' % (v[1] * v[3]), bplus=1), v[2]**2, v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times %s %s+%s\\times %s' % a + '\\] ') a = (v[0]**2 * v[1] + v[2]**2 * v[3], tex_coef((2 * v[0]) * v[2], '\\sqrt{%s}' % (v[1] * v[3]), bplus=1)) cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s%s' % a + '} \\] ')
def exo_entier1(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % (v[1]**2 * v[4])), tex_coef(v[2], '\\sqrt{%s}' % (v[3]**2 * v[4]))) exo.append(u'\\[ \\thenocalcul = ' + '\\frac{%s}{%s}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\frac{%s}{%s}' % a + '\\] ') a = (v[0], v[1]**2, v[4], v[2], v[3]**2, v[4]) cor.append( u'\\[ \\thenocalcul = ' + '\\frac{%s\\times\\sqrt{%s}\\times\\cancel{\\sqrt{%s}}}{%s\\times\\sqrt{%s}\\times\\cancel{\\sqrt{%s}}}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\frac{%s\\times %s}{%s\\times %s}' % v[0:4] + '\\] ') cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % (((v[0] * v[1]) // v[2]) // v[3]) + '} \\] ')
def exo_entier0(exo, cor, v): a = (v[0], tex_coef(v[1], '\\sqrt{%s}' % v[2], bplus=1), v[0], tex_coef(-v[1], '\\sqrt{%s}' % v[2], bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)\\left( %s%s \\right)' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)\\left( %s%s \\right)' % a + '\\] ') a = (tex_coef(v[0], '', bpc=1), tex_coef(abs(v[1]), '\\sqrt{%s}' % v[2], bpc=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s^2-%s^2' % a + '\\] ') a = (v[0]**2, v[1]**2, v[2]) cor.append(u'\\[ \\thenocalcul = ' + '%s-%s\\times %s' % a + '\\] ') cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % (v[0]**2 - v[1]**2 * v[2]) + '} \\] ')
def exoaRb1(exo, cor, v): a = (v[3] * v[0]**2, v[3] * v[1]**2, v[3] * v[2]**2) exo.append(u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') a = (v[0]**2, v[3], v[1]**2, v[3], v[2]**2, v[3]) cor.append( u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') a = (v[0], v[3], v[1], v[3], v[2], v[3]) cor.append( u'\\[ \\thenocalcul = ' + '%s\\times\\sqrt{%s}\\times%s\\times\\sqrt{%s}\\times%s\\times\\sqrt{%s}' % a + '\\] ') a = ((v[0] * v[1]) * v[2], v[3], v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times\\left(\\sqrt{%s}\\right)^2\\times\\sqrt{%s}' % a + '\\] ') a = ((v[0] * v[1]) * v[2], v[3], v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times%s\\times\\sqrt{%s}' % a + '\\] ') del a cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % tex_coef(( (v[0] * v[1]) * v[2]) * v[3], '\\sqrt{%s}' % v[3]) + '} \\] ')
def tex_eq3(v, c): if c[0]: tv = (tex_coef(1, 'y'), tex_coef(v[0][2] - v[0][0] * v[2][0], ''), tex_coef(v[0][1], ''), tex_coef(v[2][1], '')) t = '%s=\\frac{%s}{%s}=%s' % tv else: tv = (tex_coef(1, 'x'), tex_coef(v[0][2] - v[0][1] * v[2][1], ''), tex_coef(v[0][0], ''), tex_coef(v[2][0], '')) t = '%s=\\frac{%s}{%s}=%s' % tv return t
def tex_equation(v, c): tv = (tex_coef(v[0][0], 'x'), tex_coef(v[0][1], 'y', bplus=1), v[0][2]) t = '$%s%s=%s\\quad\\text{et}\\quad ' % tv if c[0]: t = t + 'x=%s\\quad\\text{donc :}$\n' % v[2][0] tv = (tex_coef(v[0][0], ''), tex_coef(v[2][0], '', bpn=1), tex_coef(v[0][1], 'y', bplus=1), v[0][2]) t = t + '\\[%s\\times %s %s=%s\\]\n' % tv else: t = t + 'y=%s\\quad\\text{donc :}$\n' % v[2][1] tv = (tex_coef(v[0][0], 'x'), tex_coef(v[0][1], '', bplus=1), tex_coef(v[2][1], '', bpn=1), v[0][2]) t = t + '\\[%s %s\\times %s=%s\\]\n' % tv return t
def tex_eq2(v, c): if c[0]: tv = (tex_coef(v[0][1], 'y'), tex_coef(v[0][2], ''), tex_coef(-v[0][0] * v[2][0], '', bplus=1)) t = '%s=%s%s' % tv else: tv = (tex_coef(v[0][0], 'x'), tex_coef(v[0][2], ''), tex_coef(-v[0][1] * v[2][1], '', bplus=1)) t = '%s=%s%s' % tv return t
def exo_aPbRc(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % v[1]), tex_coef(v[2], '\\sqrt{%s}' % v[3], bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)^2' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\left( %s%s \\right)^2' % a + '\\] ') if v[2] > 0: sgn = '+' else: sgn = '-' a = (tex_coef(v[0], '\\sqrt{%s}' % v[1], bpc=1), sgn, tex_coef(v[0], '\\sqrt{%s}' % v[1]), tex_coef(abs(v[2]), '\\sqrt{%s}' % v[3]), tex_coef(abs(v[2]), '\\sqrt{%s}' % v[3], bpc=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s^2%s2\\times%s\\times%s+%s^2' % a + '\\] ') a = (v[0] ** 2, v[1], tex_coef((2 * v[0]) * v[2], '\\sqrt{%s}' % (v[1] * v[3]), bplus=1), v[2] ** 2, v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times %s %s+%s\\times %s' % a + '\\] ') a = (v[0] ** 2 * v[1] + v[2] ** 2 * v[3], tex_coef((2 * v[0]) * v[2], '\\sqrt{%s}' % (v[1] * v[3]), bplus=1)) cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s%s' % a + '} \\] ')
def tex_eq2(v, c): if c[0]: tv = (tex_coef(v[0][1], 'y'), tex_coef(v[0][2], ''), tex_coef(-v[0][0] * v[2][0], '', bplus= 1)) t = '%s=%s%s' % tv else: tv = (tex_coef(v[0][0], 'x'), tex_coef(v[0][2], ''), tex_coef(-v[0][1] * v[2][1], '', bplus= 1)) t = '%s=%s%s' % tv return t
def exoaRb1(exo, cor, v): a = (v[3] * v[0] ** 2, v[3] * v[1] ** 2, v[3] * v[2] ** 2) exo.append(u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') a = (v[0] ** 2, v[3], v[1] ** 2, v[3], v[2] ** 2, v[3]) cor.append(u'\\[ \\thenocalcul = ' + '\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}\\times\\sqrt{%s}' % a + '\\] ') a = (v[0], v[3], v[1], v[3], v[2], v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times\\sqrt{%s}\\times%s\\times\\sqrt{%s}\\times%s\\times\\sqrt{%s}' % a + '\\] ') a = ((v[0] * v[1]) * v[2], v[3], v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times\\left(\\sqrt{%s}\\right)^2\\times\\sqrt{%s}' % a + '\\] ') a = ((v[0] * v[1]) * v[2], v[3], v[3]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times%s\\times\\sqrt{%s}' % a + '\\] ') del a cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % tex_coef(((v[0] * v[1]) * v[2]) * v[3], '\\sqrt{%s}' % v[3]) + '} \\] ')
def tex_comb2(v, c): if c[0]: tv = (tex_coef(v[0][0], 'x'), '\\cancel{' + tex_coef(v[0][1], 'y', bplus=1) + '}', tex_coef(v[1][0], 'x', bplus=1), '\\cancel{' + tex_coef(v[1][1], 'y', bplus= 1) + '}', tex_coef(v[0][2], ''), tex_coef(v[1][2], '', bplus=1)) else: tv = ('\\cancel{' + tex_coef(v[0][0], 'x') + '}', tex_coef(v[0][1], 'y', bplus=1), '\\cancel{' + tex_coef(v[1][0], 'x', bplus= 1) + '}', tex_coef(v[1][1], 'y', bplus=1), tex_coef(v[0][2], ''), tex_coef(v[1][2], '', bplus=1)) return '%s%s%s%s=%s%s' % tv
def tex_verification( v): # renvoie la vérification de lasolution du système d'équations. tv = ( tex_coef(v[0][0], '\\times %s' % tex_coef(v[2][0], '', bpn=1)), tex_coef(v[0][1], '\\times %s' % tex_coef(v[2][1], '', bpn=1), bplus=1), tex_coef(v[0][0] * v[2][0], ''), tex_coef(v[0][1] * v[2][1], '', bplus=1), v[0][2], tex_coef(v[1][0], '\\times %s' % tex_coef(v[2][0], '', bpn=1)), tex_coef(v[1][1], '\\times %s' % tex_coef(v[2][1], '', bpn=1), bplus=1), tex_coef(v[1][0] * v[2][0], ''), tex_coef(v[1][1] * v[2][1], '', bplus=1), v[1][2], ) return '''\\left\\lbrace \\begin{array}{l} %s %s=%s %s=%s \\\\\n %s %s=%s %s=%s \\end{array} \\right.''' % \ tv
def exoaRb0(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % (v[6] * v[3] ** 2)), tex_coef(v[1], '\\sqrt{%s}' % (v[6] * v[4] ** 2), bplus=1), tex_coef(v[2], '\\sqrt{%s}' % (v[6] * v[5] ** 2), bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') a = (tex_coef(v[0], '\\sqrt{%s}' % v[3] ** 2), v[6], tex_coef(v[1], '\\sqrt{%s}' % v[4] ** 2, bplus=1), v[6], tex_coef(v[2], '\\sqrt{%s}' % v[5] ** 2, bplus=1), v[6]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times\\sqrt{%s}%s\\times\\sqrt{%s}%s\\times\\sqrt{%s}' % a + '\\] ') a = ( tex_coef(v[0], ''), v[3], v[6], tex_coef(v[1], '', bplus=1), v[4], v[6], tex_coef(v[2], '', bplus=1), v[5], v[6], ) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times%s\\times\\sqrt{%s}%s\\times%s\\times\\sqrt{%s}%s\\times%s\\times\\sqrt{%s}' % a + '\\] ') a = (tex_coef(v[0] * v[3], '\\sqrt{%s}' % v[6]), tex_coef(v[1] * v[4], '\\sqrt{%s}' % v[6], bplus=1), tex_coef(v[2] * v[5], '\\sqrt{%s}' % v[6], bplus=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') del a cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % tex_coef(v[0] * v[3] + v[1] * v[4] + v[2] * v[5], '\\sqrt{%s}' % v[6]) + '} \\] ')
def tex_equation5(valeurs): # renvoie l'ecriture reduite de l'equation avec l'inconnue d'un cote de l'egalite texte = tex_coef((valeurs[4][0] + valeurs[4][2] * valeurs[3][1]) - valeurs[4][4], 'x') texte = texte + '=' + tex_coef((valeurs[4][5] - valeurs[4][1]) - valeurs[4][3] * valeurs[3][1], '') return texte
def exoaRb0(exo, cor, v): a = (tex_coef(v[0], '\\sqrt{%s}' % (v[6] * v[3]**2)), tex_coef(v[1], '\\sqrt{%s}' % (v[6] * v[4]**2), bplus=1), tex_coef(v[2], '\\sqrt{%s}' % (v[6] * v[5]**2), bplus=1)) exo.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') cor.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') a = (tex_coef(v[0], '\\sqrt{%s}' % v[3]**2), v[6], tex_coef(v[1], '\\sqrt{%s}' % v[4]**2, bplus=1), v[6], tex_coef(v[2], '\\sqrt{%s}' % v[5]**2, bplus=1), v[6]) cor.append(u'\\[ \\thenocalcul = ' + '%s\\times\\sqrt{%s}%s\\times\\sqrt{%s}%s\\times\\sqrt{%s}' % a + '\\] ') a = ( tex_coef(v[0], ''), v[3], v[6], tex_coef(v[1], '', bplus=1), v[4], v[6], tex_coef(v[2], '', bplus=1), v[5], v[6], ) cor.append( u'\\[ \\thenocalcul = ' + '%s\\times%s\\times\\sqrt{%s}%s\\times%s\\times\\sqrt{%s}%s\\times%s\\times\\sqrt{%s}' % a + '\\] ') a = (tex_coef(v[0] * v[3], '\\sqrt{%s}' % v[6]), tex_coef(v[1] * v[4], '\\sqrt{%s}' % v[6], bplus=1), tex_coef(v[2] * v[5], '\\sqrt{%s}' % v[6], bplus=1)) cor.append(u'\\[ \\thenocalcul = ' + '%s%s%s' % a + '\\] ') del a cor.append(u'\\[ \\boxed{\\thenocalcul = ' + '%s' % tex_coef(v[0] * v[3] + v[1] * v[4] + v[2] * v[5], '\\sqrt{%s}' % v[6]) + '} \\] ')
def tex_verification(v): # renvoie la vérification de lasolution du système d'équations. tv = ( tex_coef(v[0][0], '\\times %s' % tex_coef(v[2][0], '', bpn=1)), tex_coef(v[0][1], '\\times %s' % tex_coef(v[2][1], '', bpn=1), bplus=1), tex_coef(v[0][0] * v[2][0], ''), tex_coef(v[0][1] * v[2][1], '', bplus=1), v[0][2], tex_coef(v[1][0], '\\times %s' % tex_coef(v[2][0], '', bpn=1)), tex_coef(v[1][1], '\\times %s' % tex_coef(v[2][1], '', bpn=1), bplus=1), tex_coef(v[1][0] * v[2][0], ''), tex_coef(v[1][1] * v[2][1], '', bplus=1), v[1][2], ) return '''\\left\\lbrace \\begin{array}{l} %s %s=%s %s=%s \\\\\n %s %s=%s %s=%s \\end{array} \\right.''' % \ tv
def tex_comb2(v, c): if c[0]: tv = (tex_coef(v[0][0], 'x'), '\\cancel{' + tex_coef(v[0][1], 'y', bplus=1) + '}', tex_coef(v[1][0], 'x', bplus=1), '\\cancel{' + tex_coef(v[1][1], 'y', bplus=1) + '}', tex_coef(v[0][2], ''), tex_coef(v[1][2], '', bplus=1)) else: tv = ('\\cancel{' + tex_coef(v[0][0], 'x') + '}', tex_coef(v[0][1], 'y', bplus=1), '\\cancel{' + tex_coef(v[1][0], 'x', bplus=1) + '}', tex_coef(v[1][1], 'y', bplus=1), tex_coef(v[0][2], ''), tex_coef(v[1][2], '', bplus=1)) return '%s%s%s%s=%s%s' % tv