It isn't because the _sage_ attribute has been removed, it's because
integrate() returns a Piecewise, whereas previously it returned a Pow,
i.e., in SymPy 0.7.2:
In [2]: integrate(x**y + z, y)
Out[2]:
y
x
────── + y⋅z
log(x)
and 0.7.3:
In [1]: integrate(x**y + z, y)
Out[1]:
⎛⎧y⋅(t₀ + z) ⎞
⎜⎪────────── for log(x) = 0⎟
⎜⎪ t₀ ⎟
⎜⎪ ⎟
y⋅z + ⎜⎨ y ⎟
⎜⎪ x ⎟
⎜⎪ ────── otherwise ⎟
⎜⎪ log(x) ⎟
⎝⎩ ⎠
(what they hey! That t0 doesn't belong in there. That must be another bug.)
Assumedly you can implement your own converters to work around this.
The correct fix is to implement the converter for Piecewise.
Unfortunately, we haven't really been on the ball for writing
converters for SymPy to Sage, so quite a few things won't work.
You could also just change the doctest, especially given that the
current SymPy result seems to be wrong. This version of SymPy now has
the Risch algorithm implemented, and SymPy has for some time had the
Meijer G algorithm, so you can show off much more complicated
integrals using the SymPy algorithm.
Aaron Meurer
On Mon, Aug 26, 2013 at 4:38 PM, François
<[email protected]> wrote:
> Hi,
>
> We are upgrading sympy in sage from 0.7.1 to 0.7.3 at
> http://trac.sagemath.org/ticket/14694
> And we face a small hurdle. One of the tests fails with:
> sage -t devel/sage/sage/symbolic/integration/integral.py
> **********************************************************************
> File "devel/sage/sage/symbolic/integration/integral.py", line 474, in
> sage.symbolic.integration.integral.integrate
> Failed example:
> (x^y-z).integrate(y,algorithm="sympy")
> Exception raised:
> Traceback (most recent call last):
> File
> "/mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-packages/sage/doctest/forker.py",
> line 479, in _run
> self.execute(example, compiled, test.globs)
> File
> "/mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-packages/sage/doctest/forker.py",
> line 838, in execute
> exec compiled in globs
> File "<doctest sage.symbolic.integration.integral.integrate[41]>",
> line 1, in <module>
> (x**y-z).integrate(y,algorithm="sympy")
> File "expression.pyx", line 9759, in
> sage.symbolic.expression.Expression.integral
> (sage/symbolic/expression.cpp:40828)
> File
> "/mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py",
> line 683, in integrate
> return integrator(expression, v, a, b)
> File
> "/mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py",
> line 39, in sympy_integrator
> return result._sage_()
> File
> "/mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-packages/sympy/core/add.py",
> line 721, in _sage_
> s += x._sage_()
> AttributeError: 'Piecewise' object has no attribute '_sage_'
>
> It was working with sympy 0.7.2 (because sage-on-gentoo had moved on to
> 0.7.2 separately)
> But it looks like the _sage_ attribute has been removed in 0.7.3.
> Is this a bug or code waiting for removal and we should use something else?
>
> Francois
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.