On 16 Jan., 00:28, fabian.seo...@gmail.com wrote:
> From: Fabian Seoane <fab...@fseoane.net>
>
> Docstring of roots by Vinzent Steinberg.
> This has been discussed on issue #1158.
> ---
>  sympy/polys/rootfinding.py           |   10 +++++-----
>  sympy/polys/tests/test_polynomial.py |    5 +++--
>  2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/sympy/polys/rootfinding.py b/sympy/polys/rootfinding.py
> index bf604ed..f60dceb 100644
> --- a/sympy/polys/rootfinding.py
> +++ b/sympy/polys/rootfinding.py
> @@ -162,9 +162,9 @@ def roots(f, *symbols, **flags):
>
>         Only roots expressible via radicals will be returned.  To get
>         a complete set of roots use RootOf class or numerical methods
> -       instead. By default cubic and quartic formulas aren't used in
> -       the algorithm because of unreadable output. To enable them
> -       set cubics=True or quartics=True respectively.
> +       instead. By default cubic and quartic formulas are used in
> +       the algorithm. To disable them because of unreadable output
> +       set cubics=False or quartics=False respectively.
>
>         To get roots from a specific domain set the 'domain' flag with
>         one of the following specifiers: Z, Q, R, I, C. By default all
> @@ -224,7 +224,7 @@ def roots(f, *symbols, **flags):
>              elif n == 2:
>                  zeros += roots_quadratic(g)
>              elif n == 3:
> -                if flags.get('cubics', False):
> +                if flags.get('cubics', True):
>                      # TODO: now we can used factor() not only
>                      #       for cubic polynomials. See #1158
>                      try:
> @@ -238,7 +238,7 @@ def roots(f, *symbols, **flags):
>                      except PolynomialError:
>                          zeros += roots_cubic(g)
>              elif n == 4:
> -                if flags.get('quartics', False):
> +                if flags.get('quartics', True):
>                      zeros += roots_quartic(g)
>
>          return zeros
> diff --git a/sympy/polys/tests/test_polynomial.py 
> b/sympy/polys/tests/test_polynomial.py
> index 3ea8643..1764626 100644
> --- a/sympy/polys/tests/test_polynomial.py
> +++ b/sympy/polys/tests/test_polynomial.py
> @@ -995,6 +995,7 @@ def test_roots():
>      assert roots(1, x) == {}
>      assert roots(x, x) == {S.Zero: 1}
>      assert roots(x**9, x) == {S.Zero: 9}
> +    assert roots(((x-2)*(x+3)*(x-4)).expand(), x) == {-Integer(3): 1, 
> Integer(2): 1, Integer(4): 1}
>
>      assert roots(2*x+1, x) == {-S.Half: 1}
>      assert roots((2*x+1)**2, x) == {-S.Half: 2}
> @@ -1084,11 +1085,11 @@ def test_roots():
>          S.Half + S.Half*y - S.Half*(1 - 2*y + y**2 + 8*x**2)**S.Half: 1,
>      }
>
> -    assert roots(x**3 + 2*x**2 + 4*x + 8, x) == {}
> +    assert roots(x**3 + 2*x**2 + 4*x + 8, x) == {-Integer(2): 1, -2*I: 1, 
> 2*I: 1}
>      assert roots(x**3 + 2*x**2 + 4*x + 8, x, cubics=True) == \
>          {-2*I: 1, 2*I: 1, -Integer(2): 1}
>
> -    assert roots(a*b*c*x**3 + 2*x**2 + 4*x + 8, x) == {}
> +    assert roots(a*b*c*x**3 + 2*x**2 + 4*x + 8, x, cubics=False) == {}
>      assert roots(a*b*c*x**3 + 2*x**2 + 4*x + 8, x, cubics=True) != {}
>
>      assert roots(x**4-1, x, domain='Z') == {S.One: 1, -S.One: 1}
> --
> 1.6.0.2

Thanks, I have no objections.

+1

Vinzent
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to 
sympy-patches+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to