{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# chapter1: Quantum Mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1.1;page:1.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex-1.1 : pg no:1.5\n",
      "The energy of the particle from de Broglie wavelength in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.019)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de broglie wavelenth\n",
    "#intiation of all variables \n",
    "#given that\n",
    "lamda = 2.1e-10  \n",
    "m = 1.67e-027     \n",
    "h = 6.626e-034  \n",
    "e = 1.6e-019   \n",
    "# From de Broglie relation, lambda = h/math.sqrt(2*m*E)\n",
    "E = h**2/(2*m*lamda**2*e)\n",
    "print(\"Ex-1.1 : pg no:1.5\")\n",
    "print(\"The energy of the particle from de Broglie wavelength in eV:\"),round(E,3)\n",
    "#The energy of the particle from de Broglie wavelength = 1.863e-002 e"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1.2;page:1.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.2: Page-1.5\n",
      "The de Broglie wavelength of the particle in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 9.063964727801313e-17)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 1.67e-027      # Mass of the particle, kg\n",
    "h = 6.626e-034     # Planck's constant, Js\n",
    "e = 1.6e-019   # Energy equivalent of 1 eV, J/eV\n",
    "E = 1e+011*e     # Energy of the particle, J\n",
    "lamda=h/math.sqrt(2*m*E)     # de Broglie wavelength of the particle\n",
    "print(\"Ex1.2: Page-1.5\")\n",
    "print(\"The de Broglie wavelength of the particle in m:\"),lamda\n",
    "# Result \n",
    "# The de Broglie wavelength of the particle = 9.06e-017 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.3;page:1.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.3: Page-1.5\n",
      "The de Broglie wavelength of the electron in angstrom\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.09)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength of the electron\n",
    "#intiation of all variables \n",
    "#Given that\n",
    "import math\n",
    "V = 20e+03;     # Accelerating voltage of electron, V\n",
    "lamda = 12.25/math.sqrt(V);     # de Broglie wavelength of the accelerated electron, m\n",
    "print(\"Ex1.3: Page-1.5\")\n",
    "print(\"The de Broglie wavelength of the electron in angstrom\"),round (lamda,2)\n",
    "# Result \n",
    "# The de Broglie wavelength of the electron = 0.0866 angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.4;page:1.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.4:  Page-1.6\n",
      "The energy of the electron from de Broglie wavelength in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 5.5757694136484825e-14)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength\n",
    "#intiation of all variables \n",
    "#Given that\n",
    "lamda = 5.2e-03;  # de Broglie wavelength of the electron, m\n",
    "m = 9.1e-031;      # Mass of the electron, kg\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "# From de Broglie relation, lambda = h/sqrt(2*m*E), solving for E\n",
    "E = h**2/(2*m*lamda**2*e);     # Energy of the electron, eV\n",
    "print(\"Ex1.4:  Page-1.6\")\n",
    "print(\"The energy of the electron from de Broglie wavelength in eV:\"), E\n",
    "# Result \n",
    "# The energy of the electron from de Broglie wavelength = 5.576e-014 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.5;page:1.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.5: Page-1.6\n",
      "The velocity of the neutron in m/s:\n",
      "The de Broglie wavelength of the neutron in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 2.8662773171280257e-13)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of velocity and de brogle wavelength of the neutron\n",
    "#intiation of all variables \n",
    "#Given that\n",
    "import math\t\n",
    "m = 1.67e-027;      # Mass of the neutron, kg\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "E = 1e+04*e;    # Energy of the neutron, J\n",
    "# As E = 1/2*m*v**2, solving for v\n",
    "v = math.sqrt(2*E/m);    # Velocity of the neutron, m/s\n",
    "lamda = h/(m*v);  # de Broglie wavelength of the neutron, m\n",
    "print(\"Ex1.5: Page-1.6\")\n",
    "print(\"The velocity of the neutron in m/s:\"),round (v,2)\n",
    "print(\"The de Broglie wavelength of the neutron in m:\"), lamda\n",
    "# Result \n",
    "# The velocity of the neutron = 1.38e+006 m/s\n",
    "# The de Broglie wavelength of the neutron = 2.87e-013 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.6;page:1.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.6: Page-1.6\n",
      "The de Broglie wavelength of the thermal neutrons in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.45)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength of the thermal  neutrons\n",
    "#intiation of all variables \n",
    "#Given that\n",
    "import math\t\t\n",
    "m = 1.67e-027;      # Mass of the neutron, kg\n",
    "k = 1.38e-023;      # Boltzmann constant, J/mol/K\n",
    "T = 27+273;         # Room temperature, K\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "v = math.sqrt(3*k*T/m);      # Velocity of the neutron, m/s\n",
    "lamda = h/(m*v);  # de Broglie wavelength of the neutron, m\n",
    "print(\"Ex1.6: Page-1.6\")\n",
    "print(\"The de Broglie wavelength of the thermal neutrons in angstrom:\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# The de Broglie wavelength of the thermal neutrons = 1.45 angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.7;page:1.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.7: Page-1.6\n",
      "The angle of deviation for first order diffraction maxim in degrees:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.044)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of Angle of deviation\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 9.1e-031;      # Mass of the electron, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "E = 20e+03*e;     # Energy of the electron, J\n",
    "# As 1/2*m*v**2 = E, solving for v\n",
    "v = math.sqrt(2*E/m);        # Velocity of the electron, m/s\n",
    "lamda = h/(m*v);  # de Broglie wavelength of the electron, m\n",
    "n = 1;  # First order diffraction\n",
    "d = 9.8e-011;       # Atomic spacing for thin gold foil, m\n",
    "# Using Bragg's equation, 2*d*sin(theta) = n*lamda and solving for theta\n",
    "theta = math.sin(n*lamda/(2*d));      # Angle of deviation for first order diffraction maxima, degree\n",
    "print(\"Ex1.7: Page-1.6\")\n",
    "print(\"The angle of deviation for first order diffraction maxim in degrees:\"),round (theta,3)\n",
    "# Result \n",
    "# The angle of deviation for first order diffraction maxima = 2.54 degrees "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.8;page:1.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.8:  Page-1.7\n",
      "The de Broglie wavelength of the electron in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 5.49)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\t\t\t\t\t\n",
    "m = 9.1e-031;      # Mass of the electron, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "E = 5*e;     # Energy of the electron, J\n",
    "# As 1/2*m*v**2 = E, solving for v\n",
    "v = math.sqrt(2*E/m);        # Velocity of the electron, m/s\n",
    "lamda = h/(m*v);  # de Broglie wavelength of the electron, m\n",
    "print(\"Ex1.8:  Page-1.7\")\n",
    "print(\"The de Broglie wavelength of the electron in angstrom:\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# The de Broglie wavelength of the electron = 5.5 angstrom"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.9;page:1.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.9: Page-1.7\n",
      "The de Broglie wavelength of the neutron in angstrom\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.29)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength of the neutron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 1.67e-027;      # Mass of the neutron, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "E = 1*e;     # Energy of the electron, J\n",
    "lamda = h/math.sqrt(2*m*E);  # de Broglie wavelength of the neutron, m\n",
    "print(\"Ex1.9: Page-1.7\")\n",
    "print(\"The de Broglie wavelength of the neutron in angstrom\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# The de Broglie wavelength of the neutron = 0.29 angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.10;page:1.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.10 Page-1.8\n",
      "The de Broglie wavelength associated with moving proton in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 5.95)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength\n",
    "#intiation of all variables \n",
    "#given that\n",
    "m = 1.67e-027;      # Mass of the proton, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "v = 1./20.*c;        # Velocity of the proton, m/s\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "lamda = h/m*v;  # de Broglie wavelength of the neutron,\n",
    "print(\"Ex1.10 Page-1.8\")\n",
    "print(\"The de Broglie wavelength associated with moving proton in m:\"),round (lamda,2)\n",
    "# Result \n",
    "# The de Broglie wavelength associated with moving proton = 2.645e-14 m"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.11;page:1.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.11: Page-1.8\n",
      "The wavelength of matter wave associated with moving proton in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.9838323353293413e-15)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of wavelength of matter wave\n",
    "#intiation of all variables \n",
    "#given that\n",
    "m = 1.67e-027;      # Mass of the proton, kg\n",
    "v = 2e+08;        # Velocity of the proton, m/s\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "lamda = h/(m*v);  # de Broglie wavelength of the neutron, m\n",
    "print(\"Ex1.11: Page-1.8\")\n",
    "print(\"The wavelength of matter wave associated with moving proton in m:\"),lamda\n",
    "# Result \n",
    "# The wavelength of matter wave associated with moving proton = 1.984e-15 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.12;page:1.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.12: Page-1.17\n",
      "The de Broglie wavelength of the electron accelearted through a given potential in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.736483832029858e-10)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de brogle wavelength of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 9.1e-031;      # Mass of the electron, kg\n",
    "q = 1.6e-019;       # Charge on an electron, C\n",
    "V = 50;     # Accelearting potential, V\n",
    "E = q*V;    # Energy gained by the electron, J\n",
    "h = 6.626e-034;     # Planck's constant, Js\n",
    "lamda = h/math.sqrt(2*m*E);  # de Broglie wavelength of the electron, m\n",
    "print(\"Ex1.12: Page-1.17\")\n",
    "print(\"The de Broglie wavelength of the electron accelearted through a given potential in m:\"), lamda\n",
    "# Result \n",
    "# The de Broglie wavelength of the electron accelearted through a given potential = 1.736e-10 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.13;page:1.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.13: Page-1.17\n",
      "The interplanar spacing of the crystal in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.855)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of interplanar spacing of the crystal\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "theta = 45;     # Diffraction angle, degrees\n",
    "h = 6.626e-034;     # Planck's constant\n",
    "m = 1.67e-027;      # Mass of a neutron, kg\n",
    "n = 1;      # Order of diffraction\n",
    "k = 1.38e-023;  # Boltzmann constant, J/mol/K\n",
    "T = 27+273;     # Absolute room temperature, K\n",
    "E = 3/2*k*T;    # Energy of the neutron, J\n",
    "lamda = h/math.sqrt(2*m*E); # de-Broglie wavelength of neutrons, m\n",
    "# From Bragg's law, 2*d*sin(theta) = n*lamda, solving for d\n",
    "d = n*lamda/(2*math.sin(theta));\n",
    "print(\"Ex1.13: Page-1.17\")\n",
    "print(\"The interplanar spacing of the crystal in angstrom:\"), round(d/1e-010,3)\n",
    "# Result \n",
    "# The interplanar spacing of the crystal = 1.03 angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.14;page:1.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.14: Page-1.18\n",
      "The interplanar spacing of the crystal in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 2.508685000852822e-11)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of interplanar spacing of the crystal\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "theta = 70;     # Glancing angle at which reflection occurs, degrees\n",
    "h = 6.626e-034;     # Planck's constant\n",
    "m = 9.1e-031;      # Mass of a electron, kg\n",
    "e = 1.6e-019;       # Electronic charge, C\n",
    "V = 1000;   # Accelerating potential, V\n",
    "n = 1;      # Order of diffraction\n",
    "E = e*V;    # Energy of the electron, J\n",
    "lamda = h/math.sqrt(2*m*E); # de-Broglie wavelength of electron, m\n",
    "# From Bragg's law, 2*d*sin(theta) = n*lamda, solving for d\n",
    "d = n*lamda/(2*math.sin(theta));   # Interplanar spacing, m\n",
    "print(\"Ex1.14: Page-1.18\")\n",
    "print(\"The interplanar spacing of the crystal in m:\"), d\n",
    "# Result \n",
    "# The interplanar spacing of the crystal = 2.0660e-11 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.15;page:1.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.15: Page-1.18\n",
      "The de-Broglie wavelength of electron accelerated at V volts in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 12.23)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de-Broglie wavelength of electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;     # Planck's constant\n",
    "m = 9.1e-031;      # Mass of a electron, kg\n",
    "e = 1.6e-019;       # Electronic charge, C\n",
    "V = 1;   # For simplicity the accelerating potential is assumed to be unity, V\n",
    "E = e*V;    # Energy of the electron, J\n",
    "lamda = h/math.sqrt(2*m*E); # de-Broglie wavelength of electron, m\n",
    "print(\"Ex1.15: Page-1.18\")\n",
    "print(\"The de-Broglie wavelength of electron accelerated at V volts in angstrom:\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# de-Broglie wavelength of electron accelerated at V volts = 12.23/sqrt(V) angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.16;page:1.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.16: Page-1.18\n",
      "de-Broglie wavelength of electron accelerated at volts in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.223061372490817e-10)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de-Broglie wavelength of electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;     # Planck's constant\n",
    "m = 9.1e-031;      # Mass of a electron, kg\n",
    "e = 1.6e-019;       # Electronic charge, C\n",
    "V = 100;   # Accelerating potential for electron, V\n",
    "E = e*V;    # Energy of the electron, J\n",
    "lamda = h/math.sqrt(2*m*E); # de-Broglie wavelength of electron, m\n",
    "print(\"Ex1.16: Page-1.18\")\n",
    "print(\"de-Broglie wavelength of electron accelerated at volts in m:\") ,lamda\n",
    "# Result \n",
    "# de-Broglie wavelength of electron accelerated at 100 volts = 1.2231e-10 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.17;page:1.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.17:  Page-1.19\n",
      "The wavelength associated with mass moving with velocity m/s in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 5.999999999999999e-34)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of wavelength\n",
    "#intiation of all variables \n",
    "#given that\n",
    "m = 10e-03;     # Mass of the body, kg\n",
    "v = 110;    # Velocity of the mass, m/s\n",
    "h = 6.6e-034;     # Planck's constant\n",
    "lamda = h/(m*v); # de-Broglie wavelength of electron, m\n",
    "print(\"Ex1.17:  Page-1.19\")\n",
    "print(\"The wavelength associated with mass moving with velocity m/s in m:\"),lamda\n",
    "# Result \n",
    "# The wavelength associated with mass moving with velocity 110 m/s = 6e-34 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.18;page:1.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.18:  Page-1.19\n",
      "The wavelength associated with moving electron in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.37)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of the wavelength\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 9.1e-031;     # Mass of the electron, kg\n",
    "Ek = 1.27e-017;     # Kinetic energy of electron, J\n",
    "h = 6.6e-034;     # Planck's constant\n",
    "lamda = h/math.sqrt(2*m*Ek); # de-Broglie wavelength of electron, m\n",
    "print(\"Ex1.18:  Page-1.19\")\n",
    "print(\"The wavelength associated with moving electron in angstrom:\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# The wavelength associated with moving electron = 1.37 angstrom "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.19;page:1.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.19: Page-1.19\n",
      "The kinetic energy of electron having wavelength in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 9.1e-12, 18063.99131601402)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of kinetic energy of electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "m = 9.1e-031;     # Mass of the electron, kg\n",
    "h = 6.6e-034;     # Planck's constant\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "lamda = 9.1e-012; # de-Broglie wavelength of electron, m\n",
    "# We have lamda = h/(m*v), solving for v\n",
    "v = h/(m*lamda);   # Velocity of the electron, m/s\n",
    "K = 1/2*m*v**2;     # Kinetic energy of electron, J\n",
    "print(\"Ex1.19: Page-1.19\")\n",
    "print(\"The kinetic energy of electron having wavelength in eV:\"), lamda, K/e\n",
    "# Result \n",
    "# The kinetic energy of electron having wavelength 9.1e-12 m = 1.81e+04 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.20;page:1.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.20 : Page-1.19\n",
      "The speed of proton for an equivalent wavelength of that of electron:\n",
      "Ratio of kinetic energies of electron and proton, therefore Ke > Kp:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1835.16)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of interplanar spacing of the crystal\n",
    "#intiation of all variables \n",
    "#given that\n",
    "m_e = 9.1e-031;     # Mass of the electron, kg\n",
    "m_p = 1.67e-027;    # Mass of the proton, kg\n",
    "v_e = 1;    # For simplicity assume velocity of electron to be unity, m/s\n",
    "# From de-Broglie relation, \n",
    "# lamda_p = lamda_e = h(m*v_p), solving for v_p\n",
    "v_p = m_e*v_e/m_p;  # Velocity of the proton, m/s\n",
    "# As lamda_e = h/sqrt(2*m_e*K_e) and lamda_p = h/sqrt(2*m_p*K_p), solving for K_e/K_p\n",
    "K_ratio = m_p/m_e;      # Ratio of kinetic energies of electron and proton\n",
    "print(\"Ex1.20 : Page-1.19\")\n",
    "print(\"The speed of proton for an equivalent wavelength of that of electron:\"),round(v_p,4)\n",
    "print(\"Ratio of kinetic energies of electron and proton, therefore Ke > Kp:\"), round(K_ratio,2)\n",
    "# Result \n",
    "# The speed of proton for an equivalent wavelength of that of electron = 5.4e-04 ve\n",
    "# Ratio of kinetic energies of electron and proton = 1.8e+03, therefore Ke > Kp "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.21;page:1.20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.21: Page-1.20\n",
      "de-Broglie wavelength of the electron in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.73)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of de-Broglie wavelength of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "V = 50; # Potential difference, V\n",
    "m = 9.1e-031;     # Mass of the electron, kg\n",
    "e = 1.6e-019;     # Electronic charge, C\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "lamda = h/math.sqrt(2*m*e*V);    # From de-Broglie relation,\n",
    "print(\"Ex1.21: Page-1.20\")\n",
    "print(\"de-Broglie wavelength of the electron in angstrom:\"),round (lamda/1e-010,2)\n",
    "# Result \n",
    "# de-Broglie wavelength of the electron = 1.73 angstrom"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.23;page:1.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.23:: Page-1.31\n",
      "The minimum accuracy to locate the position of an electron in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.0002)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of locate the position of an electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "v = 740;    # Speed of the electron, m/s\n",
    "m = 9.1e-031;     # Mass of the electron, kg\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "p = m*v;    # Momentum of the electron, kg-m/s\n",
    "frac_v = 0.05/100;  # Correctness in the speed \n",
    "delta_p = p*frac_v;    # Uncertainty in momentum, kg-m/s\n",
    "delta_x = h/(4*3.14)*1/delta_p;  # Uncertainty in position, m\n",
    "print(\"Ex1.23:: Page-1.31\")\n",
    "print(\"The minimum accuracy to locate the position of an electron in m:\"),round (delta_x,4)\n",
    "# Result \n",
    "# The minimum accuracy to locate the position of an electron = 1.56e-04 m  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.24;page:1.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.24 : Page-1.31\n",
      "The uncertainty in energy of an emitted photon in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 3e-06)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of the uncertainty in energy of an emitted photon\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "h_cross = h/(2*3.14);    # Reduced Planck's constant, Js\n",
    "delta_t = 1e-010;   # Uncertainty in time, s\n",
    "# From Energy-time uncertainty, \n",
    "# delta_E*delta_t = h_cross/2, solving for delta_E\n",
    "delta_E = h_cross/(2*delta_t);  # Uncertainty in energy of an emitted photon, J \n",
    "print(\"Ex1.24 : Page-1.31\")\n",
    "print(\"The uncertainty in energy of an emitted photon in eV:\"),round (delta_E/1.6e-019,6)\n",
    "# Result \n",
    "# The uncertainty in energy of an emitted photon = 3.283e-06 eV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.25;page:1.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.25: : Page-1.31\n",
      "The minimum uncertainty in velocity of electron in m/s:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 7252.75)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of minimum uncertainty\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "delta_x_max = 1e-007;   # Uncertainty in length, m\n",
    "m = 9.1e-031;   # Mass of an electron, kg\n",
    "# From Position-momentum uncertainty, \n",
    "# delta_p_min = m*delta_v_min = h/delta_x_max, solving for delta_v_min\n",
    "delta_v_min = h/(delta_x_max*m);    # Minimum uncertainty in velocity of electron, m/s\n",
    "print(\"Ex1.25: : Page-1.31\")\n",
    "print(\"The minimum uncertainty in velocity of electron in m/s:\"),round (delta_v_min,2)\n",
    "# Result \n",
    "# The minimum uncertainty in velocity of electron = 7.25e+03 m/s "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.26;page:1.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.26:  Page-1.32\n",
      "The minimum uncertainty in momemtum of proton in kg-m/s:\n",
      "The kinetic energy of proton in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 112819.34)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of minimum uncertainty and kinetic energy of proton\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "delta_x_max = 8.5e-014;   # Uncertainty in length, m\n",
    "m = 1.67e-027;  # Mass of proton, kg\n",
    "# From Position-momentum uncertainty, \n",
    "# delta_p_min*delta_x_max = h, solving for delta_p_min\n",
    "delta_p_min = h/delta_x_max;    # Minimum uncertainty in momentum of electron, kg-m/s\n",
    "p_min = delta_p_min;    # Minimum momentum of the proton, kg.m/s\n",
    "delta_E = p_min**2/(2*m); \n",
    "print(\"Ex1.26:  Page-1.32\")\n",
    "print(\"The minimum uncertainty in momemtum of proton in kg-m/s:\"), p_min\n",
    "print(\"The kinetic energy of proton in eV:\"),round (delta_E/1.6e-019,2)\n",
    "# Result \n",
    "# The minimum uncertainty in momemtum of proton = 7.76e-21 kg-m/s\n",
    "# The kinetic energy of proton = 1.128e+05 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.27;page:1.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.27:: Page-1.32\n",
      "The percentage uncertainty in momentum of electron = 2d percent:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 15.90167880419624)"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of percentage uncertainty\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "E = 0.15*1e+03*e;   # Energy of the electron, J\n",
    "m = 9.1e-031;  # Mass of electron, kg\n",
    "delta_x = 0.5e-010; # Position uncertainty of electron, m\n",
    "p = (2*m*E)**(1/2);  # Momentum of the electron, kg-m/s\n",
    "# delta_x*delta_p = h/(4*%pi), solving for delta_p\n",
    "delta_p = h/(4*3.14*delta_x);    # Uncertainty in momentum of electron, kg-m/s\n",
    "frac_p = delta_p/p*100;     # Percentage uncertainty in momentum of electron, kg-m/s\n",
    "print(\"Ex1.27:: Page-1.32\")\n",
    "print(\"The percentage uncertainty in momentum of electron = 2d percent:\"), frac_p\n",
    "# Result \n",
    "# The percentage uncertainty in momentum of electron = 15 percent   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.28;page:1.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.28:: Page-1.33\n",
      "The position uncertainty of particle in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 2.787680143269864e-14)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of position uncertainty of particle\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "delta_v = 7.54e-015;    # Uncertainty in velocity of the particle, m/s\n",
    "m = 0.25e-06;  # Mass of particle, kg\n",
    "# delta_x*delta_p = h/(4*%pi), solving for delta_x\n",
    "delta_x = h/(4*3.14*m*delta_v); # Position uncertainty of particle, m\n",
    "print(\"Ex1.28:: Page-1.33\")\n",
    "print(\"The position uncertainty of particle in m:\"), delta_x\n",
    "# Result \n",
    "# The position uncertainty of particle = 2.79e-14 m   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.29;page:1.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.29 : Page-1.33\n",
      "The position uncertainty of moving electron in m:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.0003)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of position uncertainty of moving electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "v = 450;        # Velocity of the electron, m/s\n",
    "delta_v = v*0.05/100;    # Uncertainty in velocity of the particle, m/s\n",
    "m = 9.1e-031;  # Mass of electron, kg\n",
    "# delta_x*delta_p = h/(4*%pi), solving for delta_x\n",
    "delta_x = h/(4*3.14*m*delta_v); # Position uncertainty of particle, m\n",
    "print(\"Ex1.29 : Page-1.33\")\n",
    "print(\"The position uncertainty of moving electron in m:\"),round (delta_x,4)\n",
    "# Result \n",
    "# The position uncertainty of moving electron = 2.57e-04 m "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.30;page:1.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.30:: Page-1.33\n",
      "The smallest possible uncertainty in position of the electron in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.02)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of smallest possible uncertainty\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "v = 3e+07;        # Velocity of the electron, m/s\n",
    "m0 = 9.1e-031;  # Rest mass of electron, kg\n",
    "m = m0/math.sqrt(1-v**2/c**2); # Mass of moving electron, kg\n",
    "delta_p_max = m*v;    # Maximum uncertainty in momentum of the particle, m/s\n",
    "# delta_x_min*delta_p_max = h/(4*%pi), solving for delta_x_min\n",
    "delta_x_min = h/(4*3.14*delta_p_max); # Minimum position uncertainty of particle, m\n",
    "print(\"Ex1.30:: Page-1.33\")\n",
    "print(\"The smallest possible uncertainty in position of the electron in angstrom:\"),round (delta_x_min/1e-010,2)\n",
    "# Result \n",
    "# The smallest possible uncertainty in position of the electron = 0.019 angstrom"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.31;page:1.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.31:  : Page-1.44\n",
      "The energy difference between the neighbouring levels of Na at the highest state in:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 1.0592022109560034e-07)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy difference\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "l = 2e-002;     # Length of the side of the cube, m\n",
    "E_F = 9*e;  # Fermi energy, J\n",
    "# As E_F = h**2/(8*m*l**2)*(nx**2 + ny**2 + nz**2) and nx = ny = nz for a cube, solving for nx\n",
    "nx = math.sqrt(E_F*(8*m*l**2)/(3*h**2));   # Value of integer for a cube\n",
    "E = h**2/(8*m*l**2)*3*nx**2; # Fermi energy, J\n",
    "E1 = h**2/(8*m*l**2)*((nx-1)**2 + nx**2 + nx**2);    # Energy of the level just below the fermi level, J\n",
    "delta_E = E - E1;   # Difference in the energy between the neighbouring levels of Na at the highest state, J\n",
    "print(\"Ex1.31:  : Page-1.44\")\n",
    "print(\"The energy difference between the neighbouring levels of Na at the highest state in:\"), delta_E/e\n",
    "# Result \n",
    "# The energy difference between the neighbouring levels of Na at the highest state = 1.06e-07 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.32;page:1.45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.32:: Page-1.45\n",
      "The energy of the neutron confined in a nucleus in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 6113398.2)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy of the neutron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 1.67e-027;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "nx = 1; # Principle quantum numbers in 3D corresponding to the longest energy state\n",
    "ny = 1;\n",
    "nz = 1;\n",
    "lx = 1e-014;    # Dimensions of the box to which the neutron is confined, m\n",
    "ly = 1e-014;\n",
    "lz = 1e-014;\n",
    "E = h**2/(8*m)*(nx**2/lx**2+ny**2/ly**2+nz**2/lz**2);    # Energy of the neutron confined in the nucleus, J\n",
    "print(\"Ex1.32:: Page-1.45\")\n",
    "print(\"The energy of the neutron confined in a nucleus in eV:\"),round (E/e,2)\n",
    "# Result \n",
    "# The energy of the neutron confined in a nucleus = 6.11e+06 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.33;page:1.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.33:: Page-1.46\n",
      "The energy of the electron moving in one dimensional infinitely high potential box in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 8.48)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "n = 1;     # For simplicity assume principle quantum number to be unity\n",
    "l = 2.1e-010;   # Length of one dimensional potential box, m\n",
    "E = h**2*n**2/(8*m*l**2);    # Energy of the electron, J\n",
    "print(\"Ex1.33:: Page-1.46\")\n",
    "print(\"The energy of the electron moving in one dimensional infinitely high potential box in eV:\"),round (E/e,2)\n",
    "# Result \n",
    "# The energy of the electron moving in one dimensional infinitely high potential box = 8.48 n**2 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.34;page:1.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.34:: Page-1.46\n",
      "The lowest energy of the electron in a one dimensional force free region in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 3.05)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of lowest energy of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "n = 1;     # The lowest energy state of electron\n",
    "l = 3.5e-010;   # Length of one dimensional potential box, m\n",
    "E = h**2*n**2/(8*m*l**2);    # Energy of the electron in the lowest state, J\n",
    "print(\"Ex1.34:: Page-1.46\")\n",
    "print(\"The lowest energy of the electron in a one dimensional force free region in eV:\"),round (E/e,2)\n",
    "# Result \n",
    "# The lowest energy of an electron in a one dimensional force free region = 3 eV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.35;page:1.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.35:: Page-1.46\n",
      "The energy of the electron in first state in J:\n",
      "The energy of the electron in second state in J:\n",
      "The energy of the electron in third state in J:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 5.966941645612005e-19)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "l = 9.5e-010;   # Length of one dimensional potential box, m\n",
    "# First energy level\n",
    "n = 1;     # The first energy state of electron\n",
    "E1 = h**2*n**2/(8*m*l**2);    # Energy of the electron in first state, J\n",
    "# Second energy level\n",
    "n = 2;     # The second energy state of electron\n",
    "E2 = h**2*n**2/(8*m*l**2);    # Energy of the electron in second state, J\n",
    "# Third energy level\n",
    "n = 3;     # The third energy state of electron\n",
    "E3 = h**2*n**2/(8*m*l**2);    # Energy of the electron in third state, J\n",
    "print(\"Ex1.35:: Page-1.46\")\n",
    "print(\"The energy of the electron in first state in J:\"), E1\n",
    "print(\"The energy of the electron in second state in J:\"), E2\n",
    "print(\"The energy of the electron in third state in J:\"), E3\n",
    "# Result \n",
    "# The energy of the electron in first state  = 6.6e-20 J\n",
    "# The energy of the electron in second state  = 2.7e-19 J\n",
    "# The energy of the electron in third state  = 6.0e-19 J "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.36;page:1.47"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.36:: Page-1.47\n",
      "The energy of the electron in lowest state in eV:\n",
      "The energy of the electron in second state in eV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 23.93)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy of the electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "l = 2.5e-010;   # Length of one dimensional potential box, m\n",
    "# First energy level\n",
    "n = 1;     # The lowest energy state of electron\n",
    "E1 = h**2*n**2/(8*m*l**2);    # Energy of the electron in first state, J\n",
    "# Second energy level\n",
    "n = 2;     # The second energy state of electron\n",
    "E2 = h**2*n**2/(8*m*l**2);    # Energy of the electron in second state, J\n",
    "print(\"Ex1.36:: Page-1.47\")\n",
    "print(\"The energy of the electron in lowest state in eV:\"),round (E1/e,2)\n",
    "print(\"The energy of the electron in second state in eV:\"),round (E2/e,2)\n",
    "# Result \n",
    "# The energy of the electron in lowest state  =  5.98 eV\n",
    "# The energy of the electron in second state  = 23.93 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.37;page:1.47"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.37:: Page-1.47\n",
      "The lowest energy of the neutron confined to the nucleus in MeV:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.05)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of lowest energy of the neutron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m = 1.67e-027;   # Electronic mass, kg\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "l = 2.5e-010;   # Length of one dimensional potential box, m\n",
    "delta_x = 1e-014;   # Uncertainty in position of neutron, m\n",
    "# From uncertainty principle, \n",
    "# delta_x*delta_p = h/(4*%pi), solving for delta_p\n",
    "delta_p = h/(4*3.14*delta_x);    # Uncertainty in momentum of neutron, kg-m/s\n",
    "p = delta_p;    # Momemtum of neutron in the box, kg-m/s\n",
    "KE = p**2/(2*m); # Kinetic energy of neutron in the box, J\n",
    "print(\"Ex1.37:: Page-1.47\")\n",
    "print(\"The lowest energy of the neutron confined to the nucleus in MeV:\"),round (KE/(e*1e+06),2)\n",
    "# Result \n",
    "# The lowest energy of the neutron confined to the nucleus = 0.05 MeV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.38;page:1.56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.38: : Page-1.56\n",
      "The energy of scattered X-ray:\n",
      "The energy of recoil electron:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 4.88)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of energy of scattered X-ray and recoil electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m0 = 9.1e-031;   # Electronic mass, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "phi = 45;     # Scattering angle of X-rays, degrees\n",
    "E = 75;     # Incident energy of X-rays, keV\n",
    "# As from Compton shift formula\n",
    "# 1/E_prime - 1/E = 1/(m0*c**2)*(1-cosd(phi))\n",
    "# Solving for E_prime\n",
    "E_prime = 1/((1/(m0*c**2/(e*1e+03)))*(1-math.cos(phi))+1/E); # Energy of scattered photon, keV\n",
    "E_recoil = E - E_prime;     # Energy of recoil electron, keV\n",
    "print(\"Ex1.38: : Page-1.56\")\n",
    "print(\"The energy of scattered X-ray:\"),round (E_prime,2)\n",
    "print(\"The energy of recoil electron:\"),round (E_recoil,2)\n",
    "# Result \n",
    "# The energy of scattered X-ray = 71.9 keV\n",
    "# The energy of recoil electron = 3.1 keV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.39;page:1.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.39: : Page-1.57\n",
      "The wavelength of scattered X-ray in angstrom:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.25)"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of wavelength of scattered X-ray\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m0 = 9.1e-031;   # Electronic mass, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "phi = 60;     # Scattering angle of X-rays, degrees\n",
    "E = 75;     # Incident energy of X-rays, keV\n",
    "# As from Compton shift formula\n",
    "delta_L = h/(m0*c)*(1-math.cos(3.14));   # Change in photon wavelength, m\n",
    "lamda = 0.198e-010;    # Wavelength of incident photon, m\n",
    "lamda_prime = (lamda+delta_L)/1e-010;  # Wavelength of scattered X-ray, angstrom \n",
    "print(\"Ex1.39: : Page-1.57\")\n",
    "print(\"The wavelength of scattered X-ray in angstrom:\"),round (lamda_prime,2)\n",
    "# Result \n",
    "# The wavelength of scattered X-ray = 0.2101 angstrom"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.40;page:1.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.40:: Page-1.57\n",
      "The wavelength of scattered X-ray at degrees view in angstrom:\n",
      "The recoil energy of electron scattered through degrees:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 60, 84.82)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of wavelength of scattered X-ray and recoil energy of electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m0 = 9.1e-031;   # Electronic mass, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "pi = 180;     # Scattering angle of X-rays, degrees\n",
    "lamda = 1.78;    # Wavelength of incident photon, m\n",
    "lamda_prime = 1.798;  # Wavelength of scattered X-ray, angstrom \n",
    "# As from Compton shift formula\n",
    "# lamda_prime - lamda = h/(m0*c)*(1-cosd(pi)), Change in photon wavelength, m\n",
    "# Or we may write, lamda_prime - lamda = k*(1-cosd(pi))\n",
    "# solving for k\n",
    "k = (lamda_prime - lamda)/(1-math.cos(pi));  # k = h/(m0*c) value, angstrom\n",
    "# For pi = 60\n",
    "pi = 60;       # New angle of scattering, degrees\n",
    "lamda_prime = lamda + k*(1-math.cos(pi)); # Wavelength of scattered radiation at 60 degree angle, angstrom\n",
    "print(\"Ex1.40:: Page-1.57\")\n",
    "print(\"The wavelength of scattered X-ray at degrees view in angstrom:\"), pi,round (lamda_prime,2)\n",
    "# Recoil energy of electron\n",
    "E = h*c*(1/lamda - 1/lamda_prime)*1e+010;    # Recoil energy of electron, joule\n",
    "print(\"The recoil energy of electron scattered through degrees:\"), pi,round (E/e,2)    \n",
    "# Result \n",
    "# The wavelength of scattered X-ray at 60 degrees view = 1.7845 angstrom\n",
    "# The recoil energy of electron scattered through 60 degrees = 17.5 eV "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.41;page:1.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.41:: Page-1.58\n",
      "The wavelength of scattered X-ray as viewed atdegrees in m\n",
      "The recoil energy of electron scattered through degrees in eV:\n",
      "The direction of emission of recoil electron in degrees:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 0.32)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of wavelength of scattered X-ray and recoil energy of electron\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "h = 6.6e-034;    # Planck's constant, Js\n",
    "m0 = 9.1e-031;   # Electronic mass, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "e = 1.6e-019;   # Energy equivalent of 1 eV, J/eV\n",
    "phi = 90;     # Scattering angle of X-rays, degrees\n",
    "E = 510*1e+03*e;    # Energy of incident photon, J\n",
    "# As E = h*c/lamda, solving for lamda\n",
    "lamda = h*c/E;    # Wavelength of incident photon, m\n",
    "# As from Compton shift formula\n",
    "# lamda_prime - lamda = h/(m0*c)*(1-math.cosd(phi)), solving for lamda_prime\n",
    "lamda_prime = lamda + h/(m0*c)*(1-math.cos(phi));  # Wavelength of scattered X-ray, m  \n",
    "print(\"Ex1.41:: Page-1.58\")\n",
    "print(\"The wavelength of scattered X-ray as viewed atdegrees in m\"), phi,lamda_prime\n",
    "# Recoil energy of electron\n",
    "E = h*c*(1/lamda - 1/lamda_prime);    # Recoil energy of electron, joule\n",
    "print(\"The recoil energy of electron scattered through degrees in eV:\"),round (E/e,2)\n",
    "# Direction of recoil electron\n",
    "theta = math.tan(lamda*math.sin(phi)/(lamda_prime-lamda*math.cos(phi)));  # Direction of recoil electron, degrees\n",
    "print(\"The direction of emission of recoil electron in degrees:\"),round (theta,2)\n",
    "# Result \n",
    "# The wavelength of scattered X-ray as viewed at 90 degrees = 4.84e-12 m\n",
    "# The recoil energy of electron scattered through 90 degrees = 2.55e+05 eV\n",
    "# The direction of emission of recoil electron = 26.61 degrees \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example:1.42;page:1.59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ex1.42: : Page-1.59\n",
      "The number of electrons striking the target per sec in electrons/sec:\n",
      "The maximum speed of the electrons when they strike in m/s:\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, 66033624.47)"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#cal of number of electrons and maximum speed of the electrons\n",
    "#intiation of all variables \n",
    "#given that\n",
    "import math\n",
    "m = 9.1e-031;   # Electronic mass, kg\n",
    "c = 3e+08;      # Speed of light, m/s\n",
    "e = 1.6e-019;   # Charge on the electron, C\n",
    "V = 12.4e+03;   # Potential diffeence applied across the X-ray tube, V\n",
    "i = 2e-03;  # Current through the X-ray tube, A\n",
    "t = 1;  # Time for which the electrons strike the target material, s\n",
    "N = i*t/e;    # Number of electrons striking the target per sec, per sec\n",
    "v_max = math.sqrt(2*e*V/m);  # Maximum speed of the electrons, m/s\n",
    "print(\"Ex1.42: : Page-1.59\")\n",
    "print(\"The number of electrons striking the target per sec in electrons/sec:\"), N\n",
    "print(\"The maximum speed of the electrons when they strike in m/s:\"),round (v_max,2)\n",
    "# Result \n",
    "# The number of electrons striking the target per sec = 1.25e+16 electrons/sec\n",
    "# The maximum speed of the electrons when they strike = 6.6e+07 m/s"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}