To multiply an integer and a function seems to work in some cases:
f = lambda n: n
[2*f(n) for n in (0..9)]
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
On the other hand I often receive this error message but cannot see an error in my code:
/projects/sage/sage-6.9/src/sage/structure/element.pyx in sage.structure.element.RingElement.__mul__ (/projects/sage/sage-6.9/src/build/cythonized/sage/structure/element.c:17265)()
1852 elif PyInt_CheckExact(left):
1853 return (<ModuleElement>right)._mul_long(PyInt_AS_LONG(left))
-> 1854 return coercion_model.bin_op(left, right, mul)
1855
1856 cpdef RingElement _mul_(self, RingElement right):
/projects/sage/sage-6.9/src/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/projects/sage/sage-6.9/src/build/cythonized/sage/structure/coerce.c:9739)()
1068 # We should really include the underlying error.
1069 # This causes so much headache.
-> 1070 raise TypeError(arith_error_message(x,y,op))
1071
1072 cpdef canonical_coercion(self, x, y):
TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'function'>'
Can someone explain what is going wrong here?