Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: coin toss
Posted:
Sep 9, 2005 1:38 AM
|
|
On 8 Sep 2005 at 6:36, Robert Morewood wrote:
> BlankMondragon (blankmondragon@gmail.com) wrote about FakeName's query: > : : If you toss 100 coins, what's the probability of getting 5, > : : either heads or tails, in a row? 6 in a row? > : : How do you figure it out? > : > : You can make a simulation. > : > < intermediate results snipped > > : > : show simul 5 > : 0.975 > : > : show simul 6 > : 0.84 > > Would you care to share some of your code? Did you do that in LISP?
It's Logo. MSWLogo with LogoFE (Logo Functional Extensions). LogoFE is in Spanish.
make "many.throws impon "random clona: 100 2
show :many.throws [1 1 0 0 1 0 0 1 0 1 1 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1]
show disgrega duplica :many.throws [[1 1] [0 0] [1] [0 0] [1] [0] [1 1 1 1] [0] [1 1] [0 0 0] [1 1 1 1 1 1 1] [0] [1 1 1] [0] [1] [0] [1 1] [0 0] [1] [0] [1] [0] [1 1 1] [0 0 0 0 0] [1 1 1] [0 0 0 0 0] [1 1] [0 0 0] [1 1] [0] [1] [0] [1] [0 0] [1 1 1] [0 0] [1 1] [0 0] [1 1] [0 0] [1] [0] [1] [0] [1 1] [0 0] [1 1 1 1 1] [0] [1 1 1]]
show impon "count disgrega duplica :many.throws [2 2 1 2 1 1 4 1 2 3 7 1 3 1 1 1 2 2 1 1 1 1 3 5 3 5 2 3 2 1 1 1 1 2 3 2 2 2 2 2 1 1 1 1 2 2 5 1 3]
show max impon "count disgrega duplica :many.throws 7
show esmenor: 4 max impon "count disgrega duplica :many.throws 1
make "many.experiments impon [esmenor: 4 max impon "count disgrega duplica impon "random] clona: 100 clona: 100 2
show :many.experiments [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
show media :many.experiments 0.99
funciona "simul [concreta [media impon [esmenor: dec $X max impon "count disgrega duplica impon "random] clona: 1000 clona: 100 2]]
show simul 5 0.975
show simul 6 0.84
show simul 7 0.548
show simul 8 0.3
show simul 9 0.15
show simul 10 0.081
Daniel http://mondragon.angeltowns.net/logofe/
PS. This page is about a simulation of the Birthday paradox: http://mondragon.angeltowns.net/paradiso/ProblemaCumpleanos.html
-- submissions: post to k12.ed.math or e-mail to k12math@k12groups.org private e-mail to the k12.ed.math moderator: kem-moderator@k12groups.org newsgroup website: http://www.thinkspot.net/k12math/ newsgroup charter: http://www.thinkspot.net/k12math/charter.html
|
|
|
|