summaryrefslogtreecommitdiff
path: root/Modern_Physics_for_Scientists_and_Engineers/ch9.ipynb
blob: 3a0e39ede2339d03f3c7ef63488ed1de25502dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
{
 "metadata": {
  "name": "",
  "signature": "sha256:99c63cd5d461a992de3be34298ef557332677985056a4e6a31ae5dace5faabc1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Statistical Physics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4, Page 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "N_A = 6.023e+023;    # Avogadro's number\n",
      "T = 293;    # Room temperature, K\n",
      "e = 1.6e-019;    # Energy equivalent of 1 eV, J\n",
      "\n",
      "#Calculations\n",
      "# For a single molecule\n",
      "K_bar_single = 3./2*k*T/e;    # Mean translational kinetic energy of a single gas molecule, J\n",
      "# For a 1 mole of molecules\n",
      "K_bar_mole = K_bar_single*N_A*e;    # Mean translational kinetic energy of 1 mole of gas molecules, J\n",
      "\n",
      "#Results\n",
      "print \"The mean translational kinetic energy of the single idela gas molecule = %5.3f eV\"%K_bar_single\n",
      "print \"The mean translational kinetic energy of the one mole of ideal gas molecules = %4d J\"%(math.ceil(K_bar_mole))\n",
      "\n",
      "#Answer differs due to rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mean translational kinetic energy of the single idela gas molecule = 0.038 eV\n",
        "The mean translational kinetic energy of the one mole of ideal gas molecules = 3654 J\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3, Page 310"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "u = 1.67e-027;    # Mass equivalent of one atomic mass unit, kg\n",
      "T = 293;    # Room temperature, K\n",
      "m_H = 1.008*u;    # Gram atomic mass of hydrogen, kg\n",
      "\n",
      "#Calculations&Results\n",
      "m = 2*m_H;    # Gram molecular mass of hydrogen molecule, kg\n",
      "v_bar = 4/math.sqrt(2*math.pi)*math.sqrt(k*T/m);    # Mean molecular speed in the light gas hydrogen, m/s\n",
      "print \"The mean molecular speed in the light gas hydrogen = %4d m/s\"%(math.ceil(v_bar))\n",
      "m = 222*u;    # Gram atomic mass of Radon, kg\n",
      "v_bar = 4/math.sqrt(2*math.pi)*math.sqrt(k*T/m);    # Mean molecular speed in the heavy radon gas, m/s\n",
      "print \"The mean molecular speed in the heavy radon gas = %3d m/s\"%(math.ceil(v_bar))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mean molecular speed in the light gas hydrogen = 1749 m/s\n",
        "The mean molecular speed in the heavy radon gas = 167 m/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4, Page 310"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import scipy\n",
      "from scipy.integrate import quad\n",
      "\n",
      "#Variable declaration\n",
      "m = 1;    # For simplicity assume mass of gas molecule to be unity, kg\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "T = 293;    # Room temperature, K\n",
      "\n",
      "#Calculations\n",
      "bita = k*T;    # Energy associated with three degrees of freedom, J\n",
      "v_mps = math.sqrt(2/(bita*m));    # For simplcity assume most probable speed to be unity, m/s\n",
      "C = (bita*m/(2*math.pi))**(3./2);    # Constant in the distribution function\n",
      "p = lambda v: 4*math.pi*C*math.exp(-1./2*bita*m*v**2)*v**2\n",
      "P,err = scipy.integrate.quad(p,0.99*v_mps, 1.01*v_mps)\n",
      "\n",
      "#Result\n",
      "print \"The fraction of molecules in an ideal gas in equilibrium which have speeds within 1 percent above and below the most probable speed = %5.3f\"%P"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fraction of molecules in an ideal gas in equilibrium which have speeds within 1 percent above and below the most probable speed = 0.017\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6, Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "T = [293, 5000, 1e+006];    # Room temperature, temperature at the surface of the star and temperature at the star interior respectively, K\n",
      "e = 1.6e-019;    # Energy equivalent of 1 eV, J\n",
      "g_E1 = 2;    # Possible configuration of the electrons in ground state of H-atom\n",
      "g_E2 = 8;    # Possible configuration of the electrons in the first excited state of H-atom\n",
      "E1 = -13.6;    # Energy of the ground state, eV\n",
      "E2 = -3.4;    # Energy of the first excited state state, eV\n",
      "\n",
      "#Calculations&Results\n",
      "n_ratio = numpy.zeros(3);\n",
      "for i in range(0,3):\n",
      "    n_ratio[i] = g_E2/g_E1*math.exp(1./(k*T[i])*(E1 - E2)*e);\n",
      "    print \"For T = %4.2e K, n_E2/n_E1 = %4.2e\"%(T[i], n_ratio[i])\n",
      "\n",
      "#Incorrect answer given in textbook for the first part"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For T = 2.93e+02 K, n_E2/n_E1 = 2.05e-175\n",
        "For T = 5.00e+03 K, n_E2/n_E1 = 2.14e-10\n",
        "For T = 1.00e+06 K, n_E2/n_E1 = 3.55e+00\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7, Page 320"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "e = 1.6e-019;    # Energy equivalent of 1 eV, J\n",
      "n = 8.47e+028;    # Number density of conduction electrons in copper, per metre cube\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "h = 6.626e-034;    # Planck's constant, Js\n",
      "m = 9.11e-031;    # Mass of an electron, kg\n",
      "\n",
      "#Calculations\n",
      "E_F = h**2/(8*m*e)*(3*n/math.pi)**(2./3);    # Fermi energy for copper, eV\n",
      "T_F = E_F*e/k;    # Fermi temperature for copper, K\n",
      "\n",
      "#Results\n",
      "print \"The Fermi energy for copper = %4.2f eV\"%E_F\n",
      "print \"The Fermi temperature for copper = %4.2e K\"%T_F"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi energy for copper = 7.04 eV\n",
        "The Fermi temperature for copper = 8.16e+04 K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.8, Page 323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R = 1;    # For simplicity assume the molar gas constant to be unity, J/mol/K\n",
      "T = 293;    # Room temperature, K\n",
      "T_F = 8.16e+004;    # The Fermi temperature for copper\n",
      "\n",
      "#Calculations&Results\n",
      "C_V = math.pi**2*T/(2*T_F)*R;    # Electronic contribution to the molar heat capacity for copper, J/mol/K\n",
      "print \"The electronic contribution to the molar heat capacity for copper = %6.4fR\"%C_V\n",
      "T_F = 6.38e+004;    # The Fermi temperature for silver\n",
      "C_V = math.pi**2*T/(2*T_F)*R;    # Electronic contribution to the molar heat capacity for silver, J/mol/K\n",
      "print \"The electronic contribution to the molar heat capacity for silver = %6.4fR\"%C_V"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The electronic contribution to the molar heat capacity for copper = 0.0177R\n",
        "The electronic contribution to the molar heat capacity for silver = 0.0227R\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}