{
 "metadata": {
  "name": "",
  "signature": "sha256:d47bf0be5cde96d0aef086befce8360c308553e75286c744d02ce7f3929fcd07"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "16: Particle Accelerators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.1, Page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "fo=9*10**6;    #frequency(Hz)\n",
      "m=6.643*10**-27;    #mass(kg)\n",
      "e=1.6*10**-19;      #the charge on electron(C)\n",
      "\n",
      "#Calculation\n",
      "Q=2*e;           #electron charge(C)\n",
      "B=fo*2*math.pi*m/Q;      #magnetic flux density(Wb/m^2)\n",
      "\n",
      "#Result\n",
      "print \"magnetic flux density is\",round(B,2),\"Wb/m^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic flux density is 1.17 Wb/m^2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.2, Page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "B=0.7;      #magnetic flux intensity(Wb/m^2)\n",
      "m=3.34*10**-27;     #mass(Kg)\n",
      "e=1.6*10**-19;      #the charge on electron(C)\n",
      "\n",
      "\n",
      "#Calculation\n",
      "Q=e;\n",
      "fo=B*Q/(2*math.pi*m*10**6);       #cyclotron frequency(MHz)  \n",
      "\n",
      "#Result\n",
      "print \"The cyclotron frequency is\",round(fo,1),\"MHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cyclotron frequency is 5.3 MHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.3, Page number 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "B=0.75;      #magnetic flux intensity(Wb/m^2)\n",
      "m1=1.67*10**-27;    #mass(Kg)\n",
      "m2=3.31*10**-27;    #mass(Kg)\n",
      "e=1.6*10**-19;      #the charge on electron(C)\n",
      "Rm=2;        #radius(m)\n",
      "\n",
      "#Calculation\n",
      "Q=e;\n",
      "Emax_m1=3.12*10**12*B**2*Q**2*Rm**2/m1;       #Maximum energy for proton(MeV)\n",
      "Emax_m2=3.12*10**12*B**2*Q**2*Rm**2/m2;       #Maximum energy for deuteron(MeV) \n",
      "\n",
      "#Result\n",
      "print \"Maximum energy for proton is\",round(Emax_m1),\"MeV\"\n",
      "print \"Maximum energy for deuteron is\",int(Emax_m2),\"MeV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum energy for proton is 108.0 MeV\n",
        "Maximum energy for deuteron is 54 MeV\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.4, Page number 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "mo=9.1*10**-31;      #mass of electron(kg)\n",
      "m=1.67*10**-27;      #mass of proton(kg)\n",
      "c=3*10**8;           #speed of light(m/s)\n",
      "E=1;                 #given energy(MeV)\n",
      "\n",
      "#Calculation\n",
      "Eo=mo*c**2/(1.6*10**-13);         #rest energy for electron(MeV)\n",
      "mbymo_e=1+(E/Eo);                #Ratio for electron\n",
      "Eo=m*c**2/(1.6*10**-13);          #rest energy for proton(MeV)\n",
      "mbymo_p=1+(E/Eo);                #Ratio for proton\n",
      "\n",
      "#Result\n",
      "print \"Ratio for electron is\",round(mbymo_e,3)\n",
      "print \"Ratio for proton is\",round(mbymo_p,6)\n",
      "print \"answer in the book varies due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio for electron is 2.954\n",
        "Ratio for proton is 1.001065\n",
        "answer in the book varies due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.5, Page number 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "B=0.5;      #magnetic field(Wb/m^2)\n",
      "d=1.5;      #diameter(m)\n",
      "f=59;       #frequency(Hz)\n",
      "e=1.6*10**-19;        #the charge on electron(C)\n",
      "c=3*10**8;            #speed of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "R=d/2;             #radius(m)\n",
      "N=c/(4*(2*math.pi*50)*R);       #number of revolutions\n",
      "E=B*e*R*c/(1.6*10**-13);        #final energy(MeV)\n",
      "AE=E/N*10**6;                 #average energy(eV)\n",
      "\n",
      "#Result\n",
      "print \"final energy is\",E,\"MeV\"\n",
      "print \"average energy is\",round(AE,1),\"eV\"\n",
      "print \"answer for average energy given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "final energy is 112.5 MeV\n",
        "average energy is 353.4 eV\n",
        "answer for average energy given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.6, Page number 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "E=0.51;      #kinetic energy(MeV)\n",
      "R=0.15;      #radius(m)\n",
      "e=1.6*10**-19;      #the charge on electron(C)\n",
      "mo=9.12*10**-31;    #mass of electron(kg)\n",
      "c=3*10**8;          #speed of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "Eo=E;\n",
      "m=mo*(1+(E/Eo));       #mass(kg)\n",
      "b=math.sqrt(1-(mo/m)**2);\n",
      "v=b*c;            #velocity(m/s)\n",
      "B=mo*v/(e*R);     #flux density(Wb/m^2)   \n",
      "\n",
      "#Result\n",
      "print \"mass is\",round(m/1e-31,1),\"*10^-31 kg\"\n",
      "print \"velocity is\",round(v/1e+8,1),\"*10^8 m/s\"\n",
      "print \"flux density is\",round(B,5),\"Wb/m^2\"\n",
      "print \"answer for flux density in the book varies due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mass is 18.2 *10^-31 kg\n",
        "velocity is 2.6 *10^8 m/s\n",
        "flux density is 0.00987 Wb/m^2\n",
        "answer for flux density in the book varies due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.7, Page number 308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "E=4;       #applied voltage(MeV)\n",
      "m=3.334*10**-27;      #mass of deuteron(kg)\n",
      "R=0.75;               #radius(m)\n",
      "e=1.6*10**-19;        #the charge on electron(C)\n",
      "\n",
      "#Calculation\n",
      "E=4*10**6*e;\n",
      "fo=math.sqrt(E/(2*m))/(math.pi*R);     #frequnecy of generator(Hz)\n",
      "\n",
      "#Result\n",
      "print \"frequnecy of generator is\",round(fo/1e+6,3),\"*10^6 Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "frequnecy of generator is 4.158 *10^6 Hz\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.8, Page number 308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "roi=15;      #rate of increase(Wb/s)\n",
      "tr=10**6;    #total revolutions\n",
      "\n",
      "#Calculation\n",
      "IE=roi*10**-6;      #increased energy(MeV)\n",
      "FE=IE*tr;           #Final Energy(MeV) \n",
      "\n",
      "#Result\n",
      "print \"Final Energy is\",FE,\"MeV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Final Energy is 15.0 MeV\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 16.9, Page number 308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "R=0.1;       #radius(m)\n",
      "h=6.625*10**-34;        #Plank's constant\n",
      "c=3*10**8;              #speed of light(m/s)\n",
      "roi=15;                 #rate of increase(Wb/s)\n",
      "t=4*10**-4;             #period of accerleartion(s)\n",
      "e=1.6*10**-19;          #the charge on electron(C)\n",
      "\n",
      "#Calculation\n",
      "N=c*t/(2*math.pi*R);      #number of revolutions\n",
      "IE=roi;              #incresed energy(eV)\n",
      "ME=N*IE*10**-6;      #maximum energy(MeV)  \n",
      "ME1=ME*10**6*e;       #conversion in V\n",
      "p=ME1/c;\n",
      "gama=h/p;         #wavelength of gama rays(m)\n",
      "\n",
      "#Result\n",
      "print \"Maximum energy is\",round(ME,3),\"MeV\"\n",
      "print \"Corresponding wavelength of gama rays is\",round(gama/1e-13,3),\"*10^-13 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum energy is 2.865 MeV\n",
        "Corresponding wavelength of gama rays is 4.336 *10^-13 m\n"
       ]
      }
     ],
     "prompt_number": 43
    }
   ],
   "metadata": {}
  }
 ]
}