Ejemplo n.º 1
0
def test_Roots():
    f = Poly(x**17 + 2 * x - 1, x)
    assert str(RootsOf(f)) == "RootsOf(x**17 + 2*x - 1, x, domain='ZZ')"
    assert str(RootOf(f,
                      0)) == "RootOf(x**17 + 2*x - 1, x, domain='ZZ', index=0)"
    assert str(RootSum(
        Lambda(z, z**2),
        f)) == "RootSum(Lambda(_z, _z**2), x**17 + 2*x - 1, x, domain='ZZ')"
Ejemplo n.º 2
0
def test_issue_8285():
    roots = (Poly(4*x**8 - 1, x)*Poly(x**2 + 1)).all_roots()
    assert roots == _nsort(roots)
    f = Poly(x**4 + 5*x**2 + 6, x)
    ro = [RootOf(f, i) for i in range(4)]
    roots = Poly(x**4 + 5*x**2 + 6, x).all_roots()
    assert roots == ro
    assert roots == _nsort(roots)
    # more than 2 complex roots from which to identify the
    # imaginary ones
    roots = Poly(2*x**8 - 1).all_roots()
    assert roots == _nsort(roots)
    assert len(Poly(2*x**10 - 1).all_roots()) == 10  # doesn't fail
Ejemplo n.º 3
0
def test_RootOf():
    assert str(RootOf(x**5 + 2 * x - 1, 0)) == "RootOf(x**5 + 2*x - 1, 0)"