MathGroup Archive 2002

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

Search the Archive

Re: Integer Solutions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37508] Re: [mg37496] Integer Solutions
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Sat, 2 Nov 2002 03:30:34 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Mathematica can indeed "solve" your equation with a simple command but 
the command is not "Solve", because your problem is not actually 
algebraic but combinatorial. Therefore the right way to solve it is:

In[1]:=
<<DiscreteMath`Combinatorica`

In[2]:=
Compositions[4,4]

Out[2]=
{{0,0,0,4},{0,0,1,3},{0,0,2,2},{0,0,3,1},{0,0,4,0},{0,1,0,3},{
   0,1,1,2},{0,1,2,1},{0,1,3,0},{0,2,0,2},{0,2,1,1},{0,2,2,0},{
   0,3,0,1},{0,3,1,0},{0,4,0,0},{1,0,0,3},{1,0,1,2},{1,0,2,1},{
   1,0,3,0},{1,1,0,2},{1,1,1,1},{1,1,2,0},{1,2,0,1},{1,2,1,0},{
   1,3,0,0},{2,0,0,2},{2,0,1,1},{2,0,2,0},{2,1,0,1},{2,1,1,0},{
   2,2,0,0},{3,0,0,1},{3,0,1,0},{3,1,0,0},{4,0,0,0}}




On Friday, November 1, 2002, at 03:44 PM, Munsup Seoh wrote:

> I have a question.  Please help me.  Can I solve the following 
> equation with
> a simple "Solve" command in Mathematica?
>
> ((x1, x2, x3, x4): x1 + x2 + x3 + x4 == 4; x1, x2, x3, x4 are 
> nonnegative
> integers}
>
> Munsup Seoh, PhD, Professor
> Department of Mathematics and Statistics
> Wright State University
> 3640 Colonel Glenn Hwy
> Dayton, OH 45435
>
> Phone: (937)775-2103 (W), (937)429-4731 (H)
> Fax:   (937)775-2081 (W)
> Email: munsup.seoh at wright.edu
> Homepage: www.wright.edu/~munsup.seoh
>
>
>
>
Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/



  • Prev by Date: Re: machine-size problem again?
  • Next by Date: Tensors in Mathematica
  • Previous by thread: Re: Integer Solutions
  • Next by thread: Re: D&D Dice