That works well, but what about when the expression is multivariate, such as:
expand((1+x+1/y)^10) It would be nice to have a general command to count the number of summands in such an expression. Thanks, Alasdair On Mar 21, 10:41 am, Craig Citro <craigci...@gmail.com> wrote: > > Is there a Sage equivalent to Maple's "nops" command, which counts the > > number of operands in an expression? In particular, is there a > > command which returns the number of terms of something like > > > expand((1+x+1/x)^10) ? > > There's probably a classier way to do it, but this works: > > sage: len(expand((1+x+1/x)^10).coeffs()) > 21 > > -cc --~--~---------~--~----~------------~-------~--~----~ 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 URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---