{
 "metadata": {
  "name": "",
  "signature": "sha256:9b22acc9bcbd27c33c9e62b557ecc66fc981e9c1775b58e8ee670ca880259cf2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter11-Particle Accelerators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.1 : : Page-535(2011) \n",
      "#calculate The optimum number of stages in the accelerator and the ripple voltage\n",
      "import math\n",
      "V_0 = 10**5;        ## Accelerating voltage, volts\n",
      "C = 0.02e-006;        ## Capacitance, farad\n",
      "I = 4*1e-003;            ## Current, ampere\n",
      "f = 200.;            ## Frequency, cycles per sec\n",
      "n = math.sqrt (V_0*f*C/I);    ## Number of particles\n",
      "delta_V = I*n*(n+1.)/(4.*f*C);\n",
      "print'%s %.2f %s'%(\"\\nThe optimum number of stages in the accelerator = \", n,\"\");\n",
      "print'%s %.2f %s'%(\"\\nThe ripple voltage = \", delta_V/1e+003,\"kV\");\n",
      "\n",
      "## Result\n",
      "## The optimum number of stages in the accelerator = 10\n",
      "## The ripple voltage = 27.5 kV  \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The optimum number of stages in the accelerator =  10.00 \n",
        "\n",
        "The ripple voltage =  27.50 kV\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.2 : : Page-536 (2011)\n",
      "#calculate The charging current and The rate of rise of electrode potential\n",
      "import math\n",
      "s = 15.;        ## Speed, metre per sec\n",
      "w = 0.3;        ## Width of the electrode, metre\n",
      "E = 3e+06;        ## Breakdown strength, volts per metre\n",
      "eps = 8.85e-12;    ## Absolute permitivity of free space, farad per metre\n",
      "C = 111e-12;        ## Capacitance, farad\n",
      "i = round (2*eps*E*s*w*10**6);    ## Current, micro ampere\n",
      "V = i/C*10**-12;            ## Rate of rise of electrode potential, mega volts per sec\n",
      "print'%s %.2f %s %.2f %s '%(\"\\nThe charging current =\",i,\" micro-ampere\"and \" \\nThe rate of rise of electrode potential = \",V,\" MV/sec\");\n",
      "\n",
      "## Result\n",
      "## The charging current = 239 micro-ampere \n",
      "## The rate of rise of electrode potential = 2.15 MV/sec "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The charging current = 239.00  \n",
        "The rate of rise of electrode potential =  2.15  MV/sec \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.3 : : Page-536 (2011)\n",
      "#calculate The length of the final drift tube and The kinetic energy of the injected protons\n",
      "import math\n",
      "import scipy\n",
      "from scipy import integrate\n",
      "\n",
      "f = 200.*10**6;        ## Frequency of the accelerator, cycle per sec\n",
      "M = 1.6724e-27;        ## Mass of the proton, Kg\n",
      "E = 45.3*1.6e-13;        ## Accelerating energy, joule\n",
      "L_f = round (1./f*math.sqrt(2.*E/M)*100.);    ## Length of the final drift tube, centi metre\n",
      "L_1 = 5.35*10**-2;                ## Length of the first drift tube, metre\n",
      "K_E = (1./2.*M*L_1**2.*f**2.)/1.6e-13;    ## Kinetic energy of the injected proton, MeV\n",
      "E_inc = E/1.6e-13-K_E;        ## Increase in energy, MeV\n",
      "q = 1.6e-19;                ## Charge of the proton, C\n",
      "V = 1.49e+06;            ## Accelerating voltage, volts\n",
      "N = E_inc*1.6e-13/(q*V);   ## Number of drift protons\n",
      "def fun(n):\n",
      "    y=n**0.5\n",
      "    return y\n",
      "\n",
      "l2=scipy.integrate.quad(fun,0,N)\n",
      "L = 1./f*math.sqrt(2.*q*V/M)*l2[0];    ## Total length of the accelerator, metre\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%(\"\\nThe length of the final drift tube = \",L_f,\" cm\"and\"\\nThe kinetic energy of the injected protons = \",K_E,\" MeV\"and\"\\nThe total length of the accelerator = \",L,\" metre\");\n",
      "\n",
      "## Result\n",
      "## The length of the final drift tube = 47 cm\n",
      "## The kinetic energy of the injected protons = 0.60 MeV\n",
      "## The total length of the accelerator = 9.2 metre "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The length of the final drift tube =  47.00 \n",
        "The kinetic energy of the injected protons =  0.60 \n",
        "The total length of the accelerator =  9.25  metre \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.5 : : Page-536 (2011)\n",
      "#find energy of the emergine deutron and frequency of the dee voltage\n",
      "import math\n",
      "B = 1.4;        ## Magnetic field, tesla\n",
      "R = 88e-002;        ## Radius of the orbit, metre\n",
      "q = 1.6023e-019;                ## Charge of the deutron, C\n",
      "M_d = 2.014102*1.66e-27;        ## Mass of the deutron, Kg\n",
      "M_He = 4.002603*1.66e-27;        ## Mass of the He ion, Kg\n",
      "E = B**2*R**2*q**2/(2*M_d*1.6e-13);        ## Energy og the emerging deutron, mega electron volts\n",
      "f = B*q/(2.*math.pi*M_d)*10**-6;        ## Frequency of the deutron voltage, mega cycles per sec\n",
      "B_He = 2*math.pi*M_He*f*10**6/(2*q);    ## Magnetic field required for He(++) ions, weber per square metre\n",
      "B_change = B-B_He;        ## Change in magnetic field, tesla\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%(\"\\nThe energy of the emerging deutron = \",E,\" MeV\" and \"\\nThe frequency of the dee voltage = \",f,\"MHz\" and\"\\nThe change in magnetic field = \",B_change,\" tesla\");\n",
      "\n",
      "## Result\n",
      "## The energy of the emerging deutron = 36.4 MeV\n",
      "## The frequency of the dee voltage = 10.68 MHz\n",
      "## The change in magnetic field = 0.01 tesla "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The energy of the emerging deutron =  36.42 \n",
        "The frequency of the dee voltage =  10.68 \n",
        "The change in magnetic field =  0.01  tesla \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.6: : Page-537 (2011)\n",
      "#calculate effective reduction in magnetic field and charge in orbit radius\n",
      "import math\n",
      "K_E = 7.5*1.6023e-13;        ## Kinetic energy, joule \n",
      "r = 0.51;                    ## Radius of the proton's orbit, metre\n",
      "E = 5*10**6;                ## Electric field, volts per metre\n",
      "m = 1.67e-27;            ## Mass of the proton, Kg\n",
      "q = 1.6023e-19;                ## Charge of the proton, C\n",
      "v = math.sqrt(2.*K_E/m);        ## Velocity of the proton, metre per sec\n",
      "B_red = E/v;                ## The effective reduction in magnetic field, tesla\n",
      "B = m*v/(q*r);            ## Total magnetic field produced, tesla\n",
      "r_change = r*B_red/B;        ## The change in orbit radius, metre\n",
      "print'%s %.2f %s %.2f %s '%(\"\\nThe effective reduction in magnetic field = \",B_red,\" tesla \"and  \"\\nThe change in orbit radius = \",r_change,\" metre \");\n",
      "\n",
      "## Result\n",
      "## The effective reduction in magnetic field = 0.132 tesla  \n",
      "## The change in orbit radius = 0.087 metre  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The effective reduction in magnetic field =  0.13 \n",
        "The change in orbit radius =  0.09  metre  \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.7 : : Page-537 (2011)\n",
      "#calculate enegy of the elctron and average enegy gained per revolution \n",
      "import math\n",
      "B = 0.4;        ## Magnetic field, tesla\n",
      "e = 1.6203e-19;        ## Charge of an electron, C\n",
      "R = 30*2.54e-02;        ## Radius, metre\n",
      "c = 3e+08;            ## Capacitance, farad\n",
      "E = B*e*R*c/1.6e-13;        ## The energy of the electron, mega electron volts\n",
      "f = 50.;                ## Frequency, cycles per sec\n",
      "N = c/(4*2*math.pi*f*R);        ## Total number of revolutions\n",
      "Avg_E_per_rev = E*1e+006/N;        ## Average energy gained per revolution, electron volt\n",
      "print'%s %.2f %s %.2f %s '%(\"\\nThe energy of the electron = \",E,\" MeV\"and \"\\nThe average energy gained per revolution = \",Avg_E_per_rev,\" eV\");\n",
      "\n",
      "## Result\n",
      "## The energy of the electron = 92.6 MeV\n",
      "## The average energy gained per revolution = 295.57 eV \n",
      "## Note: Wrong answer is given in the textbook \n",
      "##   Average energy gained per revolution : 295.57 electron volts\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The energy of the electron =  92.60 \n",
        "The average energy gained per revolution =  295.57  eV \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.8 : : Page-537 (2011)\n",
      "#calculate peak current and average current and duty cycle\n",
      "import math\n",
      "R = 0.35;            ## Orbit radius, metre\n",
      "N = 100e+06/480.;        ## Total number of revolutions\n",
      "L = 2*math.pi*R*N;            ## Distance traversed by the electron, metre\n",
      "t = 2e-06;                ## Pulse duration, sec\n",
      "e = 1.6203e-19;            ## Charge of an electron, C\n",
      "n = 3e+09;                ## Number of electrons\n",
      "f = 180.;                ## frequency, hertz\n",
      "I_p = n*e/t;            ## Peak current, ampere\n",
      "I_avg = n*e*f;           ## Average current, ampere \n",
      "tau = t*f;                ## Duty cycle\n",
      "print'%s %.2e %s %.2e %s %.2e %s'%(\"\\nThe peak current = \",I_p,\" ampere\" and \"\\nThe average current = \",I_avg,\" ampere \"and \"\\nThe duty cycle =\",tau,\"\");\n",
      "\n",
      "## Result\n",
      "## The peak current = 2.4e-004 ampere  \n",
      "## The average current = 8.75e-008 ampere \n",
      "## The duty cycle = 3.6e-004 \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The peak current =  2.43e-04 \n",
        "The average current =  8.75e-08 \n",
        "The duty cycle = 3.60e-04 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.9 : : Page-538 (2011)\n",
      "#calculate maximum frequncy of the dee voltage and kinetic energy of the deutron \n",
      "import math\n",
      "q = 1.6023e-19;        ## Charge of an electron, C\n",
      "B_0 = 1.5;            ## Magnetic field at the centre, tesla\n",
      "m_d = 2.014102*1.66e-27;        ## Mass of the deutron, Kg\n",
      "f_max = B_0*q/(2*math.pi*m_d*10**6);        ## Maximum frequency of the dee voltage, mega cycles per sec\n",
      "B_prime = 1.4310;        ## Magnetic field at the periphery of the dee, tesla\n",
      "f_prime = 10**7;            ## Frequency, cycles per sec\n",
      "c = 3e+08;            ## Velocity of the light, metre per sec\n",
      "M = B_prime*q/(2*math.pi*f_prime*1.66e-27);        ## Relativistic mass, u\n",
      "K_E = (M-m_d/1.66e-27)*931.5;        ## Kinetic energy of the particle, mega electron volts\n",
      "print'%s %.2f %s %.2f %s '%(\"\\nThe maximum frequency of the dee voltage = \",f_max,\" MHz\"and \"\\nThe kinetic energy of the deuteron = \",K_E,\" MeV\");\n",
      " \n",
      "## Result\n",
      "## The maximum frequency of the dee voltage = 11.44 MHz\n",
      "## The kinetic energy of the deuteron = 171.6 MeV \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The maximum frequency of the dee voltage =  11.44 \n",
        "The kinetic energy of the deuteron =  171.62  MeV \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex10-pg538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate frequency of the applied electric field and magnetic field intensity\n",
      "## Exa11.10 : : Page-538 (2011)\n",
      "import math\n",
      "e = 1.6023e-19;        ## Charge of an electron, C\n",
      "E = 70*1.6e-13;        ## Energy, electron volts\n",
      "R = 0.28;            ## Radius of the orbit, metre\n",
      "c = 3e+08;            ## Velocity of light, metre per sec\n",
      "B = E/(e*R*c);        ## Magnetic field intensity, tesla\n",
      "f = e*B*c**2/(2*math.pi*E);        ## Frequency, cycle per sec\n",
      "del_E = 88.5*(0.07)**4*10**3/(R);     ## Energy radiated by an electron, electron volts\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%(\"\\nThe frequency of the applied electric field = \",f,\" cycles per sec\" and\"\\nThe magnetic field intensity = \",B,\" tesla\"and \"\\nThe energy radiated by the electron =\",del_E,\" eV\");\n",
      "\n",
      "## Result\n",
      "## The frequency of the applied electric field = 1.705e+008 cycles per sec \n",
      "## The magnetic field intensity = 0.832 tesla\n",
      "## The energy radiated by the electron = 7.6 eV "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The frequency of the applied electric field =  170523153.31 \n",
        "The magnetic field intensity =  0.83 \n",
        "The energy radiated by the electron = 7.59  eV \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex11-pg538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate kinetic energy of the accelerated nitrogen\n",
      "## Exa11.11 : : Page-538 (2011)\n",
      "import math\n",
      "E = 3.;        ## Energy of proton synchrotron, giga electron volts\n",
      "m_0_c_sq = 0.938;        ## Relativistic energy, mega electron volts\n",
      "P_p = math.sqrt(E**2-m_0_c_sq**2);        ## Momentum of the proton, giga electron volts per c\n",
      "P_n = 6*P_p;        ## Momentum of the N(14) ions, giga electron volts\n",
      "T_n = math.sqrt(P_n**2+(0.938*14.)**2)-0.938*14;        ## Kinetic energy of the accelerated nitrogen ion\n",
      "print'%s %.2f %s'%(\"\\nThe kinetic energy of the accelerated nitrogen ion = \",T_n,\" MeV\");\n",
      "\n",
      "## Result\n",
      "## The kinetic energy of the accelerated nitrogen ion = 8.43 MeV \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The kinetic energy of the accelerated nitrogen ion =  8.43  MeV\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex12-pg539"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "## Exa11.12 : : Page-539 (2011)\n",
      "#calculate maximum magnetic flux density and maximum frequency of the accerlating voltage\n",
      "import math\n",
      "e = 1.6e-19;        ## Charge of an electron, C\n",
      "R = 9.144;            ## Radius, metre\n",
      "m_p = 1.67e-027;        ## Mass of the proton, Kg\n",
      "E = 3.6*1.6e-13;        ## Energy, joule\n",
      "L = 3.048;         ## Length of the one synchrotron section, metre \n",
      "T = 3;            ## Kinetic energy, giga electron volts\n",
      "c = 3e+08;        ## Velocity of the light, metre per sec\n",
      "m_0_c_sq = 0.938;    ## Relativistic energy, mega electron volts\n",
      "B = round (math.sqrt(2*m_p*E)/(R*e)*10**4);        ## Maximum magnetic field density, web per square metre\n",
      "v = B*10**-4*e*R/m_p;        ## Velocity of the proton, metre per sec\n",
      "f_c = v/(2*math.pi*R*10**6);        ## Frequency of the circular orbit, mega cycles per sec\n",
      "f_0 = 2*math.pi*R*f_c*10**3/(2*math.pi*R+4*L);    ## Reduced frequency, kilo cycles per sec\n",
      "B_m = 3.33*math.sqrt(T*(T+2*m_0_c_sq))/R;    ## Relativistic field, web per square metre\n",
      "f_0 = c**2*e*R*B*1e-004/((2*math.pi*R+4*L)*(T+m_0_c_sq)*e*1e+015);    ## Maximum frequency of the accelerating voltage, mega cycles per sec\n",
      "print'%s %.2f %s %.2f %s '%(\"\\nThe maximum magnetic flux density = \",B_m,\" weber/Sq.m\"and \"\\nThe maximum frequency of the accelerating voltage = \",f_0,\" MHz\");\n",
      " \n",
      "## Result\n",
      "## The maximum magnetic flux density = 1.393 weber/Sq.m\n",
      "## The maximum frequency of the accelerating voltage = 0.09 MHz\n",
      "## Answer is given wrongly in the textbook \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The maximum magnetic flux density =  1.39 \n",
        "The maximum frequency of the accelerating voltage =  0.09  MHz \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13-pg539"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate energy of the proton\n",
      "## Exa11.13 : : Page-539 (2011)\n",
      "import math\n",
      "E_c = 30e+009;        ## Energy of the proton accelerator, GeV\n",
      "m_0_c_sq = 0.938*10**6;        ## Relativistic energy, GeV\n",
      "E_p = (4*E_c**2-2*m_0_c_sq**2)/(2*m_0_c_sq) ;    ## Energy of the proton, GeV\n",
      "print'%s %.2f %s'%(\"\\nThe energy of the proton = \",E_p/1e+009,\" GeV\");\n",
      "print(\"wrong answer in the textbook\")\n",
      "## Result\n",
      "## The energy of the proton = 1.92e+006 GeV \n",
      "## Wrong answer given in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The energy of the proton =  1918976.54  GeV\n",
        "wrong answer in the textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}