#!/usr/bin/env python # encoding: utf-8 from random_expression import RdExpression from random import choice affine = RdExpression("{a}x + {b}", \ conditions =["{b} > 0"], \ with_Exp = False) affine_minus = RdExpression("{a}x - {b}", conditions =["{b} > 0"], \ with_Exp = False) affine_frac = RdExpression("\frac{ {a} }{ {c} }x + {b}", \ conditions =["{b} > 0", "{c} > 0"], \ with_Exp = False) double_prod = RdExpression("({a}x + {b})({c}x + {d})", conditions =["{b} > 0", "{d} >0"], \ with_Exp = False) double_prod_minus1 = RdExpression("({a}x - {b})({c}x + {d})", conditions =["{b} > 0", "{d} >0"], \ with_Exp = False) double_prod_minus2 = RdExpression("({a}x + {b})({c}x - {d})", conditions =["{b} > 0", "{d} >0"], \ with_Exp = False) eq = {"affine" : lambda : choice([affine, affine_minus])(), \ "affine_frac": affine_frac, \ "double_prod": lambda: choice([double_prod, double_prod_minus1, double_prod_minus2])()} # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del