{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#11: Magnetic properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.1, Page number 11.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relative permeability of iron is 2154\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "M=1.4;     #magnetic field(T)\n",
    "H=6.5*10**-4;  #magnetic field(T)\n",
    "\n",
    "#Calculation\n",
    "chi=M/H;\n",
    "mew_r=1+chi;      #relative permeability of iron\n",
    "\n",
    "#Result\n",
    "print \"relative permeability of iron is\",int(mew_r)\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.2, Page number 11.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "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",
    "M=3300;     #magnetic field(amp/m)\n",
    "H=220;  #magnetic field(amp/m)\n",
    "\n",
    "#Calculation\n",
    "chi=M/H;\n",
    "mew_r=1+chi;      #relative permeability\n",
    "\n",
    "#Result\n",
    "print \"relative permeability is\",int(mew_r)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.3, Page number 11.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation of material is 1.5 *10**3 A/m\n",
      "flux density is 1.2585 T\n",
      "answer given 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",
    "H=10**6;  #magnetic field(amp/m)\n",
    "chi=1.5*10**-3;\n",
    "mew0=4*math.pi*10**-7;\n",
    "\n",
    "#Calculation\n",
    "M=chi*H;     #magnetisation of material(A/m)\n",
    "B=mew0*(M+H);     #flux density(T)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation of material is\",M/10**3,\"*10**3 A/m\"\n",
    "print \"flux density is\",round(B,4),\"T\"\n",
    "print \"answer given in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.4, Page number 11.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation of material is 37.0 A/m\n",
      "flux density is 0.0126 wb/m**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "H=10**4;  #magnetic field(amp/m)\n",
    "chi=3.7*10**-3;\n",
    "mew0=4*math.pi*10**-7;\n",
    "\n",
    "#Calculation\n",
    "M=chi*H;     #magnetisation of material(A/m)\n",
    "B=mew0*(M+H);     #flux density(T)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation of material is\",M,\"A/m\"\n",
    "print \"flux density is\",round(B,4),\"wb/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.5, Page number 11.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment is 7.854 *10**-3 Am**2\n",
      "answer given 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",
    "r=5*10**-2      #radius(m)\n",
    "I=500*10**-3;    #current(A)\n",
    "\n",
    "#Calculation\n",
    "A=2*math.pi*r**2;\n",
    "mew_m=I*A;     #magnetic moment(Am**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetic moment is\",round(mew_m*10**3,3),\"*10**-3 Am**2\"\n",
    "print \"answer given in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.6, Page number 11.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in magnetic moment is 3.943 *10**-29 Am**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "r=5.29*10**-11;     #radius(m)\n",
    "B=2;     #magnetic field(T)\n",
    "e=1.602*10**-19;   #charge(c)\n",
    "m=9.108*10**-31;    #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "mew_ind=e**2*r**2*B/(4*m);      #change in magnetic moment(Am**2)\n",
    "\n",
    "#Result\n",
    "print \"change in magnetic moment is\",round(mew_ind*10**29,3),\"*10**-29 Am**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.7, Page number 11.21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "susceptibility is 3.267 *10**-4\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "chi1=2.8*10**-4;     #susceptibility\n",
    "T1=350;          #temperature(K)\n",
    "T2=300;          #temperature(K)\n",
    "\n",
    "#Calculation\n",
    "chi2=chi1*T1/T2;     #susceptibility\n",
    "\n",
    "#Result\n",
    "print \"susceptibility is\",round(chi2*10**4,3),\"*10**-4\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.8, Page number 11.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment is 0.61 mewB\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Bs=0.65;      #magnetic induction(wb/m**2)\n",
    "d=8906;       #density(kg/m**3)\n",
    "n=6.025*10**26;     #avagadro number\n",
    "mew0=4*math.pi*10**-7;\n",
    "w=58.7;     #atomic weight(kg)\n",
    "\n",
    "#Calculation\n",
    "N=d*n/w;     #number of nickel atoms(per m**3)\n",
    "mew_m=Bs/(N*mew0*9.27*10**-24);     #magnetic moment(mewB)\n",
    "\n",
    "#Result\n",
    "print \"magnetic moment is\",round(mew_m,2),\"mewB\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.9, Page number 11.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature is 3.9 K\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mew=9.4*10**-24;    \n",
    "H=2;      #magnetic field(weber/m**2)\n",
    "k=1.38*10**-23;     #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "T=2*mew*H/(math.log(2)*k);    #temperature(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature is\",round(T,1),\"K\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.10, Page number 11.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment per gram 1966.851 Am**2\n",
      "magnetic moment per gram is 2.4716 Wb/m**2\n",
      "answer given 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",
    "d=7.8*10**3;    #density(kg/m**3)\n",
    "n=6.025*10**26;    #number of atoms\n",
    "w=157.26;     #atomic weight(kg)\n",
    "mewm=9.27*10**-24;\n",
    "mew=7.1*mewm;\n",
    "mew0=4*math.pi*10**-7;\n",
    "\n",
    "#Calculation\n",
    "N=d*n/w;       #number of atoms\n",
    "mew_B=N*mew/10**3;     #magnetic moment per gram(Am**2)\n",
    "Bs=N*mew0*mew;\n",
    "\n",
    "#Result\n",
    "print \"magnetic moment per gram\",round(mew_B,3),\"Am**2\"\n",
    "print \"magnetic moment per gram is\",round(Bs,4),\"Wb/m**2\"\n",
    "print \"answer given in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.11, Page number 11.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "critical field is 0.02166 Tesla\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Tc=3.7;     #temperature(K)\n",
    "Hc0=0.0306;    #critical field(T)\n",
    "T=2;      #temperature(K)\n",
    "\n",
    "#Calculation\n",
    "Hc2=Hc0*(1-(T/Tc)**2);      #critical field(T)\n",
    "\n",
    "#Result\n",
    "print \"critical field is\",round(Hc2,5),\"Tesla\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.12, Page number 11.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "critical current is 134.33 A\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Tc=7.18;     #temperature(K)\n",
    "H0=6.5*10**4;    #critical field(T)\n",
    "T=4.2;      #temperature(K)\n",
    "d=1*10**-3;    #diameter(m)\n",
    "\n",
    "#Calculation\n",
    "Hc=H0*(1-(T/Tc)**2);      #critical field(T)\n",
    "ic=math.pi*d*Hc;       #critical current(A)\n",
    "\n",
    "#Result\n",
    "print \"critical current is\",round(ic,2),\"A\"\n",
    "print \"answer given in the book is wrong\""
   ]
  }
 ],
 "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
}