diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb')
-rwxr-xr-x | Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb | 332 |
1 files changed, 332 insertions, 0 deletions
diff --git a/Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb b/Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb new file mode 100755 index 00000000..365987ff --- /dev/null +++ b/Engineering_Physics_by_Shyam_Singh_and_Rajeev_Singh/Chapter15.ipynb @@ -0,0 +1,332 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:42ca728e6260f85c33ceec306bfa76eadd9931a7ca67b2244aa9a2e681dff896"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "15: Statistical mechanics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.1, Page number 341"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "import fractions\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 10; #number of identical coins\n",
+ "r1 = 10; #number of heads in 1st case\n",
+ "r2 = 5; #number of heads in 2nd case\n",
+ "r3 = 3; #number of heads in 3rd case\n",
+ "\n",
+ "#Calculation\n",
+ "P10_0 = math.factorial(n)/(math.factorial(r1)*math.factorial(n-r1)*(2**n)); #probability of getting all heads\n",
+ "P10_0 = fractions.Fraction(P10_0); #probability in fraction\n",
+ "P5_5 = math.factorial(n)/(math.factorial(r2)*math.factorial(n-r2)*(2**n)); #probability of getting 5 heads and 5 tails\n",
+ "P5_5 = fractions.Fraction(P5_5); #probability in fraction\n",
+ "P3_7 = math.factorial(n)/(math.factorial(r3)*math.factorial(n-r3)*(2**n)); #probability of getting 3 heads and 7 tails\n",
+ "P3_7 = fractions.Fraction(P3_7); #probability in fraction\n",
+ "Pmax = math.factorial(n)/(((math.factorial(n/2))**2)*(2**n)) #most probable combination\n",
+ "Pmax = fractions.Fraction(Pmax); #probability in fraction\n",
+ "Pmin = 1/(2**n); #least probable combination\n",
+ "Pmin = fractions.Fraction(Pmin); #probability in fraction\n",
+ "\n",
+ "#Result\n",
+ "print \"probability of getting all heads is\",P10_0\n",
+ "print \"probability of getting 5 heads and 5 tails is\",P5_5\n",
+ "print \"probability of getting 3 heads and 7 tails is\",P3_7\n",
+ "print \"most probable combination is\",Pmax\n",
+ "print \"least probable combination is\",Pmin"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "probability of getting all heads is 1/1024\n",
+ "probability of getting 5 heads and 5 tails is 63/256\n",
+ "probability of getting 3 heads and 7 tails is 15/128\n",
+ "most probable combination is 63/256\n",
+ "least probable combination is 1/1024\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.2, Page number 342"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "import fractions\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 3; #number of particles\n",
+ "N = 2; #number of compartments\n",
+ "ms = 4; #number of macrostates\n",
+ "n1_03 = 0; #value of n1 for (0,3)\n",
+ "n2_03 = 3; #value of n2 for (0,3)\n",
+ "n1_12 = 1; #value of n1 for (1,2)\n",
+ "n2_12 = 2; #value of n2 for (1,2)\n",
+ "n1_21 = 2; #value of n1 for (2,1)\n",
+ "n2_21 = 1; #value of n2 for (2,1)\n",
+ "n1_30 = 3; #value of n1 for (3,0)\n",
+ "n2_30 = 0; #value of n2 for (3,0)\n",
+ "\n",
+ "#Calculation\n",
+ "#the macrostates are (n1,n2) = [(0,3),(1,2),(2,1),(3,0)]\n",
+ "ms_03 = math.factorial(n)/(math.factorial(n1_03)*math.factorial(n2_03)); #number of microstates in the macrostate (0,3)\n",
+ "mis_03 = \"(0,xyz)\"; #microstates in the macrostate (0,3)\n",
+ "ms_12 = math.factorial(n)/(math.factorial(n1_12)*math.factorial(n2_12)); #number of microstates in the macrostate (1,2)\n",
+ "mis_12 = \"[(x,yz),(y,zx),(z,xy)]\"; #microstates in the macrostate (1,2)\n",
+ "ms_21 = math.factorial(n)/(math.factorial(n1_21)*math.factorial(n2_21)); #number of microstates in the macrostate (2,1)\n",
+ "mis_21 = \"[(xy,z),(yz,x),(zx,y)]\"; #microstates in the macrostate (2,1)\n",
+ "ms_30 = math.factorial(n)/(math.factorial(n1_30)*math.factorial(n2_30)); #number of microstates in the macrostate (3,0)\n",
+ "mis_30 = \"(xyz,0)\"; #microstates in the macrostate (3,0)\n",
+ "tms = N**n; #total number of microstates\n",
+ "mis = \"[(0,xxx),(x,xx),(xx,x),(xxx,0)]\"; #the microstates when particles are indistinguishable\n",
+ "\n",
+ "#Result\n",
+ "print \"number of microstates in the macrostate (0,3) is\",ms_03,\"that is\",mis_03\n",
+ "print \"number of microstates in the macrostate (1,2) is\",ms_12,\"that is\",mis_12\n",
+ "print \"number of microstates in the macrostate (2,1) is\",ms_21,\"that is\",mis_21\n",
+ "print \"number of microstates in the macrostate (3,0) is\",ms_30,\"that is\",mis_30\n",
+ "print \"total number of microstates is\",tms\n",
+ "print \"the microstates when particles are indistinguishable are\",mis"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "number of microstates in the macrostate (0,3) is 1.0 that is (0,xyz)\n",
+ "number of microstates in the macrostate (1,2) is 3.0 that is [(x,yz),(y,zx),(z,xy)]\n",
+ "number of microstates in the macrostate (2,1) is 3.0 that is [(xy,z),(yz,x),(zx,y)]\n",
+ "number of microstates in the macrostate (3,0) is 1.0 that is (xyz,0)\n",
+ "total number of microstates is 8\n",
+ "the microstates when particles are indistinguishable are [(0,xxx),(x,xx),(xx,x),(xxx,0)]\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.3, Page number 343"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 4; #1st group of particles\n",
+ "n2 = 2; #2nd group of particles \n",
+ "n3 = 8; #3rd group of particles\n",
+ "n4 = 6; #4th group of particles \n",
+ "n5 = 5; #5th group of particles\n",
+ "v1 = 1; #speed of 1st group of particles\n",
+ "v2 = 2; #speed of 2nd group of particles\n",
+ "v3 = 3; #speed of 3rd group of particles\n",
+ "v4 = 4; #speed of 4th group of particles \n",
+ "v5 = 5; #speed of 5th group of particles\n",
+ "\n",
+ "#Calculation\n",
+ "vbar = ((n1*v1)+(n2*v2)+(n3*v3)+(n4*v4)+(n5*v5))/(n1+n2+n3+n4+n5); #average speed(m/sec)\n",
+ "vsquarebar = ((v1*(n1**2))+(v2*(n2**2))+(v3*(n3**2))+(v4*(n4**2))+(v5*(n5**2)))/(n1+n2+n3+n4+n5); #mean square speed\n",
+ "rms = math.sqrt(vsquarebar); #root mean square speed(m/sec)\n",
+ "rms = math.ceil(rms*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"average speed is\",vbar,\"m/sec\"\n",
+ "print \"root mean square speed is\",rms,\"m/sec\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "average speed is 3.24 m/sec\n",
+ "root mean square speed is 4.405 m/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.4, Page number 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "t = 27; #temperature(C)\n",
+ "M = 14; #mass of nitrogen(gm)\n",
+ "kb = 1.38*10**-23; #boltzmann constant\n",
+ "a = 6.02*10**23; #avagadro number \n",
+ "\n",
+ "#Calculation\n",
+ "T = t+273; #temperature(K) \n",
+ "M = M*10**-3; #mass of nitrogen(kg)\n",
+ "vmp = math.sqrt(2*kb*T*a/M); #most probable speed of nitrogen(m/sec)\n",
+ "vmp = math.ceil(vmp*10)/10; #rounding off to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"most probable speed of nitrogen is\",vmp,\"m/sec\"\n",
+ "print \"answer given in the book is wrong\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "most probable speed of nitrogen is 596.7 m/sec\n",
+ "answer given in the book is wrong\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.5, Page number 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "t = 37; #normal temperature of human body(C)\n",
+ "b = 2.898*10**-3; #constant of proportionality(mK)\n",
+ "\n",
+ "#Calculation\n",
+ "T = t+273; #normal temperature of human body(K)\n",
+ "lamda_m = b/T; #wavelength for maximum energy radiation(m)\n",
+ "lamda_m = lamda_m*10**10; #wavelength for maximum energy radiation(angstrom)\n",
+ "\n",
+ "#Result\n",
+ "print \"wavelength for maximum energy radiation is\",int(lamda_m),\"angstrom\"\n",
+ "print \"answer given in the book is wrong\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength for maximum energy radiation is 93483 angstrom\n",
+ "answer given in the book is wrong\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 15.6, Page number 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "kb = 1.38*10**-23; #boltzmann constant\n",
+ "thetaE = 230; #einstein's temperature(K)\n",
+ "h = 6.63*10**-34; #planck's constant(m**2 kg/s)\n",
+ "\n",
+ "#Calculation\n",
+ "newE = kb*thetaE/h; #einstein's frequency(per sec)\n",
+ "\n",
+ "#Result\n",
+ "print \"einstein's frequency is\",round(newE/1e+12,2),\"*10**12 per sec\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "einstein's frequency is 4.79 *10**12 per sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |