Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Defining a function of the form f(x1,x2,...,xn)=ni=0xi

How can I define a function of the form f(x1,x2,...,xn)=ni=0xi I tried the following
sage: n = 2
sage: x = [ var('x_%d' % i) for i in range(n) ]
sage: f(x)=sum(x[i],i,0,n)
The last line gives me the error
"TypeError: 'sage.symbolic.expression.Expression' object does not support indexing".