MathGroup Archive 2011

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

Search the Archive

Handling conditions on subvector elements

  • To: mathgroup at
  • Subject: [mg117532] Handling conditions on subvector elements
  • From: Lengyel Tamas <lt648 at>
  • Date: Tue, 22 Mar 2011 05:05:46 -0500 (EST)

Dear Mathworld users,

I am struggling with a piece of code which should result in a List :

1) I have a vector with subvectors with triplets of values.
2) What I wish to achieve is a cycle that returns with a List with either
'1's or '2's in it.
3) The cycle should check whether the first and second element in
subvectors are equal and neither of them are equal with the third, if so,
return 1;
   If all the elements are unequal, return 2


V= {{1,1,2},{1,1,3},{2,3,1},{1,2,3},{3,3,1}} should return with {1, 1, 2,

I'm assuming 'If' should be the key (as it returns 2 types of values), but
I can't seem to do it properly.

Thank you in advance


  • Prev by Date: Re: Wolfram, meet Stefan and Boltzmann
  • Next by Date: Re: Jacobian
  • Previous by thread: Message: "Syntax error in file: xyz" on trying to open saved nb. Ver: 8.0.1
  • Next by thread: Re: Handling conditions on subvector elements