Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: rules on vector sequence

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98061] Re: rules on vector sequence
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 29 Mar 2009 02:44:49 -0500 (EST)
  • References: <gqkurj$47q$1@smc.vnet.net>

Filippo,

Generate all possible vectors with Tuples then select (with Cases or
Select) the ones that comply with 2 and 3. Use Total for 2 and Count
for 3.

Cheers -- Sjoerd

On Mar 28, 12:40 pm, Filippo Miatto <sottosupr... at gmail.com> wrote:
> Dear all,
> I need to generate all the vectors, of a given length N, that have  
> these three properties:
>
> 1- the entries have to be among -2,-1,0,1,2
> 2- the sum of all the entries has to be 0
> 3- only two or four of the entries can be different from 0
>
> do you have any suggestions on how i can do that? i tried something  
> but without success.. expecially i don't know how to implement the  
> third rule..
> thank you in advance!
> Filippo



  • Prev by Date: Re: rules on vector sequence
  • Next by Date: Re: pdf export problem
  • Previous by thread: Re: rules on vector sequence
  • Next by thread: Re: rules on vector sequence