summaryrefslogtreecommitdiff
path: root/2411/CH6/EX6.6/Ex6_6.sce
diff options
context:
space:
mode:
Diffstat (limited to '2411/CH6/EX6.6/Ex6_6.sce')
-rwxr-xr-x2411/CH6/EX6.6/Ex6_6.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/2411/CH6/EX6.6/Ex6_6.sce b/2411/CH6/EX6.6/Ex6_6.sce
new file mode 100755
index 000000000..d88fa35d0
--- /dev/null
+++ b/2411/CH6/EX6.6/Ex6_6.sce
@@ -0,0 +1,22 @@
+// Scilab Code Ex6.6: Page-348 (2008)
+clc; clear;
+MAX = 10;
+// Look for all the possible set of values for n1, n2 and n3
+printf("\nThe most probable distribution is for ");
+for i = 0:1:5
+ for j = 0:1:5
+ for k = 0:1:5
+ // Check for the condition and avoid repetition of set of values
+ if ((i + j + k) == 5) & ((j+2*k) == 3) then
+ W = factorial(i + j + k)/(factorial(i)*factorial(j)*factorial(k));
+ if W > MAX then
+ printf("\nn1 = %d, n2 = %d and n3 = %d", i, j, k);
+ end
+ end
+ end
+ end
+end
+
+// Result
+// The most probable distribution is for
+// n1 = 3, n2 = 1 and n3 = 1 \ No newline at end of file