Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
var('Gimel Hey Shin Nun') dreidel = [Gimel, Hey, Shin, Nun]
C = binomial P(n, r) = C(n, r)*factorial(r)

If you spin a dreidel twice:

1.  how many outcomes are possible?  What are they?

for a in dreidel: for b in dreidel: (a, b)
outcomes = [(a, b) for a in dreidel for b in dreidel]

2.  What is the probability of getting Nun both times?

outcomes.count((Nun, Nun))/4^2

p(Nun)*p(Nun)

1/4*1/4

3.  How many outcomes contain Nun?

count = 0 for outcome in outcomes: if Nun in outcome: print outcome count += 1 count

Nun first : 4 outcomes

Nun second: 4 outcomes

Nun both times: 1 outcome

4 + 4 - 1

4.  What is the probability of getting Nun either time?

p(Nun first spin) + p(Nun second spin) - p(Nun both spins)

1/4 + 1/4 - 1/16

5.  What is the probability of getting Nun and Gimel?

count = 0 for outcome in outcomes: if Gimel in outcome and Nun in outcome: print outcome count += 1 count; count/4^2

p(Nun)*p(Gimel) + p(Gimel)*p(Nun)

1/4*1/4 + 1/4*1/4
P(2, 2)/4^2

6.  What is the probability of getting Nun or Gimel?

count = 0 for outcome in outcomes: if Nun in outcome or Gimel in outcome: print outcome count += 1 count; count/16

p(Nun or Gimel) :  p(Nun) + p(Gimel) - p(Nun and Gimel)

7/16 + 7/16 - 1/8

If you spin the dreidel 3 times:

1.  How many outcomes are possible?

4^3
64

2.  What are they?

for a in dreidel: for b in dreidel: for c in dreidel: (a, b, c)
outcomes = [(a, b, c) for a in dreidel for b in dreidel for c in dreidel]

3.  In how many outcomes are all 3 spins the same?

count = 0 for outcome in outcomes: if len(set(outcome)) == 1: count += 1 print outcome count
(Gimel, Gimel, Gimel) (Hey, Hey, Hey) (Shin, Shin, Shin) (Nun, Nun, Nun) 4
C(4, 1)
4

4.  In how many outcomes are 2 of the spins the same?

count = 0 for outcome in outcomes: if len(set(outcome)) == 2: count += 1 print outcome count
C(4, 1)*C(3, 1)*factorial(3)/factorial(2)

5.  In how many outcomes are all 3 spins different?

count = 0 for outcome in outcomes: if len(set(outcome)) == 3: count += 1 print outcome count
(Gimel, Hey, Shin) (Gimel, Hey, Nun) (Gimel, Shin, Hey) (Gimel, Shin, Nun) (Gimel, Nun, Hey) (Gimel, Nun, Shin) (Hey, Gimel, Shin) (Hey, Gimel, Nun) (Hey, Shin, Gimel) (Hey, Shin, Nun) (Hey, Nun, Gimel) (Hey, Nun, Shin) (Shin, Gimel, Hey) (Shin, Gimel, Nun) (Shin, Hey, Gimel) (Shin, Hey, Nun) (Shin, Nun, Gimel) (Shin, Nun, Hey) (Nun, Gimel, Hey) (Nun, Gimel, Shin) (Nun, Hey, Gimel) (Nun, Hey, Shin) (Nun, Shin, Gimel) (Nun, Shin, Hey) 24
P(4, 3)
24

6.  What is the probability of getting 3 Nuns in a row?

(1/4)^3
1/64

7.  What is the probability of getting 2 Nuns and then a Gimel?

(1/4)^3

8.  What is the probability of getting 2 Nuns and a Gimel in any order?

count = 0 for outcome in outcomes: if outcome.count(Nun) == 2 and outcome.count(Gimel) == 1: count += 1 print outcome count/4^3
(Gimel, Nun, Nun) (Nun, Gimel, Nun) (Nun, Nun, Gimel) 3/64
C(1, 1)*C(1, 1)*factorial(3)/factorial(2)/4^3
3/64

9.  How many outcomes contain at least one Gimel?

count = 0 for outcome in outcomes: if outcome.count(Gimel) > 0: count += 1 print outcome count
(Gimel, Gimel, Gimel) (Gimel, Gimel, Hey) (Gimel, Gimel, Shin) (Gimel, Gimel, Nun) (Gimel, Hey, Gimel) (Gimel, Hey, Hey) (Gimel, Hey, Shin) (Gimel, Hey, Nun) (Gimel, Shin, Gimel) (Gimel, Shin, Hey) (Gimel, Shin, Shin) (Gimel, Shin, Nun) (Gimel, Nun, Gimel) (Gimel, Nun, Hey) (Gimel, Nun, Shin) (Gimel, Nun, Nun) (Hey, Gimel, Gimel) (Hey, Gimel, Hey) (Hey, Gimel, Shin) (Hey, Gimel, Nun) (Hey, Hey, Gimel) (Hey, Shin, Gimel) (Hey, Nun, Gimel) (Shin, Gimel, Gimel) (Shin, Gimel, Hey) (Shin, Gimel, Shin) (Shin, Gimel, Nun) (Shin, Hey, Gimel) (Shin, Shin, Gimel) (Shin, Nun, Gimel) (Nun, Gimel, Gimel) (Nun, Gimel, Hey) (Nun, Gimel, Shin) (Nun, Gimel, Nun) (Nun, Hey, Gimel) (Nun, Shin, Gimel) (Nun, Nun, Gimel) 37
4^3 - 3^3
37

10.  What is the probability of getting at least one Gimel?

1 - (3/4)^3
37/64
_.n()
0.578125000000000

If you spin the dreidel 4 times:

1.  How many outcomes are possible?

4^4
outcomes = [(a, b, c, d) for a in dreidel for b in dreidel for c in dreidel for d in dreidel]

2.  In how many outcomes are all 4 spins the same?

count = 0 total = 0 for (a, b, c, d) in outcomes: if a == b == c == d: count += 1 print (a, b, c, d) total += count count
C(4, 1)

3.  In how many outcomes are 3 of the spins the same?

count = 0 for outcome in outcomes: for spin in set(outcome): if outcome.count(spin) == 3: print outcome count += 1 total += count count
P(4, 2)*factorial(4)/factorial(3)

4.  In how many outcomes are 2 of the spins the same?

count = 0 for outcome in outcomes: if max([outcome.count(item) for item in set(outcome)]) == 2: count += 1 print outcome total += count count

5.  In how many outcomes are all the spins different?

count = 0 for outcome in outcomes: if Gimel in outcome and Hey in outcome and Nun in outcome and Shin in outcome: count += 1 print outcome total += count count
factorial(4)
P(4, 4)
total