{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 14: Magnetism"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page number 420"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation is 20 *10**9 A/m\n",
      "flux density is 1.2818 *10**6 T\n",
      "answer for flux density given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "mew0=4*math.pi*10**-7;     #permeability of vacuum\n",
    "H=10**12;                  #magnetic field intensity(A/m)\n",
    "chi=20*10**-3;             #susceptibility\n",
    "\n",
    "#Calculations\n",
    "M=chi*H;                   #magnetisation(A/m)\n",
    "B=mew0*(M+H);              #flux density(T)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation is\",int(M/10**9),\"*10**9 A/m\"\n",
    "print \"flux density is\",round(B/10**6,4),\"*10**6 T\"\n",
    "print \"answer for flux density given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page number 420"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetisation is 17725 A/m\n",
      "answer for magnetisation given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "mew0=4*math.pi*10**-7;     #permeability of vacuum\n",
    "H=10**2;                  #magnetic field intensity(A/m)\n",
    "B=0.0224;                  #flux density(T)\n",
    "\n",
    "#Calculations\n",
    "M=(B/mew0)-H;              #magnetisation(A/m)\n",
    "\n",
    "#Result\n",
    "print \"magnetisation is\",int(M),\"A/m\"\n",
    "print \"answer for magnetisation given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page number 421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in magnetic moment is 5.27 *10**-29 Am**2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "e=1.6*10**-19;             #charge(coulomb)\n",
    "r=5*10**-11;               #radius(m)\n",
    "B=3;                       #flux density(T)\n",
    "m=9.1*10**-31;             #mass(kg)\n",
    "\n",
    "#Calculations\n",
    "mew=B*e**2*r**2/(4*m);     #change in magnetic moment(Am**2)\n",
    "\n",
    "#Result\n",
    "print \"change in magnetic moment is\",round(mew*10**29,2),\"*10**-29 Am**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page number 421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "susceptibility is 0.8 *10**-4\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "T1=200;          #temperature(K)\n",
    "T2=300;          #temperature(K)\n",
    "chi1=1.2*10**-4; #susceptibility\n",
    "\n",
    "#Calculations\n",
    "chi2=T1*chi1/T2;    #susceptibility\n",
    "\n",
    "#Result\n",
    "print \"susceptibility is\",chi2*10**4,\"*10**-4\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page number 422"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "paramagnetisation is 3.6 *10**2 A/m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "H=10**5;                  #magnetic field intensity(A/m)\n",
    "chi=3.6*10**-3;            #susceptibility\n",
    "\n",
    "#Calculations\n",
    "M=chi*H;                   #paramagnetisation(A/m)\n",
    "\n",
    "#Result\n",
    "print \"paramagnetisation is\",M/10**2,\"*10**2 A/m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6, Page number 422"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment is 5.655 *10**-24 Am**2\n",
      "saturation magnetic induction is 6.5 *10**-4 T\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "mew0=4*math.pi*10**-7;     #permeability of vacuum\n",
    "mewB=9.27*10**-24;         \n",
    "rho=8906;                  #density(kg/m**3)\n",
    "N=6.023*10**23;            #avagadro number\n",
    "W=58.7;                    #atomic weight\n",
    "\n",
    "#Calculations\n",
    "mewM=0.61*mewB;            #magnetic moment(Am**2)\n",
    "B=rho*N*mew0*mewM/W;       #saturation magnetic induction(T)\n",
    "\n",
    "#Result\n",
    "print \"magnetic moment is\",round(mewM*10**24,3),\"*10**-24 Am**2\"\n",
    "print \"saturation magnetic induction is\",round(B*10**4,1),\"*10**-4 T\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 7, Page number 423"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diamagnetic susceptibility is -8.249 *10**-8\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "mew0=4*math.pi*10**-7;     #permeability of vacuum\n",
    "e=1.6*10**-19;             #charge(coulomb)\n",
    "m=9.1*10**-31;             #mass(kg)\n",
    "R=0.5*10**-10;             #radius(m)\n",
    "N=28*10**26;               #number of atoms\n",
    "Z=2;                       #atomic number\n",
    "\n",
    "#Calculations\n",
    "chi_dia=-mew0*Z*e**2*N*R**2/(6*m);    #diamagnetic susceptibility\n",
    "\n",
    "#Result\n",
    "print \"diamagnetic susceptibility is\",round(chi_dia*10**8,3),\"*10**-8\""
   ]
  }
 ],
 "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
}
