From 57bc2355aa3f9df8f6512dec2f82415194453c1f Mon Sep 17 00:00:00 2001 From: Lafrite Date: Fri, 22 May 2015 15:44:43 +0200 Subject: [PATCH 1/3] add $$ around root in tbl_sgn_header --- pymath/polynomDeg2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymath/polynomDeg2.py b/pymath/polynomDeg2.py index 1f76e1d..ac223be 100644 --- a/pymath/polynomDeg2.py +++ b/pymath/polynomDeg2.py @@ -156,9 +156,9 @@ class Polynom_deg2(Polynom): def tbl_sgn_header(self): """ Return header of the sign line for tkzTabLine""" if self.delta > 0: - return "{$-\\infty$, " + str(min(self.roots())) + " , " + str( max(self.roots())) + " , $+\\infty$}" + return "{$-\\infty$, $" + str(min(self.roots())) + "$ , $" + str( max(self.roots())) + "$ , $+\\infty$}" elif self.delta == 0: - return "{$-\\infty$, " + str(self.roots()[0]) + " , $+\\infty$}" + return "{$-\\infty$, $" + str(self.roots()[0]) + "$ , $+\\infty$}" else: return "{$-\\infty$, $+\\infty$}" From 764846002201c2490d56fb6e4280c565104eb1b3 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Sat, 23 May 2015 08:06:57 +0200 Subject: [PATCH 2/3] report a bug --- pymath/expression.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pymath/expression.py b/pymath/expression.py index 0e7038b..b54437e 100644 --- a/pymath/expression.py +++ b/pymath/expression.py @@ -89,6 +89,7 @@ class Expression(Explicable): if type(exp) == str: expression.postfix_tokens = str2tokens(exp) elif type(exp) == list: + # Bug ici quand i ne peut pas être converti en string exp_mod_op = [op.get_op(i) if (str(i) in "+-*/^" and not isOperator(i)) else i for i in exp] expression.postfix_tokens = flatten_list([tok.postfix_tokens if Expression.isExpression(tok) else tok for tok in exp_mod_op]) elif type(exp) == Expression: From bc4bb9155564a9eb61d2b34c553d3f0ab769df67 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Fri, 19 Jun 2015 11:01:13 +0200 Subject: [PATCH 3/3] Solve bug with simplify and postfix string --- pymath/expression.py | 4 ++-- pymath/operator.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pymath/expression.py b/pymath/expression.py index b54437e..ed4043f 100644 --- a/pymath/expression.py +++ b/pymath/expression.py @@ -89,8 +89,8 @@ class Expression(Explicable): if type(exp) == str: expression.postfix_tokens = str2tokens(exp) elif type(exp) == list: - # Bug ici quand i ne peut pas être converti en string - exp_mod_op = [op.get_op(i) if (str(i) in "+-*/^" and not isOperator(i)) else i for i in exp] + # Ici on ne peut convertir les "+" en opérateur que s'ils sont d'arité 2. + exp_mod_op = [op.get_op(i) if op.can_be_operator(i) else i for i in exp] expression.postfix_tokens = flatten_list([tok.postfix_tokens if Expression.isExpression(tok) else tok for tok in exp_mod_op]) elif type(exp) == Expression: return exp diff --git a/pymath/operator.py b/pymath/operator.py index b643cad..18a142b 100644 --- a/pymath/operator.py +++ b/pymath/operator.py @@ -268,7 +268,10 @@ class op(object): @classmethod def can_be_operator(cls, symbole): """ Tell if the symbole can be an operator """ - return symbole in [i[0] for i in cls._operators] + if type(symbole) == str: + return symbole in [i[0] for i in cls._operators] + else: + return False @ClassProperty