MathGroup Archive 2008

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

Search the Archive

Re: Number of monomials

  • To: mathgroup at
  • Subject: [mg87090] Re: Number of monomials
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Mon, 31 Mar 2008 02:06:28 -0500 (EST)
  • Organization: University of Bergen
  • References: <fsd6lf$9fn$> <fsg6rh$jae$> <> <fsl28k$gak$> <fsnbeq$db2$>

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