From 39157843639b443a51dc30458416005b52880001 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Thu, 28 Feb 2019 20:03:53 +0300 Subject: [PATCH] XXX add some extension=False workaround's --- diofant/domains/expressiondomain.py | 2 +- diofant/integrals/meijerint.py | 2 +- diofant/simplify/hyperexpand.py | 2 +- diofant/simplify/simplify.py | 4 ++-- diofant/simplify/trigsimp.py | 6 +++--- diofant/solvers/ode.py | 2 +- diofant/tests/test_wester.py | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/diofant/domains/expressiondomain.py b/diofant/domains/expressiondomain.py index d76417f5714..b79830f259a 100644 --- a/diofant/domains/expressiondomain.py +++ b/diofant/domains/expressiondomain.py @@ -115,7 +115,7 @@ def __bool__(self): def gcd(self, other): from ..polys import gcd - return self.__class__(gcd(self.ex, self.__class__(other).ex)) + return self.__class__(gcd(self.ex, self.__class__(other).ex, extension=False)) def lcm(self, other): from ..polys import lcm diff --git a/diofant/integrals/meijerint.py b/diofant/integrals/meijerint.py index 584f24c6228..4919571d0f0 100644 --- a/diofant/integrals/meijerint.py +++ b/diofant/integrals/meijerint.py @@ -1422,7 +1422,7 @@ def _rewrite_single(f, x, recursive=True): if isinstance(f, meijerg): from ..polys import factor - coeff, m = factor(f.argument, x).as_coeff_mul(x) + coeff, m = factor(f.argument, x, extension=False).as_coeff_mul(x) if len(m) > 1: return m = m[0] diff --git a/diofant/simplify/hyperexpand.py b/diofant/simplify/hyperexpand.py index 297f1dc0234..d102e3d642b 100644 --- a/diofant/simplify/hyperexpand.py +++ b/diofant/simplify/hyperexpand.py @@ -2017,7 +2017,7 @@ def carryout_plan(f, ops): debug(' Recognised polynomial.') p = apply_operators(res, ops, lambda f: z0*f.diff(z0)) p = apply_operators(p*premult, ops0, lambda f: z0*f.diff(z0)) - return unpolarify(simplify(p).subs({z0: z})) + return unpolarify(simplify(unpolarify(p)).subs({z0: z})) # Try to recognise a shifted sum. p = Integer(0) diff --git a/diofant/simplify/simplify.py b/diofant/simplify/simplify.py index ef83f440fb9..bc12961a9f2 100644 --- a/diofant/simplify/simplify.py +++ b/diofant/simplify/simplify.py @@ -614,8 +614,8 @@ def shorter(*choices): expr = bottom_up(expr, lambda w: w.normal()) expr = Mul(*powsimp(expr).as_content_primitive()) - _e = cancel(expr) - expr1 = shorter(_e, _mexpand(_e).cancel()) # issue sympy/sympy#6829 + _e = cancel(expr, extension=False) + expr1 = shorter(_e, _mexpand(_e).cancel(extension=False)) # issue sympy/sympy#6829 expr2 = shorter(together(expr, deep=True), together(expr1, deep=True)) if ratio is oo: diff --git a/diofant/simplify/trigsimp.py b/diofant/simplify/trigsimp.py index fb216dcfef7..26e5db79dbe 100644 --- a/diofant/simplify/trigsimp.py +++ b/diofant/simplify/trigsimp.py @@ -1131,16 +1131,16 @@ def trigs(x): TR3, # canonical angles TR1, # sec-csc -> cos-sin TR12, # expand tan of sum - lambda x: _eapply(factor, x, trigs), + lambda x: _eapply(lambda e: factor(e, extension=False), x, trigs), TR2, # tan-cot -> sin-cos [identity, lambda x: _eapply(_mexpand, x, trigs)], TR2i, # sin-cos ratio -> tan - lambda x: _eapply(lambda i: factor(i.normal()), x, trigs), + lambda x: _eapply(lambda i: factor(i.normal(), extension=False), x, trigs), TR14, # factored identities TR5, # sin-pow -> cos_pow TR10, # sin-cos of sums -> sin-cos prod TR11, TR6, # reduce double angles and rewrite cos pows - lambda x: _eapply(factor, x, trigs), + lambda x: _eapply(lambda e: factor(e, extension=False), x, trigs), TR14, # factored powers of identities [identity, lambda x: _eapply(_mexpand, x, trigs)], TRmorrie, diff --git a/diofant/solvers/ode.py b/diofant/solvers/ode.py index ea061449696..16784164e9a 100644 --- a/diofant/solvers/ode.py +++ b/diofant/solvers/ode.py @@ -2715,7 +2715,7 @@ def constantsimp(expr, constants): expr = __remove_linear_redundancies(expr, Cs) def _conditional_term_factoring(expr): - new_expr = terms_gcd(expr, clear=False, deep=True, expand=False) + new_expr = terms_gcd(expr, clear=False, deep=True, expand=False, extension=False) # we do not want to factor exponentials, so handle this separately if new_expr.is_Mul: diff --git a/diofant/tests/test_wester.py b/diofant/tests/test_wester.py index f568e51e46b..c1c4146151f 100644 --- a/diofant/tests/test_wester.py +++ b/diofant/tests/test_wester.py @@ -800,8 +800,8 @@ def test_M22(): def test_M23(): - assert solve(x - 1/sqrt(1 + x**2)) == [{x: -I*sqrt(Rational(1, 2) + sqrt(5)/2)}, - {x: sqrt(Rational(-1, 2) + sqrt(5)/2)}] + assert solve(x - 1/sqrt(1 + x**2)) == [{x: sqrt(2)*sqrt(-1 + sqrt(5))/2}, + {x: -sqrt(2)*I*sqrt(1 + sqrt(5))/2}] def test_M24():