65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
#!/usr/bin/env python
|
|
# encoding: utf-8
|
|
|
|
|
|
from random_expression import RdExpression
|
|
|
|
def red_prod():
|
|
form1 = "{a}x \\times {b}"
|
|
cond1 = ["{a} != 1", "{b} > 1"]
|
|
rdExp1 = RdExpression(form1, cond1, with_Exp = False)
|
|
exp1 = rdExp1()
|
|
|
|
form2 = "{a}x \\times {b}x"
|
|
cond2 = ["{a} != 1", "{b} > 1"]
|
|
rdExp2 = RdExpression(form2, cond2, with_Exp = False)
|
|
exp2 = rdExp2()
|
|
|
|
ans = "A &=& " + exp1 + "\\\\[0.5cm] B &=& " + exp2
|
|
return ans
|
|
|
|
def red_somme():
|
|
form1 = "{a}x + {b} + {c}x"
|
|
cond1 = ["{a} != 1","{c} > 1"]
|
|
#rdExp1 = RdExpression(form1, cond1, with_Exp = False)
|
|
rdExp1 = RdExpression(form1, cond1)
|
|
exp1 = rdExp1()
|
|
|
|
form2 = "{a}x + {b} + {c}x"
|
|
cond2 = ["{a} != 1","{c} > 1"]
|
|
#rdExp2 = RdExpression(form2, cond2, with_Exp = False)
|
|
rdExp2 = RdExpression(form2, cond2)
|
|
exp2 = rdExp2()
|
|
|
|
ans = "C &=& " + exp1 + " \\\\[0.5cm]"
|
|
ans += "D &=& " + exp2
|
|
return ans
|
|
|
|
def simple_prod():
|
|
form = "{a}({b}x + {c})"
|
|
cond = ["{a} != 1", "{b} != 1", "{c} > 1"]
|
|
rdExp = RdExpression(form, cond, with_Exp = False)
|
|
return rdExp()
|
|
|
|
def double_prod():
|
|
form = "({a}x - {d})({b}x + {c})"
|
|
cond = ["{a} != 1", "{b} != 1", "{d} > 1", "{c} > 1"]
|
|
rdExp = RdExpression(form, cond, with_Exp = False)
|
|
return rdExp()
|
|
|
|
def carre_prod():
|
|
form = "({a}x + {d})^2"
|
|
cond = ["{a} != 1", "{d} > 1"]
|
|
rdExp = RdExpression(form, cond, with_Exp = False)
|
|
return rdExp()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -----------------------------
|
|
# Reglages pour 'vim'
|
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
|
# cursor: 16 del
|