diff options
Diffstat (limited to '291/CH3/EX3.5f')
-rwxr-xr-x | 291/CH3/EX3.5f/eg3_5f.sce | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/291/CH3/EX3.5f/eg3_5f.sce b/291/CH3/EX3.5f/eg3_5f.sce new file mode 100755 index 000000000..d7f727210 --- /dev/null +++ b/291/CH3/EX3.5f/eg3_5f.sce @@ -0,0 +1,30 @@ +black_p = 6;
+white_p = 6;
+pair = 2;
+total_p = black_p + white_p;
+
+
+
+
+total_pairs = 1;
+while(total_p >0)
+ total_pairs = total_pairs*factorial(total_p)/(factorial(pair) * factorial(total_p - pair) );
+ total_p = total_p -2;
+ //disp(total_pairs)
+end
+//disp(total_pairs)
+total_pairs= total_pairs/factorial(6);
+black_pairs = 1;
+while(black_p >0)
+ black_pairs = black_pairs*factorial(black_p)/((factorial(pair) * factorial(black_p - pair) ));
+ black_p = black_p -2;
+ //disp(black_pairs)
+end
+black_pairs= black_pairs/factorial(3);
+//disp(black_pairs)
+
+
+white_pairs = black_pairs;
+allowed_pairs = black_pairs * white_pairs;
+probb = allowed_pairs/ total_pairs;
+disp(probb, " Probability that a random pairing will not result in any of the white and black players rooming together is ")
\ No newline at end of file |