The SageMath function sum accepts an optional "zero" argument precisely
for this purpose

sage: sum([], 0)
0
sage: sum([], 11)
11
sage: sum([], [])
[]

Le 17/06/2019 à 11:18, Peter Luschny a écrit :
Hi,

I think we should be confident that the sum of integers is
again an integer, the sum of rational numbers a rational number
and that the sum of polynomials is a polynomial.

With Sage this is not the case.

def ib(m, n): return sum(binomial(m*n-1, m*k)*OmegaPolynomial(m,k) for k in
(0..n-1))

The terms "binomial(m*n-1, m*k)*OmegaPolynomial(m,k)" are of type
<type
'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'>

However "for n in (0..6): print(ib(2, n).list())" yields an
AttributeError: 'int' object has no attribute 'list'.

OK, it is not difficult to work around this.
But would you agree to call this behavior a bug?


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/2e23c6a7-039a-cd89-aae2-3f7468df7cbc%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to