Ask Your Question

Neal's profile - activity

2018-07-03 11:58:19 +0100 received badge  Student (source)
2016-09-19 20:25:22 +0100 received badge  Notable Question (source)
2016-09-19 20:25:22 +0100 received badge  Famous Question (source)
2015-11-26 13:46:30 +0100 received badge  Popular Question (source)
2014-11-16 23:43:32 +0100 received badge  Editor (source)
2014-11-16 23:35:36 +0100 asked a question help with simple integration of piecewise function?
r = var('r')
Piecewise([[(1,2), 1/floor(r)]]).integral(r,1,2)

Gives an error:

Error in lines ... 
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'variables

What am I doing wrong? I note that

Piecewise([[(1,2), 1/floor(r)]]).integral(r)

gives output ``Piecewise defined function with 1 parts, [[(1, 2), r1 |--> integrate(1/floor(r1), r1, 1, r1)]]''.

And that

integrate(1/floor(r1), r1, 1, r1)(2)

gives the same error as the first attempt. Here's the full stacktrace of the error:

EDIT: Thanks. Here's the full stack trace for the error:

File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/functions/piecewise.py", line 833, in integral
return F(b) - F(a)

File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/functions/piecewise.py", line 665, in __call__
return self.functions()[n-1](x0)

File "expression.pyx", line 4391, in sage.symbolic.expression.Expression.__call__ (build/cythonized/sage/symbolic/expression.cpp:21933)

File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/callable.py", line 477, in _call_element_
return SR(_the_element.substitute(**d))

File "expression.pyx", line 4242, in sage.symbolic.expression.Expression.substitute (build/cythonized/sage/symbolic/expression.cpp:21183)

File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 161, in _eval_
if len(x.variables()) == 1:

File "element.pyx", line 344, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4022)

File "misc.pyx", line 257, in sage.structure.misc.getattr_from_other_class (build/cythonized/sage/structure/misc.c:1775)
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'variables'