Reading the page referenced, I see where I was confused.  The problem
starts out as 100 people each with $100, but then solves a variant of it
for 45 people with $45 each, possibly so the animation is legible.  It's
not clear why they even mention the first set of numbers.

On Mon, Jul 10, 2017 at 8:37 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> Oops, I did not think about that "reflexive giving" wart.
>
> Here's a fix for my version:
>
>    tick=: (0 >. <:) + i.@# +/@:(=/)~ I.@:* (] + <:) +/@:* ?@# <:@#
>    require 'stats'
>    stddev"1 tick^:(i.10) 45#45
> 0 0.977008 1.18705 1.73205 2.01133 2.15322 2.46798 2.86832 2.97719 3.1334
>    tick^:10000]20#20
> 3 20 1 15 10 38 6 8 23 24 11 90 33 67 5 13 7 20 1 5
>
> Thanks,
>
> --
> Raul
>
> On Mon, Jul 10, 2017 at 7:50 PM, 'Pascal Jasmin' via Programming
> <programm...@jsoftware.com> wrote:
> >
> >
> > The number of $ available each round is the number of people with >&0.
> The number of potential recipients is the population.  This simplification
> though means its possible for someone to pay himself.
> >
> >
> > A correction to your version,
> >
> > /:~@(-&1`]@.(=&0)"0 (#/.~@] + ~.@]{[)`(~.@])`[} >&0 # (?@#~@#@]`]`[} ]
> I.@:= i.@#)@?@#~@#)^:21000 #~10
> >
> > That assumption would increase the likelihood of eventual
> "superconcntration"  but that doesn't seem to happen.
> >
> > As soon as some have 0, the rest have a "negative return" expectation
> each turn.
> >
> >
> > ________________________________
> >
> >
> > From: Xiao-Yong Jin <jinxiaoy...@gmail.com>
> >
> > To: "programm...@jsoftware.com" <programm...@jsoftware.com>
> >
> > Sent: Monday, July 10, 2017 3:43 PM
> >
> > Subject: [Jprogramming] Everyone giving dollars to random others
> >
> >
> >
> >
> > I thought this is a good lunch break exercise.
> >
> >
> >
> > http://www.decisionsciencenews.com/2017/06/19/counterintuitive-
> problem-everyone-room-keeps-giving-dollars-random-others-
> youll-never-guess-happens-next/
> >
> >
> >
> > Quote: “Imagine a room full of 100 people with 100 dollars each. With
> every tick of the clock, every person with money gives a dollar to one
> randomly chosen other person. After some time progresses, how will the
> money be distributed?”
> >
> >
> >
> > And I came up with this simulation.  (45 people with 45 dollars each,
> same as on the webpage.)
> >
> >
> >
> > /:~@(-&1`]@.(=&0)"0 (#/.~@] + ~.@]{[)`(~.@])`[} >&0 # (?@#~@#@]`]`[} ]
> I.@:= i.@#)^:_@?@#~@#)^:5000 #~45
> >
> >
> >
> > And I really like to see the mean expectations and the standard
> deviation of the mean, I ended up doing this.  (Make sure the J sentence is
> one long line if you want to try it out.)
> >
> >
> >
> >     ((],.[:(+/%#*<:@#)&.:*: -"1)+/%#)}.(/:~@(-&1`]@.(=&0)"0 (#/.~@] +
> ~.@]{[)`(~.@])`[} >&0 # (?@#~@#@]`]`[} ]I.@:=i.@#)^:_@?@#~@#)^:10000)^:(<65)
> #~45
> >
> >
> > 0.984375 0.124984
> >
> >
> > 2.01562 0.170335
> >
> >
> >   3.0625 0.180765
> >
> >
> > 4.15625 0.230616
> >
> >
> > 5.21875 0.248476
> >
> >
> >   6.1875 0.306894
> >
> >
> > 7.35938 0.332862
> >
> >
> > 8.64062 0.362809
> >
> >
> > 9.84375 0.380723
> >
> >
> > 10.9688 0.383805
> >
> >
> >   12.125 0.407944
> >
> >
> > 13.6406 0.423964
> >
> >
> > 15.0625 0.457453
> >
> >
> > 16.5312 0.462893
> >
> >
> > 18.1875 0.480717
> >
> >
> > 19.7031 0.464877
> >
> >
> > 21.1562 0.475709
> >
> >
> > 22.7031 0.483702
> >
> >
> > 24.4062 0.516935
> >
> >
> > 26.4062   0.5768
> >
> >
> > 28.1094 0.604266
> >
> >
> > 29.8281 0.617838
> >
> >
> >   31.875  0.61942
> >
> >
> > 33.9375 0.603345
> >
> >
> > 35.7812 0.642211
> >
> >
> > 37.9844 0.647987
> >
> >
> > 40.6562 0.731321
> >
> >
> >       43 0.739342
> >
> >
> > 45.3906 0.723616
> >
> >
> > 48.0469   0.7613
> >
> >
> > 51.6094 0.823639
> >
> >
> > 54.7656 0.873934
> >
> >
> > 57.1406 0.815544
> >
> >
> >       60 0.866598
> >
> >
> > 63.8594 0.898319
> >
> >
> >    68.75 0.918018
> >
> >
> > 73.5781  1.00736
> >
> >
> > 78.3281  1.08128
> >
> >
> > 84.9688  1.25534
> >
> >
> > 93.4688  1.29731
> >
> >
> > 104.578  1.73274
> >
> >
> > 114.922  2.07574
> >
> >
> > 131.938   2.7357
> >
> >
> > 159.359  4.40899
> >
> >
> > 204.766  7.24239
> >
> >
> >
> > So, how do I make a fancy animation (like the one in the webpage I
> linked in the beginning of this message) with J?
> >
> >
> > ----------------------------------------------------------------------
> >
> >
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to