MathGroup Archive 1996

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

Search the Archive

multinomials: a programming question

  • To: mathgroup at
  • Subject: [mg3923] multinomials: a programming question
  • From: Jack Goldberg <jackgold at>
  • Date: Fri, 10 May 1996 03:28:30 -0400
  • Organization: University of Michigan, College of Literature, Science, and the Arts
  • Sender: owner-wri-mathgroup at

Hello Mma users,

I am concerned about some limitations in the Sum command.
Here is the example that motivated this message.  Although 
Mma can easily expand  (a+b+c)^n  for any specific non-negative 
choice of integer  n,  I need to write the trinomial expansion 
out in terms of Sum.  Something like this:

tri[a_,b_,c_,n_] := Sum[Multinomial[i,j,k]*a^i*b^j*c*k, ???]
where  i+j+k = n.  (Multinomial is a built-in function.)

The problem is with the iterator(s).  The condition  i+j+k =  n
is causing me great difficulty.  What would be nice is a solution
that works in the general multinomial case, but perhaps that is asking 
too much - I would be happy for the trinomial expansion.

The more general issue here is this:  Many sums in mathematics  (most 
more important than the above trivial problem) are indexed over more
complicated sets than allowed by the syntax of Sum.  For example,
open any book on number theory - I opened my copy of An Introduction 
To The Theory of Numbers, I. Niven et. al. - and found the Mobius 
inversion formula, pg 194, part 
of which reads (subject to the limitation of my keyboard)

The sum over all divisors  d  of  n  of the product of  
mu(d)*F(n/d) ... 

Instead of having to recast this remarkable formula into terms 
understandable by Sum, wouldn't it be nice to have the set over 
which the sum is taken be given as the iterator.  Then my trinomial 
problem would be solved like this:

tri[a_,b_,c_,n_] := Sum["as above", {i+j+k=n}]

Your thoughts are more than welcome!

Jack Goldberg
University of Michigan


  • Prev by Date: Re: implementation of cos,sin,tan,etc.
  • Next by Date: Re: Julian Day Calculation - Plea for Help
  • Previous by thread: Re: multinomials: a programming question
  • Next by thread: Re: multinomials: a programming question