MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Number of monomials

Szabolcs Horvát wrote:
> To count the number of terms in a sum, use e.g.
> Length[{ Sequence@@sum }]

Sorry, this is incorrect.  I think that the only reliable way to count 
the number of terms in a sum is to explicitly check if there is only one 
or more terms.

numOfTerms[terms_Plus] := Length[terms]
numOfTerms[term_] := 1

  • Prev by Date: Re: Number of monominals
  • Next by Date: FW: Minimum width of Button[.] on different platforms
  • Previous by thread: Re: Number of monomials
  • Next by thread: Re: Re: Another stylesheet question