{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#7: Magnetic properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.1, Page number 7.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "flux density is 0.628 Wb/m**2\n",
      "magnetic moment is -2.0 A/m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "chi=-0.4*10**-5;      #magnetic susceptibility\n",
    "H=5*10**5;      #magnetic field(A/m)\n",
    "mew0=4*math.pi*10**-7;    \n",
    "\n",
    "#Calculation\n",
    "B=mew0*H*(1+chi);     #flux density(Wb/m**2)\n",
    "M=chi*H;      #magnetic moment(A/m)\n",
    "\n",
    "#Result\n",
    "print \"flux density is\",round(B,3),\"Wb/m**2\"\n",
    "print \"magnetic moment is\",M,\"A/m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.2, Page number 7.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation is -0.25 *10**-2 A/m\n",
      "flux density is 1.257 *10**-3 Wb/m**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "chi=-0.25*10**-5;      #magnetic susceptibility\n",
    "H=1000;      #magnetic field(A/m)\n",
    "mew0=4*math.pi*10**-7;    \n",
    "\n",
    "#Calculation\n",
    "M=chi*H;      #magnetisation(A/m)\n",
    "B=mew0*(H+M);     #flux density(Wb/m**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation is\",M*10**2,\"*10**-2 A/m\"\n",
    "print \"flux density is\",round(B*10**3,3),\"*10**-3 Wb/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.3, Page number 7.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation is 3500 A/m\n",
      "flux density is 4.71 *10**-3 Wb/m**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "H=250;      #magnetic field(A/m)\n",
    "mewr=15;    #relative permeability\n",
    "mew0=4*math.pi*10**-7;  \n",
    "\n",
    "#Calculation\n",
    "M=H*(mewr-1);      #magnetisation(A/m)\n",
    "B=mew0*(H+M);     #flux density(Wb/m**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation is\",M,\"A/m\"\n",
    "print \"flux density is\",round(B*10**3,2),\"*10**-3 Wb/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.4, Page number 7.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation is -0.42 A/m\n",
      "flux density is 1.256 *10**-3 Wb/m**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "chi=-0.42*10**-3;      #magnetic susceptibility\n",
    "H=1000;      #magnetic field(A/m)\n",
    "mew0=4*math.pi*10**-7;    \n",
    "\n",
    "#Calculation\n",
    "M=chi*H;      #magnetisation(A/m)\n",
    "B=mew0*(H+M);     #flux density(Wb/m**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation is\",M,\"A/m\"\n",
    "print \"flux density is\",round(B*10**3,3),\"*10**-3 Wb/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.5, Page number 7.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment is 3.93 *10**-3 Am**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "r=10/2;     #radius(cm)\n",
    "i=500*10**-3;    #current(A)\n",
    "\n",
    "#Calculation\n",
    "mew=math.pi*(r*10**-2)**2*i;    #magnetic moment(Am**2)\n",
    "\n",
    "#Result\n",
    "print \"magnetic moment is\",round(mew*10**3,2),\"*10**-3 Am**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.6, Page number 7.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetizing force is 201 A/m\n",
      "relative permeability is 17.4\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mew0=4*math.pi*10**-7;    \n",
    "B=0.0044;     #flux density(Wb/m**2)\n",
    "M=3300;      #magnetic moment(A/m)\n",
    "\n",
    "#Calculation\n",
    "H=(B/mew0)-M;    #magnetizing force(A/m)\n",
    "mewr=1+(M/H);    #relative permeability\n",
    "\n",
    "#Result\n",
    "print \"magnetizing force is\",int(H),\"A/m\"\n",
    "print \"relative permeability is\",round(mewr,1)\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.7, Page number 7.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in magnetic moment is 5.705 *10**-29 Am**2\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",
    "r=0.052*10**-9;     #radius(m)\n",
    "B=3;     #flux density(Wb/m**2)\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "delta_mew=e**2*r**2*B/(4*m);     #change in magnetic moment(A m**2)\n",
    "\n",
    "#Result\n",
    "print \"change in magnetic moment is\",round(delta_mew*10**29,3),\"*10**-29 Am**2\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.8, Page number 7.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in magnetic moment is 3.936 *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;     #flux density(Wb/m**2)\n",
    "e=1.6*10**-19;  \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(A m**2)\n",
    "\n",
    "#Result\n",
    "print \"change in magnetic moment is\",round(d_mew*10**29,3),\"*10**-29 Am**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 7.9, Page number 7.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "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",
    "N=10**28;     #number of atoms(per m**3)\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 7.10, Page number 7.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relative permeability is 2153.85\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "B=1.4;     #flux density(Wb/m**2)\n",
    "B0=6.5*10**-4;    #magnetic field(Tesla)\n",
    "\n",
    "#Calculation\n",
    "mewr=B/B0;    #relative permeability\n",
    "\n",
    "#Result\n",
    "print \"relative permeability is\",round(mewr,2)"
   ]
  }
 ],
 "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
}