{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Capter 19: Magnetic Materials"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.1, page no-541"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Relative permiability and magnetic force\n",
      "\n",
      "import math\n",
      "#Variable Declaration\n",
      "M=2300.0                            # Magnetization\n",
      "B=0.00314                           # Flux density\n",
      "\n",
      "#Calculation\n",
      "mu=4*math.pi*10**-7\n",
      "H=(B/mu)-M\n",
      "mur=(M/H)+1\n",
      "\n",
      "#Result\n",
      "print('The magnetic force H is %.4f A/m and the relative permeability mu_r is %.5f'%(H,mur))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnetic force H is 198.7326 A/m and the relative permeability mu_r is 12.57334\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.2, page no-542"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# magnetisation and flux density\n",
      "\n",
      "import math\n",
      "#Variable Declaration\n",
      "H=10**4                                   # Magnetic field intensity\n",
      "sus=3.7*10**-3                            # Susceptibility\n",
      "mu=4*math.pi*10**-7                       # permeability of free space\n",
      "\n",
      "#Calculation\n",
      "M=sus*H\n",
      "B=mu*(M+H)\n",
      "\n",
      "#Result\n",
      "print('The magnetisation in the material is %.0f A/m and flux density in the material is %.2f * 10^-2 Wb.m^-2'%(M,B*10**2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnetisation in the material is 37 A/m and flux density in the material is 1.26 * 10^-2 Wb.m^-2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.3, page no-542"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Flux density in a material\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "H=10**4                      # Magnetic field intensity \n",
      "sus=-0.8*10**-5              # susceptibility of copper\n",
      "mu=4*math.pi*10**-7          # permeability of free space\n",
      "\n",
      "#Calculations\n",
      "M=sus*H\n",
      "B=mu*(M+H)\n",
      "\n",
      "#Result\n",
      "print('The flux density in the material is %.2f * 10^-2 Wb.m^-2'%(B*10**2))\n",
      "\n",
      "# Magnetic field intensity: value given in the book is 10^6 but calculations are done with 10^4"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux density in the material is 1.26 * 10^-2 Wb.m^-2\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.4, page no-543"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Permeability \n",
      "\n",
      "import math\n",
      "# Variable declarations\n",
      "H=1800.0                   # Magnetic field intensity\n",
      "fi=3*10**-5                # Magnetic flux\n",
      "A=0.2*10**-4               # Area of cross-section \n",
      "\n",
      "#Calculations\n",
      "B=fi/A\n",
      "mu=B/H\n",
      "\n",
      "#Result\n",
      "print('\\nThe magnetic flux is %.1f Wb/m^2\\nThe permeability is %.3f*10^-4 H/m'%(B,mu*10**4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The magnetic flux is 1.5 Wb/m^2\n",
        "The permeability is 8.333*10^-4 H/m\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.5, page no-544"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Magnetic moment of Nickel\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "B=0.65                           # Magnetic inductionof Nickel\n",
      "r=8906                           # Density of Nickel\n",
      "M=58.7                           # Atomic weight\n",
      "avg=6.023*10**26                 # Avogadro's Number\n",
      "mu=4*math.pi*10**-7              # Permeability of free space\n",
      "k=9.27*10**-24                   # 1 Bohr Magnetron\n",
      "\n",
      "#Calculations\n",
      "N=r*avg/M     \n",
      "mu_m=B/(N*mu)\n",
      "mu_m=mu_m/k\n",
      "\n",
      "#Result\n",
      "print(\"The magnetic moment of nickel atom is %.2f Bohr magneton\"%mu_m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnetic moment of nickel atom is 0.61 Bohr magneton\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.6, page no-545"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Average magnetization contributed per atom\n",
      "\n",
      "import math\n",
      "# Variable declaration\n",
      "a=2.5*10**-10                  # interatomic spacing\n",
      "M=1.8*10**6                    # MAgnetization\n",
      "e=1.6*10**-19                  # charge of an electron\n",
      "\n",
      "#Calculations\n",
      "n=2/a**3\n",
      "m=9.1*10**-31\n",
      "h=6.625*10**-34\n",
      "ma=M/n\n",
      "beta1=e*h/(4*math.pi*m)\n",
      "\n",
      "#Result\n",
      "print(\"The average magnetisation contributed per atom = %.3f Bohr Magneton\"%(ma/beta1))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average magnetisation contributed per atom = 1.517 Bohr Magneton\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.7, page no-545"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Tempoerature using classical statistics\n",
      "\n",
      "import math\n",
      "#Variable declarations\n",
      "mu=9.4*10**-24                   # Permeability \n",
      "H=2                              # MAgnetic field intensity\n",
      "k=1.38*10**-23                   # Bolzmann's constant\n",
      "\n",
      "#Calculations\n",
      "T=2*mu*H/(k*math.log(2))\n",
      "\n",
      "#Result\n",
      "print(\"The temperature of the system T is %.1f K\"%T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature of the system T is 3.9 K\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.8, page no-547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Saturation magnetic field of Gd atom\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "ba=7.1                           # Bohr magnetron per atom\n",
      "aw=1.8*10**6                     # Atomic weight of Gd \n",
      "d=7.8*10**3                      # Density of Gd\n",
      "avg=6.023*10**26                 # Avogadro's Number\n",
      "M=157.26                         # Atomic number of Gd\n",
      "k=9.27*10**-24                   # 1 Bohr magnetron\n",
      "mu=4*math.pi*10**-7              # permeability of free space\n",
      "\n",
      "\n",
      "#Calculations\n",
      "N=d*avg/M\n",
      "mm=N*ba*k\n",
      "B=N*mu*k*7.1\n",
      "\n",
      "#Result\n",
      "print(\"\\nThe saturation magnetic field of Gd atom is %.2f Wb/m^2\"%B)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The saturation magnetic field of Gd atom is 2.47 Wb/m^2\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.9, page no-547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#saturation magnetisation\n",
      "\n",
      "import math\n",
      "# variable ddeclaration\n",
      "bet=9.27*10**-24                    # 1 Bohr magnetron\n",
      "V=0.839*10**-9                      # unit cell edge length\n",
      "\n",
      "#Calculations\n",
      "M=32*bet/V**3\n",
      "\n",
      "#Result\n",
      "print(\"The saturation magnetisation is %.3f *10^5 A/m\"%(M*10**-5))\n",
      "# Answer in the book is given as 5.023 x 10^-5"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The saturation magnetisation is 5.023 *10^5 A/m\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.10, page no-548"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Saturation flux density\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "d=8900                       # Density of Ni\n",
      "wt=58.71                     # Atomic weight\n",
      "avg=6.022*10**26             # Avogadro's Number\n",
      "bet=9.27*10**-24             # 1 Bohr magnetron\n",
      "mu=4*math.pi*10**-7              # permeability of free space\n",
      "\n",
      "#Calculations\n",
      "mm=0.6*bet\n",
      "N=d*avg/wt\n",
      "ms=mm*N\n",
      "bs=mu*ms\n",
      "\n",
      "#Result\n",
      "print(\"\\nThe saturation magnetisation is %.3f *10^5 A/m\\nThe saturation flux density is %.3f Wb/m^2\"%(ms*10**-5,bs))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The saturation magnetisation is 5.077 *10^5 A/m\n",
        "The saturation flux density is 0.638 Wb/m^2\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.11, page no-548"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Saturation magnetisation of gadolinium\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "awt=157.25                  # Atomic weight\n",
      "an=64                       # Atomic number\n",
      "d=7860                      # density\n",
      "k=9.27*10**-24              # 1 Bohr magnetron\n",
      "avg=6.023*10**26            # avogadro's Number\n",
      "\n",
      "#Calculations\n",
      "N=d*8*k*avg/awt\n",
      "\n",
      "# Result\n",
      "print(\"The saturation magnetisation of gadolinium is %.2f*10^6 A/m\"%(N*10**-6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The saturation magnetisation of gadolinium is 2.23*10^6 A/m\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.12, page no-549"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Magnetic flux density inside the material\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "H=1000                       # Magnetic field strength\n",
      "sus=-0.3*10**-5              # magnetic susceptibility\n",
      "mu=4*math.pi*10**-7          # permeability of free space\n",
      "\n",
      "#calculation\n",
      "M=sus*H\n",
      "B=mu*(M+H)\n",
      "B=math.floor(B*10**6)/10**6\n",
      "\n",
      "#Result\n",
      "print(\"The magnetic flux density inside the material is %.3f T or Wb.m^-2\"%(B*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnetic flux density inside the material is 1.256 T or Wb.m^-2\n"
       ]
      }
     ],
     "prompt_number": 67
    }
   ],
   "metadata": {}
  }
 ]
}