Ondrej Certik wrote:
> it used to return [sqrt(2)], but the answer is [4]. There was a bug in the
> solver, that noone has noticed so far: it did everything correctly, only at 
> the
> very end it should power the result to "m", and it used to power it to "1/m",
> which is wrong.

all patches are +1. This bug was probably introduced when i refactored 
the solver module ...

> 
> More tests were written for this.
> 
> Signed-off-by: Ondrej Certik <ond...@certik.cz>
> ---
>  sympy/solvers/solvers.py            |    2 +-
>  sympy/solvers/tests/test_solvers.py |   10 +++++++---
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py
> index 57bc775..1cf6747 100644
> --- a/sympy/solvers/solvers.py
> +++ b/sympy/solvers/solvers.py
> @@ -210,7 +210,7 @@ def solve(f, *symbols, **flags):
>                  cv_sols = solve(f_, t)
>                  result = list()
>                  for sol in cv_sols:
> -                    result.append(sol**(S.One/m))
> +                    result.append(sol**m)
>  
>              elif isinstance(f, Mul):
>                  result = []
> diff --git a/sympy/solvers/tests/test_solvers.py 
> b/sympy/solvers/tests/test_solvers.py
> index 5f78f8a..4ac368e 100644
> --- a/sympy/solvers/tests/test_solvers.py
> +++ b/sympy/solvers/tests/test_solvers.py
> @@ -95,14 +95,18 @@ def test_solve_polynomial_cv_1a():
>  
>      x = Symbol('x')
>  
> +
>      assert solve( x**Rational(1,2) - 1, x) == [1]
> -    assert solve( x**Rational(1,2) - 2, x) == [sqrt(2)]
> +    assert solve( x**Rational(1,2) - 2, x) == [4]
> +    assert solve( x**Rational(1,4) - 2, x) == [16]
> +    assert solve( x**Rational(1,3) - 3, x) == [27]
>  
>  def test_solve_polynomial_cv_1b():
>      x, a = symbols('x a')
>  
> -    assert set(solve(4*x*(1 - a*x**(S(1)/2)), x)) == \
> -            set([S(0), (1/a)**(S(1)/2)])
> +
> +    assert set(solve(4*x*(1 - a*x**(S(1)/2)), x)) == set([S(0), 1/a**2])
> +    assert set(solve(x * (x**(S(1)/3) - 3), x)) == set([S(0), S(27)])
>  
>  def test_solve_polynomial_cv_2():
>      """


--~--~---------~--~----~------------~-------~--~----~
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