MathGroup Archive 2008

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

Search the Archive

Re: Number of monomials

  • To: mathgroup at
  • Subject: [mg87060] Re: Number of monomials
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Sun, 30 Mar 2008 01:18:30 -0500 (EST)
  • Organization: University of Bergen
  • References: <fsd6lf$9fn$> <fsg6rh$jae$> <> <fsl28k$gak$>

Artur wrote:
> In[1]:=Length[f[1]+f[2]+f[3]]
> Out[1]:=3
> OK!
> In[2]:=Length[f[1]+f[2]]
> Out[2]:=2
> OK!
> In[3]:=Length[f[1]]
> Out[3]:=0
> ???????????
> Who understand let share with me, please!

Please *do not* use the "reply" button when you want to start a new 
topic!  If you do, the message will still be grouped with the old thread 
in Google Groups and in many newsreaders, "shadowing" the original 
subject line of the discussion.  This is very annoying.

Also, please do not cheat when posting examples.  The label In[1] 
suggests that you evaluated this expression in a fresh kernel, but this 
cannot be the case.  Only the lengths of atomic expressions, like 
numbers or symbols, is 0, so the function f must have been defined in 
your example.

To count the number of terms in a sum, use e.g.
Length[{ Sequence@@sum }]

I suggest reading this tutorial:

  • Prev by Date: Re: Number of monomials
  • Next by Date: Re: Collect coefficients of array variables during calculation:
  • Previous by thread: Re: Number of monomials
  • Next by thread: Re: Number of monomials