ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 08 Apr 2011 00:17:29 +0200Variable type returned after integrating.https://ask.sagemath.org/question/8038/variable-type-returned-after-integrating/If I have an expression and I integrate it, the type of object that is returned is not constant.
> x = var('x')
> type((x**2).integral(x))
<type 'sage.symbolic.expression.Expression'>
> type((0*x).integral(x))
<type 'sage.rings.integer.Integer'>
This makes it quite hard to write functions that do things with Expressions. Is there some trick I'm missing to get around this?
An example of where this causes a problem:
> ff = Piecewise([[(-Infinity, -1), 0*x], [(-1, 1), x**0], [(1, Infinity), 0*x]], x)
> ff.integral(x, -1.0, 1.0)
Traceback (click to the left of this block for traceback)
...
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'function'Ben ReynwarFri, 08 Apr 2011 00:17:29 +0200https://ask.sagemath.org/question/8038/