Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: coin toss
Replies: 1   Last Post: Sep 9, 2005 1:38 AM

 BlankMondragon Posts: 4 Registered: 6/4/05
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/