Hi Cristóvão! On 25 Okt., 03:30, Cristóvão Sousa <cris...@gmail.com> wrote: > ... > It just has a minor bug when the operator has more than two operands, > like x+y+z, but I'll try to fix it as I got the picture now.
Yes, to my surprise, the "add" operator only accepts two arguments, but the list of operands of a sum may be longer: sage: s = 0.001*x^2+0.01*x+0.1*sin(1.01*x)+1 sage: s.operands() [0.00100000000000000*x^2, 0.0100000000000000*x, 0.100000000000000*sin(1.01000000000000*x), 1] sage: s.operator()(*s.operands()) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/king/<ipython console> in <module>() TypeError: op_add expected 2 arguments, got 4 I think that one should have s.operator()(*s.operands()) == s for any symbolic expression s. @symbolic experts (Burcin et al): Is it really necessary that x.operator() returns None and x.operands() returns []? What about an identity operator? Is it really necessary to break s.operands() into smaller pieces in order to reconstruct a sum? Why can' op_add accept an argument list of arbitrary length, in particular since the list of operands of a sum can be longer than two? Cheers, Simon -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org