MathGroup Archive 2002

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

Search the Archive

Re: irritating little problem

  • To: mathgroup at
  • Subject: [mg32937] Re: irritating little problem
  • From: Thomas Burton <tburton at>
  • Date: Wed, 20 Feb 2002 01:26:19 -0500 (EST)
  • Sender: owner-wri-mathgroup at


Given a vector v,

v = {b, a, b, b, c, d, e, d, f, d, c, b, c, g};

I would recommend the following method. First, append the positions to the

vv = Transpose[{v, Range[Length[v]]}]

Next, sort and split into sublists of equal values.

vs = Split[Sort[vv],  First[#1] == First[#2] & ]

What you do next depends upon details I don't know.

Hope this helps.

Tom Burton

On 2/18/02 11:36 PM, in article a4sv9c$ido$1 at, "KIMIC Weijnitz
Peter" <micweij at> wrote:

> I have a simple vector
> and I want to find the position of elements that are equal.
> I.e I want to test the vector and find all cases of similar elements.
> Brute force is not what I want, it can be a long vector.
> Best regards
> Petr W

  • Prev by Date: Re: Manipulating Pattern Matching ?
  • Next by Date: Re: Problems using Plot function
  • Previous by thread: Re: irritating little problem
  • Next by thread: RE: irritating little problem