2022-10-13 16:05:30 +0100 | received badge | ● Famous Question (source) |
2016-06-21 01:58:05 +0100 | received badge | ● Nice Question (source) |
2016-02-05 12:33:14 +0100 | received badge | ● Notable Question (source) |
2016-02-05 12:33:14 +0100 | received badge | ● Popular Question (source) |
2015-04-30 12:06:12 +0100 | received badge | ● Student (source) |
2015-04-30 07:51:50 +0100 | received badge | ● Scholar (source) |
2015-04-30 07:51:40 +0100 | commented answer | bell_polynomial(n,k).coefficients() raises an error All polynomials with k=0 are affected, and the error is not even consistent: b = bell_polynomial(3,0); b.parent() leads to: AttributeError: 'int' object has no attribute 'parent'. tmontail, is there a convention how the coefficients of the null polynomial are represented in Sage? [] or 0? |
2015-04-29 18:45:27 +0100 | asked a question | bell_polynomial(n,k).coefficients() raises an error Consider the Bell polynomials: Extracting the coefficients I expect this triangle: However this call (which looks very natural) does not work: It gives the error message: AttributeError: 'sage.rings.rational.Rational' object has no attribute 'coefficients'. However I nowhere give a sage.rings.rational.Rational object as an input. My input is a polynomial if I can trust the name "bell_polynomial(n,k)". So may I consider this as an internal error/bug? Ralf Stephan showed me a workaround: This gives indeed the expected output. However it might be even better to represent the null polynomial by the empty list (to comply with the understanding that only nonzero coefficients are shown). This leads to: Is this a workaround just to fit my possibly ill-guided expectations or is this a reasonable patch for the general case? Or is it correct that an object which is called a polynomial raises an error if asked for the coefficients? |