RE: Mathematica commands needed to solve problem in Set Theory!
- To: mathgroup at smc.vnet.net
- Subject: [mg43629] RE: [mg43610] Mathematica commands needed to solve problem in Set Theory!
- From: "Ingolf Dahl" <ingolf.dahl at telia.com>
- Date: Fri, 26 Sep 2003 04:45:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Here is one solution. I have tried to be as straightforward as possible: (* First a list of all combinations of the properties haircolor, eyecolor, \ build, height. Red - haired, green - eyed, slender and tall are all represented by 1. *) universal4 = Flatten[Table[{haircolor, eyecolor, build, height}, {haircolor, 0, 1}, {eyecolor, 0, 1}, {build, 0, 1}, {height, 0, 1}], 3]; (* All the girls can have any of these combinations. Let us make a list of all combinations for all the girls Adele, Betty, Carol and Doris *) Adele = 1; Betty = 2; Carol = 3; Doris = 4; universal16 := Flatten[Outer[List, universal4, universal4, universal4, universal4, 1, 1, 1, 1], 3]; Length[universal16] (* Select subsets that corresponds to all the rules *) set0 = Select[universal16, Count[#, {1, 1, 1, 1}] == 1 &]; set1 = Select[universal16, Count[#, {_, 1, 1, _}] == 3 &]; set2 = Select[universal16, Count[#, {1, _, _, 1}] == 2 &]; set3 = Select[universal16, Count[#, {_, _, 1, 1}] == 2 &]; set4 = Select[universal16, Count[#, {1, 1, _, _}] == 1 &]; set5 = Select[universal16, #[[Adele, 2]] == #[[Betty, 2]] &]; set6 = Select[universal16, #[[Betty, 1]] == #[[Carol, 1]] &]; set7 = Select[universal16, #[[Carol, 3]] != #[[Doris, 3]] &]; set8 = Select[universal16, #[[Doris, 4]] == #[[Adele, 4]] &]; idealrevealed = Intersection[set0, set1, set2, set3, set4, set5, set6, set7, set8] Only two possibilities remain, and both indicate the same girl as the ideal. But is Johnny really the ideal boy for her? There are many other possibilities to generate the sets set0 to set8, by set theory operations combined with properly defined start sets. But why complicate things further? Ingolf Dahl Sweden >-----Original Message----- >From: Gilmar Rodríguez Pierluissi To: mathgroup at smc.vnet.net >[mailto:gilmar.rodriguez at nwfwmd.state.fl.us] >Sent: Tuesday, September 23, 2003 10:02 >To: mathgroup at smc.vnet.net >Subject: [mg43629] [mg43610] Mathematica commands needed to solve problem in Set >Theory! > > >The following is a problem from Set Theory, that I have > >attempted to solve using the standard, Mathematica Set > >Theoretic tools (i.e. Union, Intersection, and Complement) > >with no success. > >Here is the problem: > >************************************************************ > >Johnny (an assumed name to protect the inocent) is looking > >for his ideal girfriend, which according to his predilections, > >must be red-haired, green-eyed, slender, and tall. > >He knows four women: Adele, Betty, Carol, and Doris. > >Here are the requirements that they meet: > >0. Only one of the four women has all four characteristics > > that Johnny requires. > >1. Only three of the women are both green-eyed and slender. > >2. Only two of the women are both red-haired and tall. > >3. Only two of the women are both slender and tall. > >4. Only one of the women is both green-eyed and red haired. > >5. Adele and Betty have the same color eyes. > >6. Betty and Carol have the same color hair. > >7. Carol and Doris have different builds. > >8. Doris and Adele are the same height. > >Which one of the four women satisfies all of Johnny's > >requirements? > >************************************************************ > >Your assistance in solving this problem(using Mathematica > >commands) will be greatly appreciated! >