diff options
author | hardythe1 | 2015-01-28 14:31:21 +0530 |
---|---|---|
committer | hardythe1 | 2015-01-28 14:31:21 +0530 |
commit | 53f72e6790ff23b43c8f6a0b69d6386940671429 (patch) | |
tree | 7745af6dbf2f5b2972b23f9f5a7a19c695a27321 /Applied_Physics_for_Engineers/Chapter_3.ipynb | |
parent | 7b78be04fe05bf240417e22f74b3fc22e7a77d19 (diff) | |
download | Python-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.tar.gz Python-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.tar.bz2 Python-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.zip |
added books
Diffstat (limited to 'Applied_Physics_for_Engineers/Chapter_3.ipynb')
-rwxr-xr-x | Applied_Physics_for_Engineers/Chapter_3.ipynb | 581 |
1 files changed, 581 insertions, 0 deletions
diff --git a/Applied_Physics_for_Engineers/Chapter_3.ipynb b/Applied_Physics_for_Engineers/Chapter_3.ipynb new file mode 100755 index 00000000..074f94b3 --- /dev/null +++ b/Applied_Physics_for_Engineers/Chapter_3.ipynb @@ -0,0 +1,581 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Statistical Mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.1, Page 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import *\n", + "\n", + "#Variable Declaration\n", + "m = 5.32e-26; # Mass of one oxygen molecule, kg\n", + "k_B = 1.38e-23; # Boltzmann constant, J/K\n", + "T = 200; # Temperature of the system, K\n", + "v = 100; # Speed of the oxygen molecules, m/s\n", + "dv = 1; # Increase in speed of the oxygen molecules, m/s\n", + "\n", + "#Calculations\n", + "P = 4*pi*(m/(2*pi*k_B*T))**(3./2)*exp((-m*v**2)/(2*k_B*T))*v**2*dv;\n", + "\n", + "#Result\n", + "print \"The probability that the speed of oxygen molecule is %4.2e\"%P\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability that the speed of oxygen molecule is 6.13e-04\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.2, Page 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "A = 32; # Gram atomic mass of oxygen, g/mol\n", + "N_A = 6.023e+026; # Avogadro's number, per kmol\n", + "m = A/N_A; #mass of the molecule, kg\n", + "k_B = 1.38e-23; # Boltzmann constant, J/K \n", + "T = 273; # Temperature of the gas, K\n", + "\n", + "#Calculations&Results\n", + "v_av = 1.59*sqrt(k_B*T/m); # Average speed of oxygen molecule, m/s\n", + "print \"The average speed of oxygen molecule is = %3d m/s\"%v_av\n", + "v_rms = 1.73*sqrt(k_B*T/m); # The mean square speed of oxygen molecule, m/s \n", + "print \"The root mean square speed of oxygen gas molecule is = %3d m/s\"%(ceil(v_rms))\n", + "v_mp = 1.41*sqrt(k_B*T/m); # The most probable speed of oxygen molecule, m/s \n", + "print \"The most probable speed of oxygen molecule is = %3d m/s\"%(ceil(v_mp)) #incorrect answer in the textbook\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average speed of oxygen molecule is = 423 m/s\n", + "The root mean square speed of oxygen gas molecule is = 461 m/s\n", + "The most probable speed of oxygen molecule is = 376 m/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.3, Page 133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "m_H = 2; # Gram molecular mass of hydrogen, g\n", + "m_O = 32.; # Gram molecular mass of oxygen, g\n", + "k_B = 1.38e-23; # Boltzmann constant, J/K \n", + "v_avO = 1.; # For simplicity average speed of oxygen gas molecule is assumed to be unity, m/s\n", + "v_avH = 2*v_avO; # The average speed of hydrrogen gas molecule, m/s\n", + "T_O = 300.; # Temperature of oxygen gas, K\n", + "\n", + "#Calculations\n", + "# As v_avO/v_av_H = sqrt(T_O/T_H)*sqrt(m_H/m_O), solving for T_H\n", + "T_H = (v_avH/v_avO*sqrt(m_H/m_O)*sqrt(T_O))**2; # Temperature at which the average speed of hydrogen gas molecules is the same as that of oxygen gas molecules, K\n", + "\n", + "#Result\n", + "print \"Temperature at which the average speed of hydrogen gas molecules is the same as that of oxygen gas molecules at 300 K = %2d\"%T_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature at which the average speed of hydrogen gas molecules is the same as that of oxygen gas molecules at 300 K = 75\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4, Page 133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "v_mp = 1; # Most probable speed of gas molecules, m/s\n", + "dv = 1.01*v_mp-0.99*v_mp; # Change in most probable speed, m/s\n", + "v = v_mp; # Speed of the gas molecules, m/s\n", + "\n", + "#Calculations\n", + "Frac = 4/sqrt(pi)*1/v_mp**3*exp(-v**2/v_mp**2)*v**2*dv; \n", + "\n", + "#Result\n", + "print \"The fraction of oxygen gas molecules within one percent of most probable speed = %5.3f\"%Frac\n", + "#rounding-off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fraction of oxygen gas molecules within one percent of most probable speed = 0.017\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.5, Page 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Variable Declaration\n", + "n = 5.; # Number of distinguishable particles which are to be distributed among cells\n", + "n1 = [5, 4, 3, 3, 2]; # Possible occupancy of particles in first cell\n", + "n2 = [0 ,1, 2, 1, 2]; # Possible occupancy of particles in second cell\n", + "n3 = [0 ,0, 0, 1, 1]; # Possible occupancy of particles in third cell\n", + "BIG_W = 0.;\n", + "\n", + "\n", + "print(\"_____________________________________\");\n", + "print(\"n1 n2 n3 5/(n1!n2!n3!)\");\n", + "print(\"_____________________________________\");\n", + "for i in range(5):\n", + " W = math.factorial(n)/(math.factorial(n1[i])*math.factorial(n2[i])*math.factorial(n3[i]));\n", + " if BIG_W < W:\n", + " BIG_W = W;\n", + " ms = [n1[i], n2[i] ,n3[i]];\n", + "\n", + " print \"%d %d %d %d\"%(n1[i], n2[i], n3[i], W);\n", + "\n", + "print \"_____________________________________\";\n", + "print \"The macrostates of most probable distribution with thermodynamic probability %d are:\"%(BIG_W);\n", + "print \"(%d, %d, %d), (%d, %d, %d) and (%d, %d, %d)\"%(ms[0], ms[1], ms[2], ms[1], ms[2], ms[0],ms[2], ms[0], ms[1]);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "_____________________________________\n", + "n1 n2 n3 5/(n1!n2!n3!)\n", + "_____________________________________\n", + "5 0 0 1\n", + "4 1 0 5\n", + "3 2 0 10\n", + "3 1 1 20\n", + "2 2 1 30\n", + "_____________________________________\n", + "The macrostates of most probable distribution with thermodynamic probability 30 are:\n", + "(2, 2, 1), (2, 1, 2) and (1, 2, 2)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.6, Page 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "g1 = 4; # Intrinsic probability of first cell\n", + "g2 = 2; # Intrinsic probability of second cell\n", + "k = 2; # Number of cells \n", + "n = 8; # Number of distinguishable particles\n", + "n1 = 8; # Number of cells in first compartment\n", + "n2 = n - n1; # Number of cells in second compartment\n", + "\n", + "#Calculations\n", + "W = factorial(n)*1/factorial(n1)*1/factorial(n2)*(g1)**n1*(g2)**n2;\n", + "\n", + "#Result\n", + "print \"The thermodynamic probability of the macrostate (8,0) = %5d\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thermodynamic probability of the macrostate (8,0) = 65536\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.7, Page 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Variable Declaration\n", + "def st(val):\n", + " str1 = \"\"\n", + " if val == 3 :\n", + " str1 = 'aaa';\n", + " elif val == 2 :\n", + " str1 = 'aa'; \n", + " elif val == 1 :\n", + " str1 = 'a';\n", + " elif val == 0:\n", + " str1 = '0'; \n", + " return str1\n", + "\n", + "g = 3; # Number of cells in first compartment\n", + "n = 3; # Number of bosons\n", + "p = 3;\n", + "r = 1; # Index for number of rows\n", + "print(\"All possible meaningful arrangements of three particles in three cells are:\")\n", + "print(\"__________________________\");\n", + "print(\"Cell 1 Cell 2 Cell 3\");\n", + "print(\"__________________________\");\n", + "\n", + "for i in range(0,g+1):\n", + " for j in range(0,n+1):\n", + " for k in range(0,p+1):\n", + " if (i+j+k == 3):\n", + " print \"%4s %4s %4s\"%(st(i), st(j), st(k)); \n", + " print \"__________________________\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "All possible meaningful arrangements of three particles in three cells are:\n", + "__________________________\n", + "Cell 1 Cell 2 Cell 3\n", + "__________________________\n", + " 0 0 aaa\n", + " 0 a aa\n", + " 0 aa a\n", + " 0 aaa 0\n", + "__________________________\n", + " a 0 aa\n", + " a a a\n", + " a aa 0\n", + "__________________________\n", + " aa 0 a\n", + " aa a 0\n", + "__________________________\n", + " aaa 0 0\n", + "__________________________\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.8, Page 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "g1 = 3; # Number of cells in first compartment\n", + "g2 = 4; # Number of cells in second compartment\n", + "k = 2; # Number of compartments\n", + "n1 = 5; # Number of bosons\n", + "n2 = 0; # Number of with no bosons\n", + "\n", + "#Calculations\n", + "W_50 = factorial(g1+n1-1)*factorial(g2+n2-1)/(factorial(n1)*factorial(g1-1)*factorial(n2)*factorial(g2-1));\n", + "\n", + "#Result\n", + "print \"The probability for the macrostate (5,0) is = %2d\"%W_50\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability for the macrostate (5,0) is = 21\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.11, Page 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "r = 1.86e-10; # Radius of Na, angstrom\n", + "m = 9.1e-31; # Mass of electron,in kg\n", + "h = 6.62e-34; # Planck's constant, J-s\n", + "N = 2; # Number of free electrons in a unit cell of Na\n", + "\n", + "#Calculations\n", + "a = 4*r/sqrt(3); # Volume of Na, m\n", + "V = a**3; # Volume of the unit cell of Na, meter cube\n", + "E = h**2/(2*m)*(3*N/(8*pi*V))**(2./3);\n", + "\n", + "#Result\n", + "print \"The fermi energy of the Na at absolute zero is = %4.2e J\"%E\n", + "#rounding-off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fermi energy of the Na at absolute zero is = 5.02e-19 J\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.12, Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "m = 9.1e-31; # mass of electron, kg\n", + "h = 6.62e-34; # Planck's constant, J-s\n", + "V = 108/10.5*1e-06; # Volume of 1 gm mole of silver, metre-cube\n", + "N = 6.023e+023; # Avogadro's number\n", + "\n", + "#Calculations\n", + "E_F = h**2/(2*m)*(3*N/(8*pi*V))**(2./3); # Fermi energy at absolute zero, J\n", + "\n", + "#Result\n", + "print \"The fermi energy of the silver at absolute zero = %4.2e J\"%E_F\n", + "#rounding-off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fermi energy of the silver at absolute zero = 8.80e-19 J\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.13, Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "pbe = 24.2e22 #electrons/cm^3\n", + "pcs = 0.91e22 #electrons/cm^3\n", + "efbe = 14.44 #ev\n", + "\n", + "#Calculations\n", + "Efcs = efbe*((pcs/pbe)**(2./3))\n", + "\n", + "#Result\n", + "print \"Fermi energy of free electrons in cesium = %.3f eV\"%Efcs\n", + "#rounding-off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fermi energy of free electrons in cesium = 1.621 eV\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.14, Page 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "e = 1.6e-019; # Energy equivalent of 1 eV, J/eV\n", + "m = 9.1e-31; # Mass of the elecron, kg \n", + "h = 6.63e-34; # Planck's constant, Js\n", + "EF = 4.72*e; # Fermi energy of free electrons in Li, J\n", + "\n", + "#Calculations\n", + "rho = 8*pi/3*(2*m*EF/h**2)**(3./2); # Electron density at absolute zero, electrons/metre-cube\n", + "\n", + "#Result\n", + "print \"The electron density in lithium at absolute zero = %4.2e electrons/metre-cube\"%rho\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electron density in lithium at absolute zero = 4.63e+28 electrons/metre-cube\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.15, Page 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "e = 1.6e-019; # Energy equivalent of 1 eV, J/eV\n", + "k_B = 1.38e-023; # Boltzmann constant, J/K\n", + "f_E = 0.01; # Probability that a state with energy 0.5 eV above the Fermi energy is occupied by an electron, eV \n", + "delta_E = 0.5; # Energy difference (E-Ef)of fermi energy, eV\n", + "\n", + "#Calculations\n", + "# Since f_E = 1/(exp((E-Ef)/(k_B*T))+1), solvinf for T \n", + "T = delta_E/(log((1-f_E)/f_E)*k_B/e); # Temperature at which the level above the fermi level is occupied by the electron, K\n", + "\n", + "#Result\n", + "print \"The temperature at which the level above the fermi level is occupied by the electron = %4d K\"%ceil(T)\n", + "#rounding-off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature at which the level above the fermi level is occupied by the electron = 1262 K\n" + ] + } + ], + "prompt_number": 49 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |