summaryrefslogtreecommitdiff
path: root/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-03-17 23:30:24 +0600
committerTrupti Kini2016-03-17 23:30:24 +0600
commit782794e93b10ba69e45100483470fdf2a52f8c71 (patch)
treeae008a76e1a962576cc8535d28f5985c297047ad /Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb
parentc4c0c461b409e0a9a36038d256fac00ca6c5d0eb (diff)
downloadPython-Textbook-Companions-782794e93b10ba69e45100483470fdf2a52f8c71.tar.gz
Python-Textbook-Companions-782794e93b10ba69e45100483470fdf2a52f8c71.tar.bz2
Python-Textbook-Companions-782794e93b10ba69e45100483470fdf2a52f8c71.zip
Added(A)/Deleted(D) following books
A Basic_Engineering_Thermodynamics_by_Rayner_Joel/README.txt A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter1.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter10.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter11.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter12.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter14.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter3.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter4.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter5.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter6.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter8.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter9.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/1.png A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/2.png A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/3.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter2_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter3_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter4_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter6_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter7_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter8_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter9_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter2_1.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter3_1.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter4_1.png A Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/README.txt
Diffstat (limited to 'Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb')
-rw-r--r--Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb1256
1 files changed, 1256 insertions, 0 deletions
diff --git a/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb b/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb
new file mode 100644
index 00000000..6819c543
--- /dev/null
+++ b/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb
@@ -0,0 +1,1256 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# 2: Crystal Structure "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.1, Page number 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "volume density is 1249.04 kg/m**3\n",
+ "answer in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=28; #atomic weight of Si\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "a=5.3*10**-10; #lattice constant(m)\n",
+ "n=4;\n",
+ "\n",
+ "#Calculations\n",
+ "V=a**3; #volume(m**3)\n",
+ "m=M/(N*10**3); #mass(kg)\n",
+ "rho=n*m/V; #volume density(kg/m**3)\n",
+ "\n",
+ "#Result\n",
+ "print \"volume density is\",round(rho,2),\"kg/m**3\"\n",
+ "print \"answer in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.2, Page number 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of atoms per unit cell is 2\n",
+ "the lattice is BCC\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=55.85; #atomic weight\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "a=2.9*10**-8; #lattice constant(m)\n",
+ "rho=7.87; #volume density(gm/cc)\n",
+ "\n",
+ "#Calculations\n",
+ "n=rho*N*a**3/M; #number of atoms per unit cell\n",
+ "\n",
+ "#Result\n",
+ "print \"number of atoms per unit cell is\",int(n)\n",
+ "print \"the lattice is BCC\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.3, Page number 28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of unit cells is 5.019 *10**22\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=120; #atomic mass\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "n=2;\n",
+ "g=20; #mass(gm)\n",
+ "\n",
+ "#Calculations\n",
+ "u=n*M/N; \n",
+ "nu=g/u; #number of unit cells\n",
+ "\n",
+ "#Result\n",
+ "print \"number of unit cells is\",round(nu/10**22,3),\"*10**22\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.4, Page number 33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "miller indices are ( 2 1 0 )\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from fractions import gcd\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=1;\n",
+ "b=2;\n",
+ "c=float(\"inf\"); #intercepts\n",
+ "\n",
+ "#Calculation\n",
+ "lcm=a*b/gcd(a,b);\n",
+ "h=int(lcm/a);\n",
+ "k=int(lcm/b);\n",
+ "l=int(lcm/c); #miller indices\n",
+ "\n",
+ "#Result\n",
+ "print \"miller indices are (\",h,k,l,\")\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.5, Page number 33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "miller indices are ( 3 2 1 )\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from fractions import gcd\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=2;\n",
+ "b=3;\n",
+ "c=6; #intercepts\n",
+ "\n",
+ "#Calculation\n",
+ "lcm_ab=a*b/gcd(a,b); #lcm of a and b\n",
+ "lcm=lcm_ab*c/gcd(lcm_ab,c); #lcm of a,b and c\n",
+ "h=int(lcm/a);\n",
+ "k=int(lcm/b);\n",
+ "l=int(lcm/c); #miller indices\n",
+ "\n",
+ "#Result\n",
+ "print \"miller indices are (\",h,k,l,\")\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.6, Page number 33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "miller indices are ( 3 4 0 )\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from fractions import gcd\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=4;\n",
+ "b=3;\n",
+ "c=float(\"inf\"); #intercepts\n",
+ "\n",
+ "#Calculation\n",
+ "lcm=a*b/gcd(a,b);\n",
+ "h=int(lcm/a);\n",
+ "k=int(lcm/b);\n",
+ "l=int(lcm/c); #miller indices\n",
+ "\n",
+ "#Result\n",
+ "print \"miller indices are (\",h,k,l,\")\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.7, Page number 33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "ratio of intercepts is 6 -2 3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from fractions import gcd\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=1;\n",
+ "k=-3;\n",
+ "l=2; #miller indices\n",
+ "\n",
+ "#Calculation\n",
+ "lcm_hk=h*k/gcd(h,k); #lcm of h and k\n",
+ "lcm=lcm_hk*l/gcd(lcm_hk,l); #lcm of h,k and l\n",
+ "l1=int(lcm/h);\n",
+ "l2=int(lcm/k);\n",
+ "l3=int(lcm/l); #intercepts\n",
+ "\n",
+ "#Result\n",
+ "print \"ratio of intercepts is\",l1,l2,l3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.8, Page number 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "intercept on Y axis is 1.2 angstrom\n",
+ "intercept on Z axis is 4.0 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "a=1.2;\n",
+ "b=1.8;\n",
+ "c=2.0; #crystal primitives\n",
+ "x=2;\n",
+ "y=3;\n",
+ "z=1; #intercepts \n",
+ "h=1.2; #intercept on X axis\n",
+ "\n",
+ "#Calculations\n",
+ "h1=a/x;\n",
+ "k1=b/y;\n",
+ "l1=c/z;\n",
+ "k=h*h1/k1; #intercept on Y axis\n",
+ "l=h*l1/h1; #intercept on Z-axis\n",
+ "\n",
+ "#Result\n",
+ "print \"intercept on Y axis is\",k,\"angstrom\"\n",
+ "print \"intercept on Z axis is\",l,\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.9, Page number 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "interplanar spacing in 1st plane is 1.762 angstrom\n",
+ "interplanar spacing in 2nd plane is 1.246 angstrom\n",
+ "interplanar spacing in 3rd plane is 2.0347 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "r=1.246; #atomic radius(angstrom)\n",
+ "h1=2; #intercept on X axis\n",
+ "k1=0; #intercept on Y axis\n",
+ "l1=0; #intercept on Z-axis\n",
+ "h2=2; #intercept on X axis\n",
+ "k2=2; #intercept on Y axis\n",
+ "l2=0; #intercept on Z-axis\n",
+ "h3=1; #intercept on X axis\n",
+ "k3=1; #intercept on Y axis\n",
+ "l3=1; #intercept on Z-axis\n",
+ "\n",
+ "#Calculations\n",
+ "a=2*math.sqrt(2)*r; #lattice constant\n",
+ "d1=a/math.sqrt(h1**2+k1**2+l1**2); #interplanar spacing in 1st plane(angstrom)\n",
+ "d2=a/math.sqrt(h2**2+k2**2+l2**2); #interplanar spacing in 2nd plane(angstrom)\n",
+ "d3=a/math.sqrt(h3**2+k3**2+l3**2); #interplanar spacing in 3rd plane(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"interplanar spacing in 1st plane is\",round(d1,3),\"angstrom\"\n",
+ "print \"interplanar spacing in 2nd plane is\",d2,\"angstrom\"\n",
+ "print \"interplanar spacing in 3rd plane is\",round(d3,4),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.10, Page number 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "interplanar spacing in 1st plane is a/math.sqrt( 2 ) angstrom\n",
+ "interplanar spacing in 2nd plane is a/math.sqrt( 2 ) angstrom\n",
+ "interplanar spacing in 3rd plane is a/math.sqrt( 6 ) angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "h1=0; #intercept on X axis\n",
+ "k1=1; #intercept on Y axis\n",
+ "l1=1; #intercept on Z-axis\n",
+ "h2=1; #intercept on X axis\n",
+ "k2=0; #intercept on Y axis\n",
+ "l2=1; #intercept on Z-axis\n",
+ "h3=1; #intercept on X axis\n",
+ "k3=1; #intercept on Y axis\n",
+ "l3=2; #intercept on Z-axis\n",
+ "\n",
+ "#Calculations\n",
+ "d1=h1**2+k1**2+l1**2; #interplanar spacing in 1st plane(angstrom)\n",
+ "d2=h2**2+k2**2+l2**2; #interplanar spacing in 2nd plane(angstrom)\n",
+ "d3=h3**2+k3**2+l3**2; #interplanar spacing in 3rd plane(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"interplanar spacing in 1st plane is a/math.sqrt(\",d1,\") angstrom\"\n",
+ "print \"interplanar spacing in 2nd plane is a/math.sqrt(\",d2,\") angstrom\"\n",
+ "print \"interplanar spacing in 3rd plane is a/math.sqrt(\",d3,\") angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.11, Page number 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "interplanar spacing is 1.12 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "a=4.2; #lattice constant(angstrom)\n",
+ "h=3; #intercept on X axis\n",
+ "k=2; #intercept on Y axis\n",
+ "l=1; #intercept on Z-axis\n",
+ "\n",
+ "#Calculations\n",
+ "d=a/math.sqrt(h**2+k**2+l**2); #interplanar spacing(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"interplanar spacing is\",round(d,2),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.12, Page number 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "miller indices in 1st case are ( 1 1 1 )\n",
+ "miller indices in 2nd case are ( 3 2 1 )\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from fractions import gcd\n",
+ "\n",
+ "#Variable declaration\n",
+ "a1=1;\n",
+ "b1=1;\n",
+ "c1=1; #intercepts in 1st case\n",
+ "a2=2;\n",
+ "b2=3;\n",
+ "c2=6; #intercepts in 2nd case\n",
+ "\n",
+ "#Calculation\n",
+ "lcm_a1b1=a1*b1/gcd(a1,b1); #lcm of a1 and b1\n",
+ "lcm1=lcm_ab*c1/gcd(lcm_a1b1,c1); #lcm of a1,b1 and c1\n",
+ "h1=int(lcm1/a1);\n",
+ "k1=int(lcm1/b1);\n",
+ "l1=int(lcm1/c1); #miller indices in 1st case\n",
+ "lcm_a2b2=a2*b2/gcd(a2,b2); #lcm of a2 and b2\n",
+ "lcm2=lcm_a2b2*c2/gcd(lcm_a2b2,c2); #lcm of a2,b2 and c2\n",
+ "h2=int(lcm2/a2);\n",
+ "k2=int(lcm2/b2);\n",
+ "l2=int(lcm2/c2); #miller indices in 2nd case\n",
+ "\n",
+ "#Result\n",
+ "print \"miller indices in 1st case are (\",h1,k1,l1,\")\"\n",
+ "print \"miller indices in 2nd case are (\",h2,k2,l2,\")\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.14, Page number 47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "density of crystal is 8.929 gm/cm**3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=63.5; #atomic weight(gm/mol)\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "r=1.278*10**-8; #atomic radius(cm)\n",
+ "n=4;\n",
+ "\n",
+ "#Calculations\n",
+ "m=M/N; #mass(g)\n",
+ "a=4*r/math.sqrt(2); #lattice constant(cm)\n",
+ "V=a**3; #volume(m**3)\n",
+ "rho=n*m/V; #density of crystal(g/cm**3)\n",
+ "\n",
+ "#Result\n",
+ "print \"density of crystal is\",round(rho,3),\"gm/cm**3\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.15, Page number 47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "minimum radius is 0.155 r\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "r=1; #assume\n",
+ "\n",
+ "#Calculations\n",
+ "a=4*r/math.sqrt(3); #lattice constant\n",
+ "R=(a-(2*r))/2; #minimum radius \n",
+ "\n",
+ "#Result\"\n",
+ "print \"minimum radius is\",round(R,3),\"r\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.16, Page number 48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "maximum radius is 0.414 r\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "r=1; #assume\n",
+ "\n",
+ "#Calculations\n",
+ "a=4*r/math.sqrt(2); #lattice constant\n",
+ "R=(a/2)-r; #maximum radius \n",
+ "\n",
+ "#Result\"\n",
+ "print \"maximum radius is\",round(R,3),\"r\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.17, Page number 48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "percent volume change is 0.5 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "r1=1.258*10**-10; #atomic radius(m)\n",
+ "r2=1.292*10**-10; #atomic radius(m)\n",
+ "n1=2;\n",
+ "n2=4;\n",
+ "\n",
+ "#Calculations\n",
+ "a1=4*r1/math.sqrt(3); #lattice constant(m)\n",
+ "V1=a1**3/n1; #volume(m**3)\n",
+ "a2=2*math.sqrt(2)*r2; #lattice constant(m)\n",
+ "V2=a2**3/n2; #volume(m**3)\n",
+ "V=(V1-V2)*100/V1; #percent volume change\n",
+ "\n",
+ "#Result\"\n",
+ "print \"percent volume change is\",round(V,1),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.18, Page number 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of atoms is 1.77 *10**29\n",
+ "density of diamond is 3535.7 kg/m**3\n",
+ "answer in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "a=0.356*10**-9; #cube edge(m)\n",
+ "M=12.01; #atomic weight\n",
+ "N=6.023*10**26; #avagadro number\n",
+ "\n",
+ "#Calculations\n",
+ "n=8/a**3; #number of atoms\n",
+ "m=M/N; #mass(kg)\n",
+ "rho=m*n; #density of diamond(kg/m**3)\n",
+ "\n",
+ "#Result\"\n",
+ "print \"number of atoms is\",round(n/10**29,2),\"*10**29\"\n",
+ "print \"density of diamond is\",round(rho,1),\"kg/m**3\"\n",
+ "print \"answer in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.19, Page number 54 Theoritical"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.20, Page number 55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "volume of unit cell is 9.356 *10**-29 m**3\n",
+ "density of zinc is 6960 kg/m**3\n",
+ "answer in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "a=0.27*10**-9; #lattice constant(m)\n",
+ "c=0.494*10**-9; #height of cell(m)\n",
+ "M=65.37; #atomic weight\n",
+ "N=6.023*10**26; #avagadro number\n",
+ "n=6; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "V=3*math.sqrt(3)*a**2*c/2; #volume of unit cell(m**3)\n",
+ "rho=n*M/(N*V); #density of zinc(kg/m**3)\n",
+ "\n",
+ "#Result\"\n",
+ "print \"volume of unit cell is\",round(V*10**29,3),\"*10**-29 m**3\"\n",
+ "print \"density of zinc is\",int(rho),\"kg/m**3\"\n",
+ "print \"answer in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.21, Page number 57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "density of Si is 2.33 gm/cm**3\n",
+ "density of GaAs is 5.324 gm/cm**3\n",
+ "answer in the book varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "a1=5.43*10**-8; #lattice constant(cm)\n",
+ "M1=28.1; #atomic weight\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "n1=8; #number of atoms\n",
+ "a2=5.65*10**-8; #lattice constant(cm)\n",
+ "M2=144.6; #atomic weight\n",
+ "n2=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "rho1=n1*M1/(N*a1**3); #density of Si(gm/cm**3)\n",
+ "rho2=n2*M2/(N*a2**3); #density of GaAs(gm/cm**3)\n",
+ "\n",
+ "#Result\"\n",
+ "print \"density of Si is\",round(rho1,2),\"gm/cm**3\"\n",
+ "print \"density of GaAs is\",round(rho2,3),\"gm/cm**3\"\n",
+ "print \"answer in the book varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.22, Page number 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "lattice constant is 4 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "rho=6250; #density(kg/m**3)\n",
+ "M=60.2; #molecular weight\n",
+ "N=6.02*10**26; #avagadro number\n",
+ "n=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"lattice constant is\",int(a*10**10),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.23, Page number 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "density of copper is 8938 kg/m**3\n",
+ "answer in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "r=1.278*10**-8; #atomic radius(cm)\n",
+ "M=63.54; #molecular weight\n",
+ "N=6.02*10**23; #avagadro number\n",
+ "n=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=4*r/math.sqrt(2); #lattice constant(cm)\n",
+ "rho=n*M*10**3/(N*a**3); #density(kg/m**3)\n",
+ "\n",
+ "#Result\n",
+ "print \"density of copper is\",int(rho),\"kg/m**3\"\n",
+ "print \"answer in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.24, Page number 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "lattice constant is 2.867 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=7870; #density(kg/m**3)\n",
+ "M=55.8; #molecular weight\n",
+ "N=6.02*10**26; #avagadro number\n",
+ "n=2; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"lattice constant is\",round(a*10**10,3),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.25, Page number 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "radius of atom is 1.414 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=6.23; #density(gm/cc)\n",
+ "M=60; #molecular weight\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "n=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(cm)\n",
+ "r=a*math.sqrt(2)*10**8/4; #radius of atom(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"radius of atom is\",round(r,3),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.26, Page number 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "distance between ions is 3.8 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=2.48; #density(gm/cc)\n",
+ "M=58; #molecular weight\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "n=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(cm)\n",
+ "r=a*math.sqrt(2)*10**8/4; #radius of atom(angstrom)\n",
+ "d=2*r; #distance between ions(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"distance between ions is\",round(d,1),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.27, Page number 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "distance between ions is 2.55 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=8.96; #density(gm/cc)\n",
+ "M=63.5; #molecular weight\n",
+ "N=6.02*10**23; #avagadro number\n",
+ "n=4; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(cm)\n",
+ "d=a/math.sqrt(2)*10**8; #distance between ions(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"distance between ions is\",round(d,2),\"angstrom\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.28, Page number 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "packing factor is 0.68\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=5.96; #density(gm/cc)\n",
+ "M=50; #molecular weight\n",
+ "N=6.023*10**23; #avagadro number\n",
+ "n=2; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n*M/(rho*N))**(1/3); #lattice constant(cm)\n",
+ "r=a*math.sqrt(3)/4; #radius of atom(angstrom)\n",
+ "pf=n*(4/3)*math.pi*r**3/a**3; #packing factor\n",
+ "\n",
+ "#Result\n",
+ "print \"packing factor is\",round(pf,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.29, Page number 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "packing fraction is 68 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=1; #assume\n",
+ "n=2; #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "r=a*math.sqrt(3)/4; #radius of atom\n",
+ "V=4*math.pi*r**3/3; #volume\n",
+ "f=n*V*100/a**3; #packing fraction\n",
+ "\n",
+ "#Result\n",
+ "print \"packing fraction is\",int(f),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 2.30, Page number 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "lattice constant is 3.22 angstrom\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Vd=3*10**22; #density(gm/cc)\n",
+ "n=8*(1/8); #number of atoms\n",
+ "\n",
+ "#Calculations\n",
+ "a=(n/Vd)**(1/3); #lattice constant(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"lattice constant is\",round(a*10**8,2),\"angstrom\""
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.11"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}