Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Critical Milestone-Release0.7.0

New issue 2151 by [email protected]: BasicMeta.keep_sign
http://code.google.com/p/sympy/issues/detail?id=2151

After discussions in issue 1587, it seems that the consensus is that BasicMeta.keep_sign should be set to True and that this switch should then be removed.

So the first step is to get all the tests to run with keep_sign set to true. I get 3 failures with bin/test under Python 2.6.6. Two of them are obvious and direct consequences of the setting:
    assert -1/(-1-x)    == 1/(1+x)
    assert (3-y)**2 == (y-3)**2

The third one is a real bug:
______ sympy/concrete/tests/test_sums_products.py:test_evalf_slow_series _______ File "/media/sda2/Boulot/Projets/sympy-git/sympy/concrete/tests/test_sums_products.py", line 90, in test_evalf_slow_series
    assert NS(Sum((-1)**n / n, (n, 1, oo)), 15) == NS(-log(2), 15)
File "/media/sda2/Boulot/Projets/sympy-git/sympy/concrete/tests/test_sums_products.py", line 53, in NS
    return str(sympify(e).evalf(n, **options))
File "/media/sda2/Boulot/Projets/sympy-git/sympy/core/evalf.py", line 1040, in evalf
    result = evalf(self, prec+4, options)
File "/media/sda2/Boulot/Projets/sympy-git/sympy/core/evalf.py", line 972, in evalf
    r = rf(x, prec, options)
File "/media/sda2/Boulot/Projets/sympy-git/sympy/core/evalf.py", line 880, in evalf_sum
    v = hypsum(func, n, int(a), prec2)
File "/media/sda2/Boulot/Projets/sympy-git/sympy/core/evalf.py", line 844, in hypsum
    raise ValueError("Sum diverges like n^%i" % (-p))
ValueError: Sum diverges like n^3

I've tracked it down to sympy.core.evalf.hypsum():
In [8]: hypsum((-1)**n / n, n, 1, 25)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/media/sda2/Boulot/Projets/sympy-git/<ipython console> in <module>()

/media/sda2/Boulot/Projets/sympy-git/sympy/core/evalf.pyc in hypsum(expr, n, start, prec)
    842             raise ValueError("Sum diverges like (%i)^n" % abs(1/g))
    843         if p < 1 or (p == 1 and not alt):
--> 844             raise ValueError("Sum diverges like n^%i" % (-p))
845 # We have polynomial convergence: use Richardson extrapolation

846 # Need to use at least quad precision because a lot of cancellation


ValueError: Sum diverges like n^3


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to