| Download
All published worksheets from http://sagenb.org
Project: sagenb.org published worksheets
Views: 168737Image: ubuntu2004
Here is a traditional game we can use to illustrate probability:
Hei
Every time you evaluate the above cell, Sage will randomly choose one of the sides of a virtual dreidel.
Let's spin it a bunch of times:
Nun
Shin
Shin
Nun
Gimel
Shin
Gimel
Gimel
Nun
Nun
Here is a traditional interpretation of the choices:
Nun : None
Gimel : Gimme
Hei : Hey! I only get half?
Shin : Oh shin!
[5, 1, 0] 3
[4, 0, 0] 5
player 1 : Gimel ---> [9, 0, 0] 0
[8, 0, 0] 1
Here is another fun game based on probability:
'Heads - I win!'
This is an excellent game. I really like it, because every time I play it, I win! : )
Here is an easy way to simulate a die in Sage:
1
Wow, that sounds really existential!
Here we have a virtual 26-sided die:
'a'
Let's throw a pair of six-sided dice and plot the results:
[0, 0, 270, 592, 794, 1095, 1459, 1622, 1340, 1084, 885, 566, 293]
Here is a way to represent a deck of cards:
[(A, S), (2, S), (3, S), (4, S), (5, S), (6, S), (7, S), (8, S), (9, S), (10, S), (J, S), (Q, S), (K, S), (A, D), (2, D), (3, D), (4, D), (5, D), (6, D), (7, D), (8, D), (9, D), (10, D), (J, D), (Q, D), (K, D), (A, C), (2, C), (3, C), (4, C), (5, C), (6, C), (7, C), (8, C), (9, C), (10, C), (J, C), (Q, C), (K, C), (A, H), (2, H), (3, H), (4, H), (5, H), (6, H), (7, H), (8, H), (9, H), (10, H), (J, H), (Q, H), (K, H)]
[(7, C), (A, S), (8, S), (9, S), (7, D), (10, D), (Q, C), (2, D), (9, C), (8, C), (2, C), (6, H), (5, C), (7, S), (J, D), (4, C), (4, D), (K, S), (9, H), (10, C), (J, S), (5, H), (A, H), (6, D), (8, H), (3, C), (3, D), (3, H), (Q, H), (4, H), (A, D), (K, C), (5, S), (J, C), (K, H), (5, D), (10, H), (4, S), (J, H), (6, S), (2, H), (Q, D), (3, S), (9, D), (K, D), (6, C), (8, D), (7, H), (Q, S), (10, S), (A, C), (2, S)]
[(2, S), (A, C), (10, S), (Q, S), (7, H)]
[(7, C), (A, S), (8, S), (9, S), (7, D), (10, D), (Q, C), (2, D), (9, C), (8, C), (2, C), (6, H), (5, C), (7, S), (J, D), (4, C), (4, D), (K, S), (9, H), (10, C), (J, S), (5, H), (A, H), (6, D), (8, H), (3, C), (3, D), (3, H), (Q, H), (4, H), (A, D), (K, C), (5, S), (J, C), (K, H), (5, D), (10, H), (4, S), (J, H), (6, S), (2, H), (Q, D), (3, S), (9, D), (K, D), (6, C), (8, D)]