MathGroup Archive 2003

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

Search the Archive

Re: Finding Repeated Number Blocks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45290] Re: Finding Repeated Number Blocks
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sun, 28 Dec 2003 05:10:49 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 12/27/03 at 5:00 AM, private at nospam.com (Mark) wrote:

> I am looking for some software to do the following, and wonder whether
> Mathematica will enable me too do this, or whether there is a
> cheaper/simpler solution available?

> I have several sets of numbers, e.g. :

> set 1 :  5, 4, 12, 15, 19, 15, 16, 19, 18, 21, 3, ....
> set 2 :  1, 7, 4, 9, 22, 83, 17, 61, 1, 73, 15, 16, 19, ...
> set 3 : 7, 93, 14, 73, 14, 25, 82, 21, 12, 17, ...
> and so on...
 
> and I am looking for some software which can read through the numbers
> and find "blocks" of duplicated patterns between the different sets,
> for example, if I ran it through the above sets, it would point out
> "15, 16, 19" in set 1 and set 2.

Yes, Mathematica can do this. It is particularly easy if you know the block length. Putting your particular example into Mathematica code:

set1 = {5, 4, 12, 15, 19, 15, 16, 19, 18, 21, 3}; 
set2 = {1, 7, 4, 9, 22, 83, 17, 61, 1, 73, 15, 16, 19};
set3 = {7, 93, 14, 73, 14, 25, 82, 21, 12, 17};

Then

Intersection[Partition[set1, 3, 1], Partition[set2, 3, 1]]

results in

{{15, 16, 19}}

the desired block

If the block length isn't know, the problem is more complex but can still be done in Mathematica.

As far as cheaper solutions, I am sure there is less expensive software than Mathematica that can do what you want. Whether they are simpler or not will depend on what you mean by simpler.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Compile
  • Next by Date: Re: Re: Compile
  • Previous by thread: Finding Repeated Number Blocks
  • Next by thread: Printing "Alias" Definitions