From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 2411/CH7/EX7.4/Ex7_4.sce | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 2411/CH7/EX7.4/Ex7_4.sce (limited to '2411/CH7/EX7.4/Ex7_4.sce') 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 -- cgit