What is the status of this patch?

Ondrej

On Mon, Oct 6, 2008 at 2:58 PM, Mateusz Paprocki <[email protected]> wrote:
>
> My e-mail client went weird. Sorry for mess.
>
> Mateusz
>
> On 7 Paź, 00:43, Mateusz Paprocki <[email protected]> wrote:
>> Hi,
>>
>> I don't like to XFAIL any tests, I see it ugly, but here a fix is not
>> so straightforward. For now lets stick to XFAIL in case of
>> test_heurisch_symbolic_coeffs. Alternatively we could assume that y is
>> nonnegative, however this would hide the real problem.
>>
>> Now some notes about the "real" problem:
>>
>> [1] Depending on the order of equations in the system given to
>> solve_linear_system, the function returns different results - more or
>> less pretty, but there are cases for which it gives no solution even
>> when such exists. This is the case for test_heurisch_symbolic_coeffs.
>>
>> [2] Depending on the order of computation hashes of expressions vary.
>> First apply this patch:
>>
>> diff --git a/sympy/integrals/risch.py b/sympy/integrals/risch.py
>> index 843d90b..20b4e00 100644
>> --- a/sympy/integrals/risch.py
>> +++ b/sympy/integrals/risch.py
>> @@ -362,7 +362,12 @@ def heurisch(f, x, **kwargs):
>>             else:
>>                 equations[dependent] = coeff
>>
>> -        solution = solve(equations.values(), *coeffs)
>> +        system = equations.values()
>> +
>> +        if kwargs.get('debug', False):
>> +            print "\nHEURISCH: %s" % map(hash, sorted(system))
>> +
>> +        solution = solve(system, *coeffs)
>>
>>         if solution is not None:
>>             return (solution, candidate, coeffs)
>> diff --git a/sympy/integrals/tests/test_risch.py
>> b/sympy/integrals/tests/test_risch.py
>> index e07a514..9176c31 100644
>> --- a/sympy/integrals/tests/test_risch.py
>> +++ b/sympy/integrals/tests/test_risch.py
>> @@ -105,11 +105,11 @@ def test_heurisch_special():
>>  def test_heurisch_symbolic_coeffs():
>>     assert heurisch(1/(x+y), x)         == log(x+y)
>>     assert heurisch(1/(x+sqrt(2)), x)   == log(x+sqrt(2))
>> -    assert heurisch(1/(x**2+y), x)      == I*y**(-S.Half)*log(x +
>> (-y)**S.Half)/2 - \
>> -                                           I*y**(-S.Half)*log(x -
>> (-y)**S.Half)/2
>> -
>>     assert trim(diff(heurisch(log(x+y+z), y), y)) == log(x+y+z)
>>
>> +def test_heurisch_symbolic_coeffs2():
>> +    assert heurisch(1/(x**2+y), x, debug=True) ==
>> I*y**(-S.Half)*log(x + (-y)**S.Half)/2 - I*y**(-S.Half)*log(x -
>> (-y)**S.Half)/2
>> +
>>  def test_heurisch_hacking():
>>     assert heurisch(sqrt(1 + 7*x**2), x, hints=[]) == \
>>         x*sqrt(1+7*x**2)/2 + sqrt(7)*asinh(sqrt(7)*x)/14
>>
>> Now consider three cases:
>>
>> $ SYMPY_USE_CACHE=no ./bin/isympy -q
>> Python 2.5.2 console for SymPy 0.6.2-hg (cache: off)
>>
>> In [1]: from sympy.integrals.risch import heurisch
>>
>> In [2]: heurisch(1/(x**2+y), x, debug=True)
>>
>> HEURISCH: [-1558621035, -1289355954, -1389281654, 307449972,
>> -212732511, -832764003, -379627863]
>>
>> $ SYMPY_USE_CACHE=no py.test -s sympy/integrals/tests/test_risch.py -k
>> coeffs2
>>
>> executable:   /usr/bin/python  (2.5.2-final-0)
>> using py lib: /usr/lib/python2.5/site-packages/py <rev unknown>
>>
>> sympy/integrals/tests/test_risch.py[19] sssssssssss
>> HEURISCH: [-1558621035, -1289355954, -1389281654, 307449972,
>> -212732511, -832764003, -379627863]
>> .sssssss
>>
>> $ SYMPY_USE_CACHE=no py.test -s sympy/integrals/tests/test_risch.py
>>
>> executable:   /usr/bin/python  (2.5.2-final-0)
>> using py lib: /usr/lib/python2.5/site-packages/py <rev unknown>
>>
>> sympy/integrals/tests/test_risch.py[19] ...........
>> HEURISCH: [-1558621035, -1289355954, -1389281654, -481881579,
>> 2023858942, -136927980, 1558901530]
>>
>> This pattern generalizes to examples given in #896. This way we obtain
>> differently ordered systems in heurisch, which in cooperation with [1]
>> make it fail for particular paths of computation.
>>
>> So +1 for XFAIL and other patches. Problem [1] must be fixed soon and
>> [2] probably won't fix as long as we use Python hashes.
>>
>> Mateusz
>>
>> On 6 Paź, 23:51, "Ondrej Certik" <[email protected]> wrote:
>>
>> > On Mon, Oct 6, 2008 at 11:32 PM, Stepan Roucka <[email protected]> wrote:
>>
>> > > The first patch improves spherical harmonics code to work with
>> > > the new rules.
>>
>> > > Second patch actually implements the rules. This breaks some
>> > > (wrong) tests.
>>
>> > > Third patch fixes the failing tests and removes XFAIL from some other
>> > > tests affected by the exponentiation rules.
>>
>> > Thanks! I am +1 to all patches. Mateusz, what do you think about the
>> > XFAILed heurisch test? Is it a blocker for these patches to go in?
>>
>> > To me it seems it's better if we calculate with exponents correctly,
>> > unless there is some deep problem caused by that in heurisch.
>>
>> > Ondrej
>>
>>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" 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-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to