summaryrefslogtreecommitdiff
path: root/2411/CH6/EX6.1
diff options
context:
space:
mode:
Diffstat (limited to '2411/CH6/EX6.1')
-rwxr-xr-x2411/CH6/EX6.1/Ex6_1.sce17
1 files changed, 17 insertions, 0 deletions
diff --git a/2411/CH6/EX6.1/Ex6_1.sce b/2411/CH6/EX6.1/Ex6_1.sce
new file mode 100755
index 000000000..9c1dc0b2e
--- /dev/null
+++ b/2411/CH6/EX6.1/Ex6_1.sce
@@ -0,0 +1,17 @@
+// Scilab Code Ex6.1: Page-345 (2008)
+clc; clear;
+n = 14; // Total number of particles
+C = 2; // Total number of compartments
+N_micro = C^n; // Total number of microstates
+n1 = [10 7 14]; // Set of number of particles in first compartment
+n2 = [4 7 0]; // Set of number of particles in second compartment
+for i = 1:1:3
+ W = factorial(n1(i) + n2(i))/(factorial(n1(i))*factorial(n2(i)));
+ P = W/N_micro;
+ printf("\nThe probability of microstate (%d, %d) = %8.6f", n1(i), n2(i), P);
+end
+
+// Result
+// The probability of microstate (10, 4) = 0.061096
+// The probability of microstate (7, 7) = 0.209473
+// The probability of microstate (14, 0) = 0.000061 \ No newline at end of file