MathGroup Archive 2002

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

Search the Archive

Re: Help! How to calculate additive partitions?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34439] Re: [mg34432] Help! How to calculate additive partitions?
  • From: Murray Eisenberg <murraye at attbi.com>
  • Date: Mon, 20 May 2002 04:21:32 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200205190815.EAA24177@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

In the HelpBrowser, go to MasterIndex, type in Partitions, click link
to  DiscreteMath`Combinatorica` .  Usage is, e.g.,

  Partitions[3]
{{3}, {2, 1}, {1, 1, 1}}

Note that this will NOT directly give you all the ORDERED solutions n1 +
n2 + ... + nk = 3 in nonnegative integers.  But it's a start.  I think
what you want will be given by:

  Flatten[Map[Permutations, Partitions[3]], 1]
{{3}, {2, 1}, {1, 2}, {1, 1, 1}}

Similarly:
  
  Flatten[Map[Permutations, Partitions[3]], 1]
{{4}, {3, 1}, {1, 3}, {2, 2}, {2, 1, 1}, {1, 2, 1}, {1, 1, 2}, {1, 1, 1,
1}}  
  

Thomas Brodhead wrote:
> 
> Help!
> 
> I need to find a formula or method that will allow me to calculate the
> additive partitions of a given number.
> 
> E.g., 3 can be expressed as
> 
> 1+1+1
> 2+1
> 1+2
> 3
> 
> IMPORTANT: Even though 2+1 and 1+2 employ the same values, the order is
> important and thus the procedure or formula that I need would need to
> produce both of those results.
> 
> Likewise, 4 would break down this way:
> 1+1+1+1
> 2+1+1
> 1+2+1
> 1+1+2
> 2+2
> 3+1
> 1+3
> 4
> 
> I need to calculate both the number of results that I should get, and the
> results themselves.
> 
> How can this be done?
> 
> Many thanks,
> --Tom
> ---------------------------------------------------------
> Tom Brodhead
> http://home.att.net/~tom.brodhead/
> ---------------------------------------------------------

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.       
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street
Amherst, MA 01375


  • Prev by Date: Re: Stochastic calculus in Mathematica
  • Next by Date: Re: Re: Help! How to calculate additive partitions?
  • Previous by thread: Help! How to calculate additive partitions?
  • Next by thread: Re: Help! How to calculate additive partitions?