sagemath/sage

Interface cases function with SymPy's piecewise

rwst opened this issue · 16 comments

rwst commented

In #20191 the cases function is introduced. This ticket should interface it with SymPy's piecewise (both directions) and test with:

        sage: _ = var('y, z')
        sage: (x^y - z).integrate(y)
        -y*z + x^y/log(x)
        sage: (x^y - z).integrate(y, algorithm="sympy")  # see Trac #14694
        -y*z + cases(((log(x) == 0, y), (1, x^y/log(x))))

Depends on #20191
Depends on #23990
Depends on #24006

CC: @mforets @EmmanuelCharpentier

Component: interfaces

Author: Ralf Stephan

Branch/Commit: b261ec3

Reviewer: Emmanuel Charpentier

Issue created by migration from https://trac.sagemath.org/ticket/23923

rwst commented

Changed dependencies from #20191 to #20191, #23990

New commits:

ea10ee723923: interface cases() with SymPy

Changed commit from ea10ee7 to b80d98c

Branch pushed to git repo; I updated commit sha1. New commits:

b80d98c23923: fix typo
rwst commented

Author: Ralf Stephan

rwst commented

Changed dependencies from #20191, #23990 to #20191, #23990, #24006

comment:7

On top of 8.1beta7+#24026 + #24006(dependency) + #23990(dependency) + #23923(present patch), one permanent failure :

sage -t --long src/sage/symbolic/integration/integral.py
**********************************************************************
File "src/sage/symbolic/integration/integral.py", line 508, in sage.symbolic.int
egration.integral.integrate
Failed example:
    (x^y - z).integrate(y, algorithm="sympy")  # see Trac #14694
Expected:
    Traceback (most recent call last):
    ...
    AttributeError: 'ExprCondPair' object has no attribute '_sage_'
Got:
    -y*z + cases(((log(x) == 0, y), (1, x^y/log(x))))
**********************************************************************
1 item had failures:
   1 of 126 in sage.symbolic.integration.integral.integrate
    [169 tests, 1 failure, 53.41 s]

==>needs_work. Probably a booboo, though...

Changed commit from b80d98c to b261ec3

Branch pushed to git repo; I updated commit sha1. New commits:

b261ec323923: fix doctest
comment:10

On top of 8.1beta8+#24026 + #24006(dependency) + #23990(dependency) + #23923(present patch), passes ptestlong with no error whatsoever.

==>positive_review

Notes :

  • I rebased the test on the hust-issued 8.1.beta8
  • I have kept #24026 (which needs_review, BTW...) because removing it entails recompiling R (which is slow) and reinstall 442 R packages, (which is slower...).
rwst commented

Reviewer: Emmanuel Charpentier

rwst commented
comment:11

Thanks. I've added your name, hope it's not impolite.

Changed branch from u/rws/23923 to b261ec3