MathGroup Archive 2011

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

Search the Archive

Re: Reduce a vector eliminating equal components

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117030] Re: Reduce a vector eliminating equal components
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 8 Mar 2011 05:34:46 -0500 (EST)

example = RandomInteger[{0, 3}, 20]

{3, 2, 2, 2, 2, 1, 3, 0, 0, 2, 3, 1, 0, 1, 3, 2, 1, 1, 3, 3}

sorted = Union@example

{0, 1, 2, 3}

unsorted = Tally[example][[All, 1]]

{3, 2, 1, 0}

(Complete reversal was an accident of the sample.)

Bobby

On Mon, 07 Mar 2011 04:46:30 -0600, Antonio Mezzacapo  
<ant.mezzacapo at gmail.com> wrote:

> Hello,
>
> I would to know if there is a simple way to obtain this result: I have a
> vector of size n who contains a certain number of same object. I want it  
> to
> be reduced to a smaller vectors who doesn't contains equal objects.
>
> Thank you
> Antonio Mezzacapo


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Notebook interface and Wolfram-Alpha
  • Next by Date: Re: making something autoexecute before normal execution
  • Previous by thread: Re: Reduce a vector eliminating equal components
  • Next by thread: Re: Reduce a vector eliminating equal components