MathGroup Archive 2003

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

Search the Archive

Re: Mathematica commands needed to solve problem in Set Theory!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43650] Re: Mathematica commands needed to solve problem in Set Theory!
  • From: "Lars Rasmusson" <Lars.Rasmusson at hp.com>
  • Date: Sat, 27 Sep 2003 04:58:13 -0400 (EDT)
  • Organization: Hewlett-Packard Laboratories, Bristol, UK
  • References: <bkp284$d0k$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Solve this as a normal equation system with NSolve.

Use 20 binary variables, where redhair[2]==1 if girl 2 is redhaired, etc.

Recall that x^2==x constrains a real variable to be in {0,1}.

(***********************************************)
{Adele, Betty, Carol, Doris} = {1, 2, 3, 4};

(* use 20 binary variables *)
vars = Flatten[Table[{greeneye[i], slender[i], redhair[i], tall[i],
perfectgirl[i]}, {i, 4}]];

(* constrain the variables to be {0, 1} *)
binconstraints = Map[#^2 == # &, vars];

problem = Join[binconstraints, {
  Sum[greeneye[i] slender[i], {i, 4}] == 3,
  Sum[redhair[i] tall[i], {i, 4}] == 2,
  Sum[slender[i] tall[i], {i, 4}] == 2,
  Sum[greeneye[i] redhair[i], {i, 4}] == 1,
  greeneye[Adele] == greeneye[Betty],
  redhair[Betty] == redhair[Carol],
  slender[Carol] == 1 - slender[Doris],
  tall[Adele] == tall[Doris]},
  Table[redhair[i] greeneye[i] slender[i] tall[i] ==
    perfectgirl[i], {i, 4}]
];

sol =  NSolve[problem, vars];
Table[perfectgirl[i], {i, 4}] /. sol

Hope this helps.
Cheers,
Lars


"Gilmar Rodríguez Pierluissi" <gilmar.rodriguez at nwfwmd.state.fl.us> wrote in
message news:bkp284$d0k$1 at smc.vnet.net...
> 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!
>



  • Prev by Date: Re: Mathematica commands needed to solve problem in Set Theory!
  • Next by Date: Re: Incorrect integral
  • Previous by thread: Re: Mathematica commands needed to solve problem in Set Theory!
  • Next by thread: how import data to mathematica????