Re: Pattern Matching
- To: mathgroup at smc.vnet.net
- Subject: [mg24232] Re: Pattern Matching
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Tue, 4 Jul 2000 15:21:59 -0400 (EDT)
- References: <8jrcgc$dup@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thomas, I am sure the staticians in the mathgroup can answer your question more precisely, but if you want a little code to visualize what is happening, try this. Suppose the wining ticket is b = {39, 12, 4, 23, 25, 2} Here is a list or random draws: a = Table[Random[Integer, {1, 47}], {5000}, {6}]; This gives the total number of winning "tickets" in the random sample a TotalNumberofWinningTickets = Length[Select[Map[Intersection[#, b] &, a], Length[#] >= 3 &]] This functions determines the number of winining tickets with n correct numbers WinningTickets[n_] := Length[Select[Map[Intersection[#, b] &, a], Length[#] == n &]] Have fun... Brian In article <8jrcgc$dup at smc.vnet.net>, Thomas Skipper <skipper at worldnet.att.net> wrote: > O.K., I know this will seem useless and trivial to quite a few, but > I'm just playing around here. > Basically, what I'm doing is this: > SeedRandom["a list"] > Then: > Table[Random[Integer, {1,47}], {any number}, {6}] > This produces a list of six numbers picked at random based on the list > in seed random. ( I think you can see where I'm going with this. My > friend Peter, a proffessor at Case Western whose specialty is > Pobabilty and Statistics says I'm all wet, but his dog Bucky, who also > is usaully pretty wet, thinks I'm on to something, but He's not > talking) > Anyway, what I want to find is n number of cases in {list a} that > match n numbers in {list b}. List a are the groups of six numbers > produced by Random. > List b are actual winning numbers. > I tried: > Cases[{%}, {"winning numbers"}], but this will only give me cases that > match all six (I think). What I want to do is match cases in list > a(numbers produced by Random) that have 3 of six in list b(acual > winning nubers), 4 of 6 and so on. I really want to see how many sets > of six I have to produce to get any practical results, if any. > Thanks > > Sent via Deja.com http://www.deja.com/ Before you buy.