{
 "metadata": {
  "name": "",
  "signature": "sha256:db58e543ef86cd601814ac49a8404db7a1403e7140977a41ff4c6b1fc2ae61b9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 Magnetic field due to electric current"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1 Page no 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "q=1.6*10**-19                  #c\n",
      "B=0.1                          #T\n",
      "v=5.0*10**6                      #m/s\n",
      "a=90                           #degree\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "Fm=q*v*B*math.sin(a)\n",
      "\n",
      "#Result\n",
      "print\"Force on the proton is\", round(Fm*10**14,1)*10**-14,\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force on the proton is 7.2e-14 N\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 Page no 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "n=1.0*10**29                          #m**-3\n",
      "e=1.6*10**-19                           #C\n",
      "A=2*10**-6                                       #m**2\n",
      "I=5                                       #A\n",
      "B=0.15                                   #T\n",
      "a=90                                     #degree\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "Vd=I/(n*e*A)\n",
      "Fm=e*Vd*B*math.sin(a)\n",
      "\n",
      "#Result\n",
      "print\"Force acting on each electron is\", round(Fm*10**24,2)*10**-24,\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force acting on each electron is 3.35e-24 N\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 Page no 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "q=2*1.6*10**-19                  #C\n",
      "v=6*10**5                        #m/s\n",
      "B=0.2                             #T\n",
      "a=90                              #degree\n",
      "m=6.65*10**-27\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "Fm=q*v*B*math.sin(a)\n",
      "a=Fm/m\n",
      "\n",
      "#Result\n",
      "print\"Force on alpha particle is\", round(Fm*10**14,2)*10**-14,\"N\"\n",
      "print\"Acceleration of alpha particle is\",round(a*10**-12,2)*10**12,\"m/s**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force on alpha particle is 3.43e-14 N\n",
        "Acceleration of alpha particle is 5.16e+12 m/s**2\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 Page no 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a=60                         #degree\n",
      "u=4*3.14*10**-7                 #T/A m\n",
      "Bc=2\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "a=(Bc/2.0)/(math.tan(60)*180/3.14)\n",
      "B1=(10**-7*math.tan(60)*(math.sin(60*180/3.14)+math.sin(60*180/3.14)))*10\n",
      "B=3*B1\n",
      "\n",
      "#Result\n",
      "print\"Magnetic fieldat the centroid of the triangle is\", round(B*10**7,0),\"*10**-7 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic fieldat the centroid of the triangle is 10.0 *10**-7 T\n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5 Page no 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "n=20\n",
      "I=1                  #A\n",
      "r=0.08                  #m\n",
      "u=4*3.14*10**-7             #T/A m\n",
      "\n",
      "#Calculation\n",
      "B=u*n*I/(2*r)\n",
      "\n",
      "#Result\n",
      "print\"Magnitude of the magnetic field is\", B*10**4,\"*10*4 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of the magnetic field is 1.57 *10*4 T\n"
       ]
      }
     ],
     "prompt_number": 68
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6 Page no 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "u=10**-7\n",
      "I=10*10**-2                       #A\n",
      "r=0.5\n",
      "\n",
      "#Calculation\n",
      "B=u*I/r**2\n",
      "\n",
      "#Result\n",
      "print\"Magnetic field on Y axis is\", B,\"K^ T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field on Y axis is 4e-08 K^ T\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7 Page no 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "I=5               #A\n",
      "l=0.01              #m\n",
      "a=45              #degree\n",
      "r=2               #m\n",
      "u=10**-7\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "B=(u*I*l*math.sin(a)*180/3.14)/r**2\n",
      "\n",
      "#Result\n",
      "print\"Magnetic field is\", round(B*10**8,1)*10**-10,\"T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field is 6.1e-10 T\n"
       ]
      }
     ],
     "prompt_number": 82
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8 Page no 427"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "u=4*3.14*10**-7                     #T/A m\n",
      "n=20\n",
      "I=12                                  #A\n",
      "r=0.1                                 #m\n",
      "\n",
      "#Calculation\n",
      "B=u*n*I/(2*r)\n",
      "\n",
      "#Result\n",
      "print\"Magnetic field at the centre of coil is\", round(B*10**3,1),\"*10**-3 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field at the centre of coil is 1.5 *10**-3 T\n"
       ]
      }
     ],
     "prompt_number": 87
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.12 Page no 429"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "r=0.02             #m\n",
      "\n",
      "#Calculation\n",
      "B=u*I/(4*r)\n",
      "\n",
      "#Result\n",
      "print\"The magnitude of magnetic field is\", round(B*10**4,2),\"*10**-4 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnitude of magnetic field is 1.88 *10**-4 T\n"
       ]
      }
     ],
     "prompt_number": 92
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.13 Page no 429"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "v=4*10**6\n",
      "r=0.5*10**-10\n",
      "e=1.6*10**-19\n",
      "t=1\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "f=v/(2.0*math.pi*r)\n",
      "I=f*e/t\n",
      "B=u*I/(2*r)\n",
      "\n",
      "#Result\n",
      "print\"Magnetic field produced by the electrons is\", round(B,1),\"T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field produced by the electrons is 25.6 T\n"
       ]
      }
     ],
     "prompt_number": 98
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15 Page no 430"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "n=100\n",
      "I=5                          #A\n",
      "r=0.1                        #m\n",
      "x=0.05\n",
      "\n",
      "#Calculation\n",
      "B=u*n*I/(2*r)\n",
      "B1=(u*n*I*r**2)/(2.0*(r**2+x**2)**1.5)\n",
      "\n",
      "#Result\n",
      "print\"(i) Magnetic field at the centre of the coil is\",B*10**3,\"*10**-3 T\"\n",
      "print\"(ii) The magnetic field at the point on the axis of the coil is\",round(B1*10**3,2),\"*10**-3 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Magnetic field at the centre of the coil is 3.14 *10**-3 T\n",
        "(ii) The magnetic field at the point on the axis of the coil is 2.25 *10**-3 T\n"
       ]
      }
     ],
     "prompt_number": 109
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.18 Page no 431"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a=5*10**-2\n",
      "I=50\n",
      "e=1.6*10**-19\n",
      "B1=10**7\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "B=u*I/(2*math.pi*a)\n",
      "F=e*B1*B\n",
      "\n",
      "#Result\n",
      "print\"(i) Force on electron when velocity is towards the wire\", round(F*10**16,1)*10**-16,\"N\"\n",
      "print\"(ii) Force on electron when velocity is parallel to the wire\", round(F*10**16,1)*10**-16,\"N\"\n",
      "print\"(iii) Force on electron when velocity is perpendicular to the wire is zero\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Force on electron when velocity is towards the wire 3.2e-16 N\n",
        "(ii) Force on electron when velocity is parallel to the wire 3.2e-16 N\n",
        "(iii) Force on electron when velocity is perpendicular to the wire is zero\n"
       ]
      }
     ],
     "prompt_number": 118
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.20 Page no 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "e=1.6*10**-19\n",
      "f=6.8*10**15\n",
      "r=0.51*10**-10\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "I=e*f\n",
      "B=(u*I)/(2*r)\n",
      "M=1*I*math.pi*r**2\n",
      "\n",
      "#Result\n",
      "print\"The effective dipole moment is\",round(M*10**24,0)*10**-24,\"Am**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The effective dipole moment is 9e-24 Am**2\n"
       ]
      }
     ],
     "prompt_number": 127
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.22 Page no 439"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "n=5*850/1.23\n",
      "I=5.57                    #A\n",
      "\n",
      "#calculation\n",
      "u=4*math.pi*10**-7\n",
      "B=u*n*I\n",
      "\n",
      "#Result\n",
      "print\"Magnitude of magnetic field is\", round(B*10**3,1),\"*10**-3 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of magnetic field is 24.2 *10**-3 T\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.23 Page no 439"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "r1=20\n",
      "r2=25\n",
      "I=2                   #a\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "r=(r1+r2)/2.0\n",
      "l=(2*math.pi*r)*10**-2\n",
      "n=1500/l\n",
      "B=u*n*I\n",
      "\n",
      "#Result\n",
      "print\"(i) Magnetic field inside the toroid is\", round(B,3),\"T\"\n",
      "print\"(ii) magnetic field outside the toroid is zero\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Magnetic field inside the toroid is 0.003 T\n",
        "(ii) magnetic field outside the toroid is zero\n"
       ]
      }
     ],
     "prompt_number": 138
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.25 Page no 440"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "I=2                         #A\n",
      "R=5*10**-2                          #m\n",
      "r=3*10**-2                            #m\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "B=u*I*r/(2*math.pi*R**2)\n",
      "\n",
      "#Result\n",
      "print round(B*10**6,1),\"*10**-6 T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "4.8 *10**-6 T\n"
       ]
      }
     ],
     "prompt_number": 142
    }
   ],
   "metadata": {}
  }
 ]
}