Im typing in the sage terminal the following
k = var('k')
sum(k^2, k, 1, n)
Output should be:
1/3*n^3 + 1/2*n^2 + 1/6*n
Output actually is:
TypeError Traceback (most recent call last)
<ipython-input-8-4790b7807cd9> in <module>()
----> 1 sum(k**Integer(2), k, Integer(1), n)
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/misc/functional.pyc in symbolic_sum(expression, *args, **kwds)
652 """
653 if hasattr(expression, 'sum'):
--> 654 return expression.sum(*args, **kwds)
655 elif len(args) <= 1:
656 return sum(expression, *args)
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.sum (sage/symbolic/expression.cpp:40331)()
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in symbolic_sum(expression, v, a, b, algorithm)
578 raise TypeError("need a summation variable")
579
--> 580 if v in SR(a).variables() or v in SR(b).variables():
581 raise ValueError("summation limits must not depend on the summation variable")
582
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8372)()
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3856)()
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3757)()
/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/ring.so in sage.symbolic.ring.SymbolicRing._element_constructor_ (sage/symbolic/ring.cpp:4958)()
TypeError:
Can someone troubleshoot me?