First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It is simply

sage: prod(S)
6

You cannot index S because it is not ordered; you would have to convert to a list first e.g. by list(S).

The elements of S are of type Integer and so prod will use the product of integers.

When you add to S a complex number element like 1+I which is of type Expression, the Integers will be coerced to Expressions, the product will work in the way you expect and the result will be an Expression.

click to hide/show revision 2
No.2 Revision

It is simply

sage: prod(S)
6

You cannot index S because it is not ordered; you would have to convert to a list first e.g. by s = list(S).

The elements of S are of type Integer and so prod will use the product of integers.

When you add to S a complex number element like 1+I which is of type Expression, the Integers will be coerced to Expressions, the product will work in the way you expect and the result will be an Expression.