why does Sage find problems when calculating with objects put in a list ?
I define the following function:
def vbl(c, ex):
l = len(c)
V = 1
for i in range(n):
V = V * [c[i]**ex[i]]
return V
I then compute
sage: vbl(['x, y, z'], [2, 3, 4])
expecting to get
x^2**y^3**z^4
Instead, I get an error:
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
Yet I can compute x^2
, y^3
and z^4
after declaring x
, y
and z
as variables:
sage: var('x, y, z')
What happens?
when I entered vbl(['x,y,z'],[2,3,4], I expected the above program to return x^2y^3z^4 . Instead, it returns the following error : TypeError : unsupported operand type(s) for ** or pow(): 'str' and 'int'. Yet I can do the following calcinations : X^2,Y^3 and Y^4 when I declared X,Y and Z as variables (var('x,y,z)). What happend ?
I edited your question to add the part that you had written as a comment. If you are happy with the edit, please delete your comment (and I'll delete mine).