Skip to content

Commit

Permalink
XXX Add test for RootOf
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Jul 16, 2018
1 parent 9949823 commit 841fbf7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions diofant/polys/tests/test_rootoftools.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,13 @@ def test_rewrite():
assert r4.n() == r4.rewrite(Pow).n()
r11 = RootOf(x**11 + x - 3, 0)
assert r11.rewrite(Pow) == r11


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

t = RootOf(x**5 + 4*x + 2, 0)
r2 = RootOf(x**4 + t*x + 1, 0, extension=True)
assert r2.evalf(7) == Float('-0.7123350278', dps=7) - I*Float('0.8248345032', dps=7)

0 comments on commit 841fbf7

Please sign in to comment.