Ahem. It just has to be clear and convincing to me.
----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Thursday, September 7, 2006 6:47 pm
Subject: Re: [Jprogramming] The Monty Hall Problem
> > other=: 2 1 2 0 1 0 _1 {~ (_2]\0 1 0 2 1 0 1 2 2 0 2 1) i. ,.
>
> One of the requirements for simulation is that
> it is clear and convincing.
> The choice of the lookup for other is not clear.
> Because of that, it is not clear if it does
> not contain a reduction either (a codified sample space).
>
>
> --- Roger Hui <[EMAIL PROTECTED]> wrote:
>
> > The object of the game is to win a car.
> >
> > Two goats and a car are hidden behind 3 doors, one
> > item per door. You choose a door. The gamemaster
> > (Monty Hall), who knows what's behind the doors,
> > opens one of the other doors, revealing a goat, and
> > offers you the opportunity to change your choice of
> > doors. Your chosen door is then opened and you get
> > what is behind.
> >
> > Should you stick or switch?
> >
> > Many people get this wrong, including people with
> > Ph.D. degrees in mathematics and statistics, and
> > including Paul Erdos as recounded in chapter 6 of
> > Paul Hoffman's "The Man Who Loved Only Numbers".
> >
> > The present task is to write two simulation
> > programs, one for the strategy of sticking with
> > the original choice and another for the strategy
> > of switching. The argument is the number of
> > simulations of the game; the result is the number
> > of cars won.
> >
> > Spoiler alert: Solution below.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > stick=: 3 : 0
> > c=. y [EMAIL PROTECTED] 3 NB. where the car is hidden
> > i=. y [EMAIL PROTECTED] 3 NB. your choice of door
> > c +/@:= i NB. number of cars that you win
> > )
> >
> > switch=: 3 : 0
> > c =. y [EMAIL PROTECTED] 3 NB. where the car is hidden
> > i =. y [EMAIL PROTECTED] 3 NB. your choice of door
> > h0=. ((_2]\0 1 0 2 1 0 1 2 2 0 2 1) i. c,.i){2 1 2 0 1 0 _1
> > h1=. (y [EMAIL PROTECTED] 2){"_1 i{_2]\1 2 0 2 0 1
> > h =. (c=i)}h0,:h1 NB. Monty Hall opens this door
> > j =. ((_2]\0 1 0 2 1 0 1 2 2 0 2 1) i. h,.i){2 1 2 0 1 0 _1
> NB. your switched choice
> > c +/@:= j NB. number of cars that you win
> > )
> >
> > NB. h0: Monty Hall's choice if a goat is behind your door
> > NB. h1: Monty Hall's choice if a car is behind your door
> >
> > stick 1e6
> > 333143
> > stick 1e6
> > 332564
> >
> > switch 1e6
> > 666771
> > switch 1e6
> > 665859
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm