{
 "metadata": {
  "name": "",
  "signature": "sha256:766f8db46f5669c6f5759d5eab7e64f8d7d90b920fc4c9477c5cb4c2747c652e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "5: Wave and Quantum Mechanics and X-rays"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.1, Page number 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34;        #planck's constant(J)\n",
      "c = 3*10**8;           #velocity of light(m/s)\n",
      "lamda = 6328;          #wavelength of laser(angstrom)\n",
      "ev = 6.24*10**18;         #conversion factor from J to eV\n",
      "\n",
      "#Calculation\n",
      "lamda = lamda*10**-10;        #wavelength of laser(m)\n",
      "E = h*c/lamda;          #energy of photon(J)\n",
      "Eev = E*ev;               #energy of photon(eV)\n",
      "Eev = math.ceil(Eev*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"energy of photon is\",round(E/1e-19,2),\"*10**-19 J or\",Eev,\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy of photon is 3.14 *10**-19 J or 1.962 eV\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.2, Page number 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 6730;       #wavelength of laser(angstrom)\n",
      "p = 1;           #output power(mW)\n",
      "h = 6.63*10**-34;        #planck's constant(J)\n",
      "c = 3*10**8;           #velocity of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "p = p*10**-3;         #output power(W)\n",
      "lamda = lamda*10**-10;        #wavelength of laser(m)\n",
      "n = p*lamda/(h*c);         #number of photons(per sec)\n",
      "\n",
      "#Result\n",
      "print \"number of photons emitted is\",round(n/1e+15,2),\"*10**15 per sec\"\n",
      "print \"answer given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "number of photons emitted is 3.38 *10**15 per sec\n",
        "answer given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.3, Page number 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "l = 3*10**-2;        #coherence length for sodium light(m)\n",
      "lamda = 5893;      #wavelength(angstrom)\n",
      "c = 3*10**8;           #velocity of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "lamda = lamda*10**-10;        #wavelength(m)\n",
      "n = l/lamda;       #number of oscillations\n",
      "tc = l/c;          #coherence time(s)\n",
      "\n",
      "#Result\n",
      "print \"number of oscillations is\",round(n)\n",
      "print \"the coherence time is\",tc,\"s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "number of oscillations is 50908.0\n",
        "the coherence time is 1e-10 s\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}