{
 "metadata": {
  "name": "",
  "signature": "sha256:75f630452dabb13cd6338a8496d2e2a380d11dfea4caf46d952806c209090d7c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4:MAGNETIC PROPERTIES OF MATERIALS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg1:pg-153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "phi_B=2.4e-5  #magnetic flux in weber\n",
      "A=0.2         #cross-sectional area in cm**2\n",
      "H=1600        #magnetising field in A/m\n",
      "mu_o=4*round(math.pi,2)*1e-7 #absolute permeability of air in N/A**2\n",
      "B=phi_B/(A*1e-4)\n",
      "mu=B/H\n",
      "Xm=mu/mu_o-1\n",
      "print\"Magnetic permeability of iron bar is \",\"{:.1e}\".format(mu),\"N/A**2\"\n",
      "print\"Magnetic susceptibility of iron bar is \",round(Xm,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic permeability of iron bar is  7.5e-04 N/A**2\n",
        "Magnetic susceptibility of iron bar is  596.13\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg2:pg-154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import *\n",
      "Xm=948e-11      #magnetic susceptibility of a medium\n",
      "pi=Symbol('pi')\n",
      "mu_o=4*pi*1e-7  #absolute permeability of air in H/m\n",
      "mu_r=1+Xm\n",
      "mu=int(mu_r)*mu_o\n",
      "print\"Relative Permeability is =\",mu_r,\"=\",int(mu_r),\"or >\",int(mu_r)\n",
      "print\" Relative permeability is slightly greater than one.\"\n",
      "print\"Permeability is =\",mu,\"H/m\" #answer in book is 4*(pi)*1e-7 H/m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Relative Permeability is = 1.00000000948 = 1 or > 1\n",
        " Relative permeability is slightly greater than one.\n",
        "Permeability is = 4.0e-7*pi H/m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg3:pg-154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mu_r=1200 #relative permeability of iron rod\n",
      "n=5       #number of turns per cm\n",
      "i=0.5     #current in ampere\n",
      "V=1e-3    #volume of iron rod in m**3\n",
      "I=(mu_r-1)*(n*1e2)*i\n",
      "M=I*V\n",
      "print\"Magnetic moment is \",\"{:.0e}\".format(M),\"Am**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic moment is  3e+02 Am**2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg4:pg-155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "mu_r=100  #relative permeability of iron rod\n",
      "n=300     #number of turns per meter\n",
      "i=0.5     #current in ampere\n",
      "D=10      #diameter of iron rod in mm\n",
      "r=D/2     #radius of iron rod in mm\n",
      "l=2       #length of iron rod in meter\n",
      "I=(mu_r-1)*n*i\n",
      "V=round(math.pi,2)*(r*1e-3)**2*l\n",
      "M=I*V\n",
      "print\"Magnetic moment is \",round(M,3),\"Am**2\"\n",
      "#answer in book is wrong as the value of l is taken wrong in calcultion.          "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic moment is  2.331 Am**2\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg5:pg-163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n=1e29        #number of atoms per unit volume in atoms/m**3\n",
      "Pm=1.8e-23    #magnetic moment of one atom in A-m**2\n",
      "K=1.38e-23    #Boltzmann's constant in J/K\n",
      "T=300         #temperature in Kelvin\n",
      "mu_o=4*round(math.pi,2)*10**-7 #absolute permeability of air in N/A**2\n",
      "B=0.1         #magnetic flux density in weber/m**2\n",
      "A=1           #cross-section area in cm**2\n",
      "l=10          #length of iron bar in cm\n",
      "Xm=mu_o*n*Pm**2/(3*K*T) #magnetic susceptibility of iron bar\n",
      "P_m=Pm**2*B/(3*K*T)     #mean dipole moment of an iron atom in A-m**2\n",
      "V=(A*1e-4)*(l*1e-2)     #volume of iron bar in m**3\n",
      "n_o_a=V*n               \n",
      "dm=n_o_a*P_m            #dipole moment of the iron bar \n",
      "I=Pm*n                  \n",
      "m=I*V\n",
      "print\"Magnetic Susceptibility is \",\"{:.3e}\".format(Xm)\n",
      "print\"Dipole moment is \",\"{:.3e}\".format(dm),\"Am**2\"\n",
      "print\"Magnetisation is \",\"{:.1e}\".format(I),\"A/m\"\n",
      "print\"Magnetic moment is \",int(m),\"Am**2\"#this answer is wrong in book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic Susceptibility is  3.277e-03\n",
        "Dipole moment is  2.609e-03 Am**2\n",
        "Magnetisation is  1.8e+06 A/m\n",
        "Magnetic moment is  18 Am**2\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg6:pg-169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "H=5e3  #Coercivity of bar magnet in ampere/m \n",
      "l=10   #length of solenoid in cm\n",
      "n=50   #number of turns in solenoid\n",
      "i=H*(l*1e-2)/n\n",
      "print\"Current is \",int(i),\"amp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current is  10 amp\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg8:pg-170"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a=250    #area of B-H loop in J/m**3\n",
      "f=50     #frequency of a.c. in Hz\n",
      "m=9.0    #mass of iron core in Kg\n",
      "p=7500   #density of iron in Kg/m**3\n",
      "V=m/p\n",
      "n=50*60*60\n",
      "E=n*V*a\n",
      "print\"Hysteresis loss of energy E per hour is \",\"{:.1e}\".format(E),\"J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hysteresis loss of energy E per hour is  5.4e+04 J\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg10:pg-170"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "A=0.785e-4   #cross-sectional area of rowland ring in m**2\n",
      "Ri=5.0       #inner radius in cm\n",
      "Ro=6.0       #outer radius in cm\n",
      "N=400        #number of turns of wire\n",
      "Bo=2e-4      #magnetic flux density in weber/m**2\n",
      "mu_o=4*math.pi*10**-7 #absolute permeability of air in N/A**2\n",
      "Ns=50        #number of turns in secondary coil\n",
      "R=8.0        #resistance in ohm\n",
      "B1=800*Bo    #magnetic flux density in weber/m**2\n",
      "l=2*math.pi*(Ri+Ro)*1e-2/2\n",
      "i=Bo*l/(mu_o*N)\n",
      "q=Ns*B1*A/R\n",
      "print\"Required Current is \",i,\"amp\"\n",
      "print\"Charge passed is \",q,\"coulomb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required Current is  0.1375 amp\n",
        "Charge passed is  7.85e-05 coulomb\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg11:pg-171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "mu_r=400 #relative permeability of iron ring\n",
      "r=0.1    #mean radius of iron ring in meter\n",
      "A=5e-4   #cross-sectional area of iron ring in m**2\n",
      "n=1000   #number of turns of wire\n",
      "i=4      #current in ampere\n",
      "mu_o=4*math.pi*10**-7  #absolute permeability of air in N/A**2\n",
      "B=mu_o*mu_r*n*i/(2*math.pi*r)\n",
      "phi=B*A \n",
      "print\"Flux in the ring is \",\"{:.2e}\".format(phi),\"weber\"\n",
      "n_o=500  #number of turns in secondary coil per meter\n",
      "R=10     #resistance in ohm\n",
      "q=2*n_o*A*B/R\n",
      "print\"Electricity discharged through the secondary coil is \",q,\"coulomb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flux in the ring is  1.60e-03 weber\n",
        "Electricity discharged through the secondary coil is  0.16 coulomb\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg12:pg-171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "m=12    #weight of the iron core in Kg\n",
      "p=7.5   #density of iron core in gm/cc\n",
      "f=50    #frequency in cycles/sec\n",
      "a=3000  #area of hysteresis loop in ergs/cm**3 (unit is misprinted in question in book)\n",
      "V=(m*1e3)/p\n",
      "n=f*60*60\n",
      "E=n*V*a\n",
      "print\"Hourly loss of energy is \",E,\"erg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hourly loss of energy is  8.64e+11 erg\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eg13:pg-172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a=0.5   #area of B-H loop in cm**2\n",
      "H=1e3   #value of 1 cm on X-axis in A/m\n",
      "B=1     #value of 1 cm on Y-axis in Tesla\n",
      "V=1e-3  #volume of specimen in m**3\n",
      "n=50    #frequency of a.c. in Hz\n",
      "area=a*H*B #area of B-H loop in J/m**3 (this is misprinted in solution in book)\n",
      "p=n*V*area\n",
      "print\"Hysteresis power loss is \",int(p),\"Watt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hysteresis power loss is  25 Watt\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}