{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 18:Magnetism"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex18.1:pg-901"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The force on the wire is F= 0.000958363  N\n"
     ]
    }
   ],
   "source": [
    "  #Example 18_1\n",
    "import math \n",
    "  \n",
    "#To find the force on the wire\n",
    "b=2*10**-4        #Units in T\n",
    "i=20           #Units in A\n",
    "l=0.3          #Units in meters\n",
    "theta=53                #Units in degrees\n",
    "thetaa=math.sin(theta*math.pi/180)        #Units in Radians     \n",
    "f=b*i*l*thetaa               #Units in N\n",
    "print \"The force on the wire is F=\",round(f,9),\" N\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Ex18.2:pg-902"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The magnitude of magnetic field is B= 0.2609  T\n"
     ]
    }
   ],
   "source": [
    "  #Example 18_2\n",
    " \n",
    "  \n",
    "  #To find the magnitude of the magnetic field\n",
    "m=1.67*10**-27          #Units in Kg\n",
    "v=10**6           #Units in meters/sec\n",
    "r=4*10**-2            #Units in Meters\n",
    "q=1.6*10**-19           #Units in C or eV\n",
    "b=(m*v)/(r*q)           #Units in T\n",
    "print \"The magnitude of magnetic field is B=\",round(b,4),\" T\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Ex18.3:pg-903"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The magnetic field exerts a force of q*v*B upwards on the particle.\n",
      "The particle doesnot deflect because the two forces are equal\n",
      "Hence v=(E/B)\n",
      "A particle with this speed will pass through the region of the crossfields and undeflected\n"
     ]
    }
   ],
   "source": [
    "  #Example 18_3\n",
    " \n",
    "  \n",
    "#To show that the particles does not deflect from its straight line path\n",
    "print \"The magnetic field exerts a force of q*v*B upwards on the particle.\\nThe particle doesnot deflect because the two forces are equal\\nHence v=(E/B)\\nA particle with this speed will pass through the region of the crossfields and undeflected\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Ex18.4:pg-903"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of B is= 1.2  G\n"
     ]
    }
   ],
   "source": [
    "  #Example 18_4\n",
    " \n",
    "  \n",
    "#To calculate the value of B at a radial distance of 5 cm\n",
    "u=4*math.pi*10**-7        #Units in T m/A\n",
    "i=30         #Units in A\n",
    "r=0.05           #Units in Meters\n",
    "b=(u*i)/(2*math.pi*r)           #Units in T\n",
    "b=b*10**4            #Units in G\n",
    "print \"The value of B is=\",round(b,2),\" G\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Ex18.5:pg-904"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The magnetic moment of Hydrogen atom is=\n",
      "9.319e-24\n",
      "A meters**2\n"
     ]
    }
   ],
   "source": [
    "  #Example 18_5\n",
    " \n",
    "  \n",
    "#To find the magnetic moment of hydrogen atom\n",
    "r=0.53*10**-10        #Units in meters\n",
    "a=math.pi*r**2         #Units in meters**2\n",
    "q=1.6*10**-19            #Units in C\n",
    "f=6.6*10**15          #Units in sec**-1\n",
    "i=q*f            #Units in A\n",
    "u=i*a            #Units in A meter**2\n",
    "print \"The magnetic moment of Hydrogen atom is=\"\n",
    "print round(u,27)\n",
    "print \"A meters**2\"\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}