% % Written by: % -- % John L. Weatherwax 2007-07-01 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- format rat; % compute the probabilities of rolling two die that sum to "i": % (note "i" starts at *two*) num = [ 1:6 5:-1:1 ]; den = 36; p_i = num/den; % compute the probabilities that we "keep" going (don't roll another initial sum % of "i" and don't roll a sum of seven: % p_kg = 1 - p_i - 1/6; % compute the probabilities that we win when the initial roll is "i" % p_w = p_i .* ( 1 ./ (1-p_kg) ); p_w(1:2) = 0; p_w(6) = 1; p_w(10) = 1; p_w(11) = 0; % the total probability that we win is then given by: % fprintf('the total probability that we win at craps is then given by...\n'); dot( p_i, p_w )