Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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_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_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 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
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_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))
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 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 + '\\] ')