Skip to content

Commit

Permalink
XXX remove more extension=True
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Nov 9, 2018
1 parent 0a017f0 commit 1984442
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion diofant/integrals/heurisch.py
Expand Up @@ -517,7 +517,7 @@ def find_non_syms(expr):
except PolynomialError:
return
else:
ground, _ = construct_domain(non_syms, field=True, extension=True)
ground, _ = construct_domain(non_syms, field=True)

coeff_ring = ground.poly_ring(*poly_coeffs)
ring = coeff_ring.poly_ring(*V)
Expand Down
8 changes: 2 additions & 6 deletions diofant/polys/rootoftools.py
Expand Up @@ -51,21 +51,17 @@ class RootOf(Expr):
Expand polynomial, enabled default.
evaluate : bool or None, optional
Control automatic evaluation.
extension : bool or None, optional
If enabled, reduce input polynomial to have integer
coefficients.
Examples
========
>>> expand_func(RootOf(x**3 + I*x + 2, 0, extension=True))
>>> expand_func(RootOf(x**3 + I*x + 2, 0))
RootOf(x**6 + 4*x**3 + x**2 + 4, 1)
"""

is_commutative = True

def __new__(cls, f, x, index=None, radicals=True, expand=True,
evaluate=None, extension=None):
def __new__(cls, f, x, index=None, radicals=True, expand=True, evaluate=None):
"""Construct a new ``RootOf`` object for ``k``-th root of ``f``. """
x = sympify(x)

Expand Down
10 changes: 5 additions & 5 deletions diofant/polys/tests/test_rootoftools.py
Expand Up @@ -550,25 +550,25 @@ def test_rewrite():
def test_RootOf_expand_func():
r0 = RootOf(x**3 + x + 1, 0)
assert expand_func(r0) == r0
r0 = RootOf(x**3 + I*x + 2, 0, extension=True)
r0 = RootOf(x**3 + I*x + 2, 0)
assert expand_func(r0) == RootOf(x**6 + 4*x**3 + x**2 + 4, 1)
r1 = RootOf(x**3 + I*x + 2, 1, extension=True)
r1 = RootOf(x**3 + I*x + 2, 1)
assert expand_func(r1) == RootOf(x**6 + 4*x**3 + x**2 + 4, 3)

e = RootOf(x**4 + sqrt(2)*x**3 - I*x + 1, 0, extension=True)
e = RootOf(x**4 + sqrt(2)*x**3 - I*x + 1, 0)
assert expand_func(e) == RootOf(x**16 - 4*x**14 + 8*x**12 - 6*x**10 +
10*x**8 + 5*x**4 + 2*x**2 + 1, 1)


@pytest.mark.slow
def test_RootOf_algebraic():
e = RootOf(sqrt(2)*x**4 + sqrt(2)*x**3 - I*x + sqrt(2), x, 0, extension=True)
e = RootOf(sqrt(2)*x**4 + sqrt(2)*x**3 - I*x + sqrt(2), x, 0)
assert e.interval.as_tuple() == ((Rational(-201, 100), 0),
(Rational(-201, 200), Rational(201, 200)))
assert e.evalf(7) == Float('-1.22731258', dps=7) + I*Float('0.6094138324', dps=7)

t = RootOf(x**5 + 4*x + 2, 0)
e = RootOf(x**4 + t*x + 1, 0, extension=True)
e = RootOf(x**4 + t*x + 1, 0)
assert e.interval.as_tuple() == ((Rational(-201, 200), Rational(-201, 200)),
(Rational(-201, 400), Rational(-201, 400)))
assert e.evalf(7) == Float('-0.7123350278', dps=7) - I*Float('0.8248345032', dps=7)

0 comments on commit 1984442

Please sign in to comment.