{
 "metadata": {
  "name": "",
  "signature": "sha256:6eaeb1b666053d6a5e25f6642f9c553eb5c875421649f4bad88cbcf5e3456f43"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "6: Moving charge in electric and magnetic fields"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.1, Page number 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "theta=90-60;     #angle(degrees)\n",
      "N=30;   #number of turns\n",
      "i=10;   #current(A)\n",
      "a=0.2;  #length(m)\n",
      "b=0.1;   #breadth(m)\n",
      "B=8*10**-4;   #magnetic field of induction(Wb/m**2)\n",
      "\n",
      "#Calculation\n",
      "theta=theta*math.pi/180;   #angle(radian)\n",
      "tow=N*a*b*B*i*math.sin(theta);   #torque on coil(Nm)\n",
      "\n",
      "#Result\n",
      "print \"torque on coil is\",tow*10**3,\"*10**-3 Nm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "torque on coil is 2.4 *10**-3 Nm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.2, Page number 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "mew0=4*math.pi*10**-7;\n",
      "ia=10;    #current(A)\n",
      "ib=10;    #current(A)\n",
      "d=0.02;   #diameter(m)\n",
      "\n",
      "#Calculation\n",
      "F=mew0*ia*ib/(2*math.pi*d);    #force(N/m)\n",
      "\n",
      "#Result\n",
      "print \"force is\",F*10**3,\"*10**-3 N/m\"\n",
      "print \"force is attractive\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "force is 1.0 *10**-3 N/m\n",
        "force is attractive\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.3, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i=0.1;   #current(A)\n",
      "N=60;   #number of turns\n",
      "mew0=4*math.pi*10**-7;\n",
      "R=7*10**-2;    #radius(m)\n",
      "x=(18/2)*10**-2;    #distance(m)\n",
      "\n",
      "#Calculation\n",
      "a=mew0*i*N*(R**2);\n",
      "b=((x**2)+(R**2))**(3/2);\n",
      "B=2*a/(2*b);    #magnetic field of induction(Wb/m**2)\n",
      "\n",
      "#Result\n",
      "print \"magnetic field of induction is\",round(B*10**5,1),\"*10**-5 Wb/m**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic field of induction is 2.5 *10**-5 Wb/m**2\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.4, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i=32;   #current(A)\n",
      "r=1.5*10**-3;    #radius(m)\n",
      "mew0=4*math.pi*10**-7;\n",
      "d=1.2*10**-3;   #distance(m)\n",
      "\n",
      "#Calculation\n",
      "B1=mew0*i/(2*math.pi*r);    #magnetic field on surface(T)\n",
      "B2=B1*d;    #magnetic field at a distance(T)\n",
      "\n",
      "#Result\n",
      "print \"magnetic field on surface is\",round(B1*10**3,1),\"mT\"\n",
      "print \"magnetic field at a distance is\",B2*10**3,\"mT\"\n",
      "print \"answer for magnetic field at a distance given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic field on surface is 4.3 mT\n",
        "magnetic field at a distance is 0.00512 mT\n",
        "answer for magnetic field at a distance given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.5, Page number 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i0=5.57;   #current(A)\n",
      "mew0=4*math.pi*10**-7;\n",
      "n=850;    #number of turns\n",
      "l=1.23;   #length(m)\n",
      "\n",
      "#Calculation\n",
      "N=5*n/l;    #number of turns per cm\n",
      "B=mew0*i0*N;     #magnetic field in solenoid(T)\n",
      "\n",
      "#Result\n",
      "print \"magnetic field in solenoid is\",round(B*10**3,1),\"mT\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic field in solenoid is 24.2 mT\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.6, Page number 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i=20;   #current(A)\n",
      "mew0=4*math.pi*10**-7;\n",
      "n=1000;    #number of turns\n",
      "l=1;      #length(m)\n",
      "r=10*10**-2;    #radius(m)  \n",
      "theta=90*math.pi/180;\n",
      "\n",
      "#Calculation\n",
      "a=l/2;\n",
      "b=r/2;\n",
      "c=(a**2)+(b**2);\n",
      "costheta1=a/math.sqrt(c);\n",
      "costheta2=-a/math.sqrt(c);\n",
      "B1=mew0*n*i*(costheta1-costheta2)/2;     #magnetic field induction at the middle(Wb/m**2)\n",
      "costheta_1=l/math.sqrt((l**2)+(r**2));\n",
      "costheta_2=round(math.cos(theta));\n",
      "B2=mew0*n*i*(costheta_1-costheta_2)/2;     #magnetic field induction at one end(Wb/m**2)\n",
      "\n",
      "#Result\n",
      "print \"magnetic field induction at the middle is\",round(B1*10**2,3),\"*10**-2 Wb/m**2\"\n",
      "print \"magnetic field induction at  one end is\",round(B2*10**3,1),\"mT\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic field induction at the middle is 2.501 *10**-2 Wb/m**2\n",
        "magnetic field induction at  one end is 12.5 mT\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.7, Page number 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "K=200*q;   #kinetic energy(J)\n",
      "m=9.1083*10**-31;   #mass(kg)\n",
      "B=10**-2;   #magnetic field(T)\n",
      "theta=30*math.pi/180;   #angle(radian)\n",
      "\n",
      "#Calculation\n",
      "p=math.sqrt(2*m*K);    #momentum(kg m/s)\n",
      "a=p/(q*B);     #radius of path(m)\n",
      "d=2*math.pi*p*math.cos(theta)/(q*B);   #pitch of helix(m)\n",
      "\n",
      "#Result\n",
      "print \"radius of path is\",round(a*10**3,3),\"mm\"\n",
      "print \"pitch of helix is\",round(d*10**3),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius of path is 4.772 mm\n",
        "pitch of helix is 26.0 mm\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.8, Page number 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "K=20*q;   #kinetic energy(J)\n",
      "m=9.1*10**-31;   #mass(kg)\n",
      "B=10**2;   #magnetic field(T)\n",
      "\n",
      "#Calculation\n",
      "v=math.sqrt(2*K/m);    #velocity(m/sec)\n",
      "r=m*v/(q*B);     #radius of path(m)\n",
      "\n",
      "#Result\n",
      "print \"radius of path is\",round(r*10**8,2),\"*10**-8 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius of path is 15.08 *10**-8 m\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.9, Page number 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "m=9.1*10**-31;   #mass(kg)\n",
      "B=0.1;   #magnetic field(Wb/m**2)\n",
      "v=10**4;   #velocity(m/s)\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "\n",
      "#Calculation\n",
      "r=m*v/(q*B);    #radius of path(m)\n",
      "f=v/(2*math.pi*r);    #frequency of revolution(rev/sec)\n",
      "\n",
      "#Result\n",
      "print \"radius of path is\",round(r*10**7,2),\"*10**-7 m\"\n",
      "print \"frequency of revolution is\",round(f/10**9,1),\"*10**9 rev/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius of path is 5.69 *10**-7 m\n",
        "frequency of revolution is 2.8 *10**9 rev/sec\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.10, Page number 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "s=0.1;    #distance(m)\n",
      "v=3*10**6;   #velocity(m/s)\n",
      "y=2*10**-3;   #deflected distance(m)\n",
      "E=0.18;    #static electric field(V/m)\n",
      "\n",
      "#Calculation\n",
      "t=s/v;   #time(sec)\n",
      "ebym=2*y/(E*(t**2));   #e/m of electron(C/kg)\n",
      "\n",
      "#Result\n",
      "print \"e/m of electron is\",ebym,\"C/kg\"\n",
      "print \"answer given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "e/m of electron is 2e+13 C/kg\n",
        "answer given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.11, Page number 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "I=5;    #current(A)\n",
      "B=1.2;   #magnetic field(T)\n",
      "t=0.1*10**-2;    #thickness(m)\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "n=8.48*10**28;   #concentration(electron/m**3)\n",
      "\n",
      "#Calculation\n",
      "VH=I*B/(n*q*t);    #hall voltage(V)\n",
      "\n",
      "#Result\n",
      "print \"hall voltage is\",round(VH*10**6,4),\"micro V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hall voltage is 0.4422 micro V\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.12, Page number 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i=0.5;   #current(A)\n",
      "R=0.1/2;    #radius(m)\n",
      "mew0=4*math.pi*10**-7;\n",
      "N=200;    #number of turns\n",
      "\n",
      "#Calculation\n",
      "B=8*mew0*N*i/(R*math.sqrt(125));     #magnetic field induction(Wb/m**2)\n",
      "B=round(B,4);\n",
      "H=B/mew0;      #intensity of magnetic field(A/m**2)\n",
      "\n",
      "#Result\n",
      "print \"magnetic field induction is\",B*10**3,\"*10**-3 Wb/m**2\"\n",
      "print \"intensity of magnetic field is\",round(H),\"A/m**2\"\n",
      "print \"answer varies due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic field induction is 1.8 *10**-3 Wb/m**2\n",
        "intensity of magnetic field is 1432.0 A/m**2\n",
        "answer varies due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.14, Page number 166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "m=3.3*10**-27;   #mass(kg)\n",
      "t=10**-7;   #time(sec)\n",
      "r=0.3;   #radius(cm)\n",
      "\n",
      "#Calculation\n",
      "B=2*math.pi*m/(q*t);   #magnetic flux density(Wb/m**2)\n",
      "v=B*q*r/m;     #velocity of particle(m/s)\n",
      "\n",
      "#Result\n",
      "print \"magnetic flux density is\",round(B,3),\"Wb/m**2\"\n",
      "print \"velocity of particle is\",round(v/10**7,2),\"*10**7 m/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnetic flux density is 1.296 Wb/m**2\n",
        "velocity of particle is 1.88 *10**7 m/sec\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.15, Page number 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "q=1.6*10**-19;   #conversion factor from eV to J\n",
      "i=1;   #current(amp)\n",
      "n=10**28;    #concentration(electron/m**3)\n",
      "r=0.055*10**-2;    #radius(m)\n",
      "rho=1.7*10**-8;    #resistivity of Cu(ohm m)\n",
      "\n",
      "#Calculation\n",
      "A=math.pi*(r**2);    #area(m**2)\n",
      "vd=1/(n*q*A);    #drift velocity(m/sec)\n",
      "E=rho*i/A;    #electric field(v/m)\n",
      "\n",
      "#Result\n",
      "print \"drift velocity is\",round(vd*10**4,2),\"*10**-4 m/sec\"\n",
      "print \"electric field is\",round(E*10**2,3),\"*10**-2 v/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "drift velocity is 6.58 *10**-4 m/sec\n",
        "electric field is 1.789 *10**-2 v/m\n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}