{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#8: Magnetic Materials"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.1, Page number 170"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in magnetic moment is 17.58 *10**-30 Am**2\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "r=0.05*10**-9;     #radius(m)\n",
    "B=1;     #magnetic induction(web/m**2)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "d_mew=e**2*r**2*B/(4*m);       #change in magnetic moment(Am**2)\n",
    "\n",
    "#Result\n",
    "print \"change in magnetic moment is\",round(d_mew*10**30,2),\"*10**-30 Am**2\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.2, Page number 170"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "intensity of magnetisation is -0.495 amp/m\n",
      "magnetic flux density is 0.124 wb/m**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "chi=-0.5*10**-5;       #magnetic susceptibility\n",
    "H=9.9*10**4;        #magnetic field intensity(amp/m)\n",
    "mew0=4*math.pi*10**-7;\n",
    "\n",
    "#Calculation\n",
    "I=chi*H;      #intensity of magnetisation(amp/m)\n",
    "B=mew0*H*(1+chi);       #magnetic flux density(wb/m**2)\n",
    "\n",
    "#Result\n",
    "print \"intensity of magnetisation is\",I,\"amp/m\"\n",
    "print \"magnetic flux density is\",round(B,3),\"wb/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.3, Page number 170"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relative permeability is 16\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "H=220;        #magnetic field intensity(amp/m)\n",
    "I=3300;      #magnetisation(amp/m)\n",
    "\n",
    "#Calculation\n",
    "mewr=1+(I/H);      #relative permeability\n",
    "\n",
    "#Result\n",
    "print \"relative permeability is\",int(mewr)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.4, Page number 171"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic induction is 14.503 web/m**2 0.001408\n",
      "dipole moment is 1.646 *10**-23 amp m**2\n",
      "answers in the book are wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "r=6.1*10**-11;     #radius of atom(m)\n",
    "new=8.8*10**15;    #frequency(revolution/sec)\n",
    "mew0=4*math.pi*10**-7;\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "\n",
    "#Calculation\n",
    "i=e*new;      #current(amp)\n",
    "B=mew0*i/(2*r);     #magnetic induction(web/m**2)\n",
    "mew=i*math.pi*r**2;     #dipole moment(amp m**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetic induction is\",round(B,3),\"web/m**2\",i\n",
    "print \"dipole moment is\",round(mew*10**23,3),\"*10**-23 amp m**2\"\n",
    "print \"answers in the book are wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.5, Page number 171"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "average number of bohr magnetons is 2.854 bohr magneton/atom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Is=1.96*10**6;        #saturation magnetisation(amp/m)\n",
    "a=3*10**-10;        #cube edge(m)\n",
    "mewB=9.27*10**-24;   #bohr magneton(amp/m**2)\n",
    "n=2;       #number of atoms\n",
    "\n",
    "#Calculation\n",
    "N=n/(a**3);      \n",
    "mew_bar=Is/(N*mewB);     #average number of bohr magnetons(bohr magneton/atom)\n",
    "\n",
    "#Result\n",
    "print \"average number of bohr magnetons is\",round(mew_bar,3),\"bohr magneton/atom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.6, Page number 172"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetizing force is 978.874 amp/m\n",
      "relative permeability is 4.065\n",
      "answer in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "I=3000;      #magnetisation(amp/m)\n",
    "mew0=4*math.pi*10**-7;\n",
    "B=0.005;     #flux density(weber/m**2)\n",
    "\n",
    "#Calculation\n",
    "H=(B/mew0)-I;      #magnetizing force(amp/m)\n",
    "mewr=(I/H)+1;      #relative permeability\n",
    "\n",
    "#Result\n",
    "print \"magnetizing force is\",round(H,3),\"amp/m\"\n",
    "print \"relative permeability is\",round(mewr,3)\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.7, Page number 172"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "permeability is 8.333 *10**-4 henry/m\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "H=1800;      #magnetizing force(amp/m)\n",
    "chi=3*10**-5;    #magnetic flux(wb)\n",
    "A=0.2*10**-4;    #area(m**2)\n",
    "\n",
    "#Calculation\n",
    "B=chi/A;\n",
    "mew=B/H;     #permeability(henry/m)\n",
    "\n",
    "#Result\n",
    "print \"permeability is\",round(mew*10**4,3),\"*10**-4 henry/m\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.8, Page number 172"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic dipole moment is 5.0265 *10**-3 amp m**2\n",
      "answer in the book varies due to rounding off errors\n",
      "torque is 0.7071 *10**-3 Nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "r=0.04;    #radius(m)\n",
    "i=1000*10**-3;    #current(mA)\n",
    "B=10**-3;   #magnetic flux density(wb/m**2)\n",
    "theta=45;   #angle(degrees)\n",
    "\n",
    "#Calculation\n",
    "A=math.pi*r**2;     #area(m**2)\n",
    "mew=i*A;        #magnetic dipole moment(amp m**2)\n",
    "theta=theta*math.pi/180;\n",
    "tow=i*B*math.cos(theta);    #torque(Nm)\n",
    "\n",
    "#Result\n",
    "print \"magnetic dipole moment is\",round(mew*10**3,4),\"*10**-3 amp m**2\"\n",
    "print \"answer in the book varies due to rounding off errors\"\n",
    "print \"torque is\",round(tow*10**3,4),\"*10**-3 Nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.9, Page number 173"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hysteresis loss per cycle is 40.0 J/m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "A=100;     #area(m**2)\n",
    "B=0.01;    #flux density(wb/m**2)\n",
    "H=40;      #magnetic field(amp/m)\n",
    "M=7650;    #atomic weight(kg/m**3)\n",
    "\n",
    "#Calculation\n",
    "h=A*B*H;    #hysteresis loss per cycle(J/m**3)\n",
    "\n",
    "#Result\n",
    "print \"hysteresis loss per cycle is\",h,\"J/m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.10, Page number 173"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hysteresis power loss per second is 20000 watt/m**3\n",
      "power loss is 2.614 watt/kg\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "h=200;     #hysteresis loss per cycle(J/m**3)\n",
    "M=7650;    #atomic weight(kg/m**3)\n",
    "n=100;     #magnetisation cycles per second\n",
    "\n",
    "#Calculation\n",
    "hpl=h*n;     #hysteresis power loss per second(watt/m**3)\n",
    "pl=hpl/M;    #power loss(watt/kg)\n",
    "\n",
    "#Result\n",
    "print \"hysteresis power loss per second is\",hpl,\"watt/m**3\"\n",
    "print \"power loss is\",round(pl,3),\"watt/kg\""
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
