Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

function within sum or product term

If I have a normal product, everything works well:

sage: product(x,x,2,3)                                                          
6

But if I have a function inside the product term, I get a value error:

sage: product(nth_prime(x),x,2,3)
ValueError: cannot convert x to int

sage: product(nth_prime(ZZ(x)),x,2,3)
TypeError: unable to convert x to an integer

The output should be

sage: nth_prime(2)*nth_prime(3)
15

function within sum or product term

If I have a normal product, everything works well:

sage: product(x,x,2,3)                                                          
6

But if I have a function inside the product term, I get a value error:

sage: product(nth_prime(x),x,2,3)
ValueError: cannot convert x to int

sage: product(nth_prime(ZZ(x)),x,2,3)
TypeError: unable to convert x to an integer

The output should be

sage: nth_prime(2)*nth_prime(3) 
15

15