Welcome to DrScheme, version 4.2.1 [3m]. Language: Swindle; memory limit: 128 megabytes. ======================================= CMPU-145, Spring 2013 Asmt. 6 Solutions! ======================================= ------------------------ 1: Rolling 5 dice and getting exactly two pair! ------------------------ *num-ways-of-getting-2-pair* ====> 1800 *num-ways-of-rolling-5-dice* ====> 7776 *prob-getting-2-pair-in-5-dice* ====> 0.23148148148148148 (roll-5-dice) ====> (1 3 1 2 3) (roll-5-dice) ====> (2 1 3 5 4) (roll-5-dice) ====> (5 6 6 2 6) (has-2-pair? '(1 2 3 2 1)) ====> #t (has-2-pair? '(2 2 3 3 4)) ====> #t (has-2-pair? '(5 2 3 4 3)) ====> #f (gen-and-test 100000 roll-5-dice has-2-pair?) ====> 0.23048 ------------------------ 2: Powerball Expected Winnings ------------------------ *num-pb-tix* ====> 175223510 *pb-payoffs* ==> 200000000 1000000 10000 100 100 7 7 4 4 *pb-num-outcomes* ==> 1 34 270 9180 14310 486540 248040 1581255 3162510 *pb-probabilities* ==> 5.706996738051874e-09 1.9403788909376374e-07 1.540889119274006e-06 5.2390230055316206e-05 8.166712332152232e-05 0.002776682192931759 0.001415563470906387 0.009024217127028217 0.018048434254056434 *pb-odds* ==> 175223510.0 5153633.0 648976.0 19088.0 12245.0 360.0 706.0 111.0 55.0 *pb-exp-winnings* ====> 1.5018881884057682 *pb-exp-winnings-no-grand-prize* ====> 0.3604888407953933 *pb-no-winnings* ====> 0.9685993049676953 ------------------------ 3: Estimating Expected Winnings in Powerball ------------------------ (estimate-pb-exp-winnings 1000) ====> 0.193 (estimate-pb-exp-winnings 1000) ====> 0.249 (estimate-pb-exp-winnings 1000) ====> 0.181 (estimate-pb-exp-winnings 1000) ====> 0.169 (estimate-pb-exp-winnings 100000) ====> 0.18921 (estimate-pb-exp-winnings 100000) ====> 0.18206 (estimate-pb-exp-winnings 1000000) ====> 0.212657 >