summaryrefslogtreecommitdiff
path: root/2411/CH7/EX7.4/Ex7_4.sce
diff options
context:
space:
mode:
Diffstat (limited to '2411/CH7/EX7.4/Ex7_4.sce')
-rwxr-xr-x2411/CH7/EX7.4/Ex7_4.sce24
1 files changed, 24 insertions, 0 deletions
diff --git a/2411/CH7/EX7.4/Ex7_4.sce b/2411/CH7/EX7.4/Ex7_4.sce
new file mode 100755
index 000000000..b7c8a446e
--- /dev/null
+++ b/2411/CH7/EX7.4/Ex7_4.sce
@@ -0,0 +1,24 @@
+// Scilab Code Ex7.4: Page-377 (2008)
+clc; clear;
+function p = find_cell_type(x)
+ if x == 1 then
+ p = 'simple cubic';
+ end
+ if x == 2 then
+ p = 'body centered';
+ end
+ if x == 4 then
+ p = 'face centered';
+ end
+endfunction
+M = 130; // Gram atomic weight of Cs, g/mole
+N = 6.023e+023; // Avogadro's number
+rho = 2; // Density of Cs, g/cc
+a = 6e-008; // Distance between two adjacent atoms in the Cs, cm
+m = M/N; // Mass of each Cs atom, g
+x = rho*a^3*N/M; // Number of Cs atoms in cubic unit cell
+c_type = find_cell_type(int(x)); // Call function to determine the type of cell
+printf("\nThe cubic unit cell of Cs is %s.", c_type);
+
+// Result
+// The cubic unit cell of Cs is body centered. \ No newline at end of file