{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#4: Electron Theory of Solids"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.1, Page number 4.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.00286 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=10**4*1.6*10**-19;      #kinetic energy(J)\n",
    "m=1.675*10**-27;     #mass(kg)\n",
    "h=6.625*10**-34;     #planck's constant\n",
    "\n",
    "#Calculation\n",
    "v=math.sqrt(2*E/m);     #velocity(m/s)\n",
    "lamda=h/(m*v);          #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**10,5),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.2, Page number 4.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy difference is 1.81 *10**-37 J\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;     #mass(kg)\n",
    "nx=ny=nz=1;\n",
    "n=6;\n",
    "a=1;     #edge(m)\n",
    "h=6.63*10**-34;     #planck's constant\n",
    "\n",
    "#Calculation\n",
    "E1=h**2*(nx**2+ny**2+nz**2)/(8*m*a**2);\n",
    "E2=h**2*n/(8*m*a**2);\n",
    "E=E2-E1;               #energy difference(J)\n",
    "\n",
    "#Result\n",
    "print \"energy difference is\",round(E*10**37,2),\"*10**-37 J\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.3, Page number 4.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature is 1261 K\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "y=1/100;    #percentage of probability\n",
    "x=0.5*1.6*10**-19;     #energy(J)\n",
    "k=1.38*10**-23;       #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "xbykT=math.log((1/y)-1);\n",
    "T=x/(k*xbykT);       #temperature(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature is\",int(T),\"K\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.4, Page number 4.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi energy is 3.15 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "d=970;    #density(kg/m**3)\n",
    "Na=6.02*10**26;    #avagadro number\n",
    "w=23;    #atomic weight\n",
    "m=9.1*10**-31;     #mass(kg)\n",
    "h=6.62*10**-34;     #planck's constant\n",
    "\n",
    "#Calculation\n",
    "N=d*Na/w;    #number of atoms/m**3\n",
    "x=h**2/(8*m);\n",
    "y=(3*N/math.pi)**(2/3);\n",
    "EF=x*y;     #fermi energy(J)\n",
    "\n",
    "#Result\n",
    "print \"fermi energy is\",round(EF/(1.6*10**-19),2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.5, Page number 4.59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "work function is 4.14 eV\n",
      "maximum kinetic energy is 0.758 eV\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "h=6.625*10**-34;     #planck's constant\n",
    "c=3*10**8;     #velocity of light(m/s)\n",
    "lamda0=3000*10**-10;   #wavelength(m)\n",
    "e=1.6*10**-19;    #charge(coulomb)\n",
    "lamda=2536*10**-10;      #wavelength(m)\n",
    "\n",
    "#Calculation\n",
    "hf0=c*h/(lamda0*e);    #work function(eV)\n",
    "E=c*h*((1/lamda)-(1/lamda0))/e;            #maximum kinetic energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"work function is\",round(hf0,2),\"eV\"\n",
    "print \"maximum kinetic energy is\",round(E,3),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.6, Page number 4.59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lowest energy of neutron is 2.05 MeV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=1;\n",
    "hbar=1.054*10**-34;    \n",
    "m=1.67*10**-27;    #mass of neutron(kg)\n",
    "a=10**-14;      #size(m)\n",
    "\n",
    "#Calculation\n",
    "E=n**2*math.pi**2*hbar**2/(2*m*a**2);     #lowest energy of neutron(J)\n",
    "\n",
    "#Result\n",
    "print \"lowest energy of neutron is\",round(E/(1.6*10**-13),2),\"MeV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.7, Page number 4.59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "probability of particle is 0.0158\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "from scipy.integrate import quad\n",
    "\n",
    "#Variable declaration\n",
    "k=1;\n",
    "\n",
    "#Calculation\n",
    "def zintg(x):\n",
    "\treturn math.exp(-2*k*x)\n",
    "\n",
    "a=quad(zintg,2/k,3/k)[0];        #probability of particle\n",
    "\n",
    "#Result\n",
    "print \"probability of particle is\",round(2*a,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.8, Page number 4.60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage appeared is 1.83 mV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "i=10**-2;    #current(ampere)\n",
    "A=0.01*0.001;     #area(m**2)\n",
    "RH=3.66*10**-4;   #hall coefficient(m**3/coulomb)\n",
    "Bz=0.5;     #magnetic induction(weber/m**2)\n",
    "\n",
    "#Calculation\n",
    "Jx=i/A;     \n",
    "Ey=RH*Bz*Jx;    \n",
    "Vy=Ey*i;      #voltage appeared(V)\n",
    "\n",
    "#Result\n",
    "print \"voltage appeared is\",Vy*10**3,\"mV\""
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}