1 | initial version |
When you call integrate(<...>, algorithm="sympy")
, what happens is essentially:
sympy.integrate
function (or method) ;This last step fails in your specific case :
sage: var("t")
t
sage: import sympy
sage: foo=sympy.integrate(sympy.sympify(log(t)/(t+1)),[t]); foo
Piecewise((I*pi*log(t + 1) - polylog(2, t + 1), Abs(t + 1) < 1), (-I*pi*log(1/(t + 1)) - polylog(2, t + 1), Abs(1/(t + 1)) < 1), (-I*pi*meijerg(((), (1, 1)), ((0, 0), ()), t + 1) + I*pi*meijerg(((1, 1), ()), ((), (0, 0)), t + 1) - polylog(2, t + 1), True))
sage: type(foo)
Piecewise
sage: foo._sage_()
...
AttributeError: 'TupleArg' object has no attribute '_sage_'
meaning that Sage does not (currently) have methods to convert a Sympy Piecewise
object to a
2 | No.2 Revision |
When you call integrate(<...>, algorithm="sympy")
, what happens is essentially:
sympy.integrate
function (or method) ;This last step fails in your specific case :
sage: var("t")
t
sage: import sympy
sage: foo=sympy.integrate(sympy.sympify(log(t)/(t+1)),[t]); foo
Piecewise((I*pi*log(t + 1) - polylog(2, t + 1), Abs(t + 1) < 1), (-I*pi*log(1/(t + 1)) - polylog(2, t + 1), Abs(1/(t + 1)) < 1), (-I*pi*meijerg(((), (1, 1)), ((0, 0), ()), t + 1) + I*pi*meijerg(((1, 1), ()), ((), (0, 0)), t + 1) - polylog(2, t + 1), True))
sage: type(foo)
Piecewise
sage: foo._sage_()
...
AttributeError: 'TupleArg' object has no attribute '_sage_'
meaning that Sage does not (currently) have methods to convert a Sympy Piecewise
object to a
piecewise
object. BTW, since Sympy's Piecewise
and Sage's piecewise
have different semantics, this would be a bit problematic. You can still access the various parts of Sympy's answer by indexing the result :
sage: foo.args[0]
(I*pi*log(t + 1) - polylog(2, t + 1), Abs(t + 1) < 1)
sage: foo.args[0][0]
I*pi*log(t + 1) - polylog(2, t + 1)
sage: foo.args[0][0]._sage_()
I*pi*log(t + 1) - dilog(t + 1)
Note that in the future, conversion methods may be added to Sage to handle these cases (Ralf Stefan has started a large set of additions in this direction). Note also that in this specific case, foo[2][0]
won't translate back to Sage (which currently doesn't know meijerg
functions).