summaryrefslogtreecommitdiff
path: root/291/CH3/EX3.5f
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /291/CH3/EX3.5f
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '291/CH3/EX3.5f')
-rwxr-xr-x291/CH3/EX3.5f/eg3_5f.sce30
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