summaryrefslogtreecommitdiff
path: root/Modern_Physics/Chapter10_1.ipynb
diff options
context:
space:
mode:
authorkinitrupti2015-10-15 19:41:09 +0530
committerkinitrupti2015-10-15 19:41:09 +0530
commitaeca32b472f4eca0e0b606e47bd88e2c542806c6 (patch)
tree0777f7803c05bab0e249412cb90d5042ec7d320d /Modern_Physics/Chapter10_1.ipynb
parent4a735f833653551e3321fbe9a8e47faa879d282f (diff)
downloadPython-Textbook-Companions-aeca32b472f4eca0e0b606e47bd88e2c542806c6.tar.gz
Python-Textbook-Companions-aeca32b472f4eca0e0b606e47bd88e2c542806c6.tar.bz2
Python-Textbook-Companions-aeca32b472f4eca0e0b606e47bd88e2c542806c6.zip
errors solved
Diffstat (limited to 'Modern_Physics/Chapter10_1.ipynb')
-rw-r--r--[-rwxr-xr-x]Modern_Physics/Chapter10_1.ipynb116
1 files changed, 91 insertions, 25 deletions
diff --git a/Modern_Physics/Chapter10_1.ipynb b/Modern_Physics/Chapter10_1.ipynb
index c1e9ff91..77c37cd7 100755..100644
--- a/Modern_Physics/Chapter10_1.ipynb
+++ b/Modern_Physics/Chapter10_1.ipynb
@@ -1,6 +1,6 @@
{
"metadata": {
- "name": "MP-10"
+ "name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +11,42 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Statistical Physics"
+ "source": [
+ "Statistical Physics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 10.2 Page 307"
+ "source": [
+ "Example 10.2 Page 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#initiation of variable\nfrom math import sqrt\n#The solution is purely theoretical and involves a lot of approximations.\nprint\"The value of shift in frequency was found out to be delf=7.14*fo*10^-7*sqrt(T) for a star composing of hydrogen atoms at a temperature T.\";\nT=6000.0; #temperature for sun\ndelf=7.14*10**-7*sqrt(T);#change in frequency\n\n#result\nprint\"The value of frequency shift for sun(at 6000 deg. temperature) comprsing of hydrogen atoms is\",delf,\" times the frequency of the light.\"",
+ "input": [
+ "#initiation of variable\n",
+ "from math import sqrt\n",
+ "#The solution is purely theoretical and involves a lot of approximations.\n",
+ "print\"The value of shift in frequency was found out to be delf=7.14*fo*10^-7*sqrt(T) for a star composing of hydrogen atoms at a temperature T.\";\n",
+ "T=6000.0; #temperature for sun\n",
+ "delf=7.14*10**-7*sqrt(T);#change in frequency\n",
+ "\n",
+ "#result\n",
+ "print\"The value of frequency shift for sun(at 6000 deg. temperature) comprsing of hydrogen atoms is\",delf,\" times the frequency of the light.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The value of shift in frequency was found out to be delf=7.14*fo*10^-7*sqrt(T) for a star composing of hydrogen atoms at a temperature T.\nThe value of frequency shift for sun(at 6000 deg. temperature) comprsing of hydrogen atoms is 5.53062021838e-05 times the frequency of the light.\n"
+ "text": [
+ "The value of shift in frequency was found out to be delf=7.14*fo*10^-7*sqrt(T) for a star composing of hydrogen atoms at a temperature T.\n",
+ "The value of frequency shift for sun(at 6000 deg. temperature) comprsing of hydrogen atoms is 5.53062021838e-05 times the frequency of the light.\n"
+ ]
}
],
"prompt_number": 2
@@ -38,50 +55,83 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 10.3 Page 309"
+ "source": [
+ "Example 10.3 Page 309"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#initiation of variable\nfrom math import sqrt,pi, exp, log\nkT=0.0252;E=10.2 # at room temperature, kT=0.0252 standard value and given value of E\n\n#calculation\nn2=2;n1=1; g2=2*(n2**2);g1=2*(n1**2); #values for ground and excited states\nt=(g2/g1)*exp(-E/kT); #fraction of atoms\n\n#result\nprint\"The number of hydrogen atoms required is %.1e\" %(1.0/t),\" which weighs %.1e\" %((1/t)*(1.67*10**-27)),\"Kg\"\n\n#partb\nt=0.1/0.9;k=8.65*10**-5 #fracion of atoms in case-2 is given\nT=-E/(log(t/(g2/g1))*k); #temperature\n\n#result\nprint\"The value of temperature at which 1/10 atoms are in excited state in K is %.1e\" %round(T,3);",
+ "input": [
+ "#initiation of variable\n",
+ "from math import sqrt,pi, exp, log\n",
+ "kT=0.0252;E=10.2 # at room temperature, kT=0.0252 standard value and given value of E\n",
+ "\n",
+ "#calculation\n",
+ "n2=2;n1=1; g2=2*(n2**2);g1=2*(n1**2); #values for ground and excited states\n",
+ "t=(g2/g1)*exp(-E/kT); #fraction of atoms\n",
+ "\n",
+ "#result\n",
+ "print\"The number of hydrogen atoms required is %.1e\" %(1.0/t),\" which weighs %.1e\" %((1/t)*(1.67*10**-27)),\"Kg\"\n",
+ "\n",
+ "#partb\n",
+ "t=0.1/0.9;k=8.65*10**-5 #fracion of atoms in case-2 is given\n",
+ "T=-E/(log(t/(g2/g1))*k); #temperature\n",
+ "\n",
+ "#result\n",
+ "print\"The value of temperature at which 1/10 atoms are in excited state in K is %.1e\" %round(T,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
- "ename": "TypeError",
- "evalue": "can't multiply sequence by non-int of type 'float'",
- "output_type": "pyerr",
- "traceback": [
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
- "\u001b[1;32m<ipython-input-2-0c4f78dafdc9>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;31m#result\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;34m\"The number of hydrogen atoms required is %.1e\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0mt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\" which weighs %.1e\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0mt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1.67\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m**\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m27\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"Kg\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;31m#partb\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
- "\u001b[1;31mTypeError\u001b[0m: can't multiply sequence by non-int of type 'float'"
- ]
- },
- {
"output_type": "stream",
"stream": "stdout",
- "text": "The number of hydrogen atoms required is 1.5e+175"
+ "text": [
+ "The number of hydrogen atoms required is 1.5e+175 which weighs 2.5e+148 Kg\n",
+ "The value of temperature at which 1/10 atoms are in excited state in K is 3.3e+04\n"
+ ]
}
],
- "prompt_number": 2
+ "prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 10.4 Page 311"
+ "source": [
+ "Example 10.4 Page 311"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#initiation of variable\nfrom math import log\n#theoritical part a\nprint'The energy of interaction with magnetic field is given by uB and the degeneracy of the states are +-1/2 which are identical.\\nThe ratio is therefore pE2/pE1 which gives e^(-2*u*B/k*T)';\n#partb\nuB=5.79*10**-4; #for a typical atom\nt=1.1;k=8.65*10**-5; #ratio and constant k\n\n#calculation\nT=2*uB/(log(t)*k); #temperature\n\n#result\nprint\"The value of temperature ar which the given ratio exists in K is\",round(T,3);",
+ "input": [
+ "#initiation of variable\n",
+ "from math import log\n",
+ "#theoritical part a\n",
+ "print'The energy of interaction with magnetic field is given by uB and the degeneracy of the states are +-1/2 which are identical.\\nThe ratio is therefore pE2/pE1 which gives e^(-2*u*B/k*T)';\n",
+ "#partb\n",
+ "uB=5.79*10**-4; #for a typical atom\n",
+ "t=1.1;k=8.65*10**-5; #ratio and constant k\n",
+ "\n",
+ "#calculation\n",
+ "T=2*uB/(log(t)*k); #temperature\n",
+ "\n",
+ "#result\n",
+ "print\"The value of temperature ar which the given ratio exists in K is\",round(T,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The energy of interaction with magnetic field is given by uB and the degeneracy of the states are +-1/2 which are identical.\nThe ratio is therefore pE2/pE1 which gives e^(-2*u*B/k*T)\nThe value of temperature ar which the given ratio exists in K is 140.46\n"
+ "text": [
+ "The energy of interaction with magnetic field is given by uB and the degeneracy of the states are +-1/2 which are identical.\n",
+ "The ratio is therefore pE2/pE1 which gives e^(-2*u*B/k*T)\n",
+ "The value of temperature ar which the given ratio exists in K is 140.46\n"
+ ]
}
],
"prompt_number": 8
@@ -90,19 +140,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 10.5 Page 313"
+ "source": [
+ "Example 10.5 Page 313"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#initiation of variable\nfrom math import pi\np=0.971; A=6.023*10**23; m=23.0; # various given values and constants\n\n#calculation\nc= (p*A/m)*10**6; # atoms per unit volume\nhc=1240.0; mc2=0.511*10**6; # hc=1240 eV.nm\nE= ((hc**2)/(2*mc2))*(((3/(8*pi))*c)**(2.0/3)); #value of fermi energy\n\n#result\nprint\"The fermi energy for sodium is\",round(E*10**-18,4),\"eV\";#multiply by 10^-18 to convert metres^2 term to nm^2",
+ "input": [
+ "#initiation of variable\n",
+ "from math import pi\n",
+ "p=0.971; A=6.023*10**23; m=23.0; # various given values and constants\n",
+ "\n",
+ "#calculation\n",
+ "c= (p*A/m)*10**6; # atoms per unit volume\n",
+ "hc=1240.0; mc2=0.511*10**6; # hc=1240 eV.nm\n",
+ "E= ((hc**2)/(2*mc2))*(((3/(8*pi))*c)**(2.0/3)); #value of fermi energy\n",
+ "\n",
+ "#result\n",
+ "print\"The fermi energy for sodium is\",round(E*10**-18,4),\"eV\";#multiply by 10^-18 to convert metres^2 term to nm^2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fermi energy for sodium is 3.1539 eV\n"
+ "text": [
+ "The fermi energy for sodium is 3.1539 eV\n"
+ ]
}
],
"prompt_number": 12