#!/usr/bin/env python # encoding: utf-8 from random_expression import RdExpression from random import choice fact1 = RdExpression("{c}({a}x + {b}) + {f}({a}x + {b})",\ conditions = ["{b} > 0"], \ with_Exp = False) fact2 = RdExpression("({a}x + {b})({c}x - {d}) + ({a}x + {b})({e}x + {f})",\ conditions = ["{b} > 0", "{d} > 0", "{f} > 0", "{e} != {c}"] , \ with_Exp = False) fact3 = RdExpression("({a}x + {b})({c}x - {d}) + ({c}x - {d})({e}x - {f})",\ conditions = ["{b} > 0", "{d} > 0", "{f} > 0", "{d} != {f}"], \ with_Exp = False) fact4 = RdExpression("({a}x + {b})({c}x - {d}) - ({a}x + {b})({e}x + {f})",\ conditions = ["{b} > 0", "{d} > 0", "{f} > 0", "{e} != {c}"], \ with_Exp = False) fact5 = RdExpression("({a}x + {b})({c}x - {d}) - ({c}x - {d})({e}x - {f})",\ conditions = ["{b} > 0", "{d} > 0", "{f} > 0", "{d} != {f}"],\ with_Exp = False) id_rmq1 = RdExpression("{a**2}x^2 + {2*a*b}x + {b**2}",\ conditions = ["{a} > 0", "{b} > 0"], \ with_Exp = False) id_rmq2 = RdExpression("{a**2}x^2 - {2*a*b}x + {b**2}",\ conditions = ["{a} > 0", "{b} > 0"],\ with_Exp = False) id_rmq3 = RdExpression("{a**2}x^2 - {b**2}",\ conditions = ["{a} > 0", "{b} > 0"], \ with_Exp = False) rd_fact = lambda : choice([fact2, fact3, fact4, fact5])() rd_id_rmq= lambda: choice([id_rmq1, id_rmq2, id_rmq3])() fact = {"fact1" : fact1,\ "fact2": fact2, \ "fact3": fact3, \ "fact4": fact4, \ "fact5": fact5, \ "id_rmq1":id_rmq1, \ "id_rmq2":id_rmq2, \ "id_rm3": id_rmq3, \ "rd_fact" : rd_fact, \ "rd_id_rmq" : rd_id_rmq } # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del