{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4:Behaviour of Dielectric Materials in ac and dc Fields"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.1,Page No:4.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dielectric constant of argon = 1.0005466\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "alpha      = 1.8*10**-40;           #polarisability of argon in Fm**2\n",
    "e0         = 8.85*10**-12;          #dielectric constant F/m\n",
    "N1         = 6.02*10**23;           #avagadro number in mol**-1\n",
    "x          = 22.4*10**3;            #volume in m**3\n",
    " \n",
    "#formula\n",
    "#er-1=N*p/e0*E=(N/e0)*alpha\n",
    "#calculation\n",
    "N          = N1/float(x);                             #number of argon atoms in per unit volume in cm**3\n",
    "N2         = N*10**6;                                 #number of argon atoms in per unit volume in m**3\n",
    "er         = 1+((N2/float(e0)))*(alpha);              #dielectric constant F/m\n",
    "\n",
    "\n",
    "#result\n",
    "print'dielectric constant of argon = %3.7f'%er;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.2,Page No:4.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "displacement = 1.25e-17 m\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "alpha       = 1.8*10**-40;       #polarisability of argon in F*m^2\n",
    "E           = 2*10**5;           # in V/m\n",
    "z           = 18;\n",
    "e           = 1.6*10**-19;\n",
    " \n",
    " \n",
    "#formula\n",
    "#p=18*e*x\n",
    "#calculation\n",
    "p       = alpha*E;\n",
    "x       = p/float(18*e);           #displacement in m\n",
    "\n",
    "  \n",
    "#result\n",
    "print'displacement = %3.2e'%x,'m';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.3,Page No:4.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "local field of benzene=4.40e+03 V/m\n",
      "local field of water=-1.570e+06 V/m\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "E0    = 300*10**2;                  #local field in V/m\n",
    "P1  = 3.398*10**-7;                 #dipole moment Coulomb/m\n",
    "P2  = 2.124*10**-5;                 #dipole moment Coulomb/m\n",
    "e0  = 8.85*10**-12;                 #permittivity in F/m\n",
    " \n",
    " \n",
    "#formula\n",
    "#E10Ci=E0-(2*Pi/3*e0)\n",
    "#calculation\n",
    "E10C1  = E0-((2*P1)/float(3*e0));       #local field of benzene in V/m\n",
    "E10C2  = E0-((2*P2)/float(3*e0));      #local field of water in V/m\n",
    " \n",
    "#result\n",
    "print'local field of benzene=%3.2e'%E10C1,'V/m';\n",
    "print'local field of water=%3.3e'%E10C2,'V/m';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.4,Page No:4.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "polarisability of benzene = 1.16e-37 F*m**2\n",
      "polarisability of water  = 4.04e-40 F*m**2\n",
      "Note: mistake in textbok,alpha1 value is printed as 1.16*10**-38 instead of 1.16*10**-37\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p1 = 5.12*10**-34;          #p of benzene kg/m**3\n",
    "p2 = 6.34*10**-34;          #p of water kg/m**3\n",
    "e10C1  = 4.4*10**3;         #local field of benzene in V/m\n",
    "e10C2  = 1570*10**3;        #local field of water in V/m\n",
    " \n",
    " \n",
    "#formula\n",
    "#p=alphai*e10Ci\n",
    "#calculation\n",
    "alpha1 = p1/float(e10C1);       #polarisability of benzene in F*m**2\n",
    "alpha2 = p2/float(e10C2);       #polarisability of water in F*m**2\n",
    "  \n",
    "\n",
    "#result\n",
    "print'polarisability of benzene = %3.2e'%alpha1,'F*m**2';\n",
    "print'polarisability of water  = %3.2e'%alpha2,'F*m**2';\n",
    "print'Note: mistake in textbok,alpha1 value is printed as 1.16*10**-38 instead of 1.16*10**-37';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.5,Page No:4.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "polarisation of benzene = 6.80e-07 c/m**2\n",
      "polarisation of water = 4.25e-05. c/m**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "e0     = 8.85*10**-12;          #abslute permitivity in (m**-3)*(kg**-1)*(s**4)*(A**2)\n",
    "E      = 600*10**2;             #strength in V/cm\n",
    "er1    = 2.28;                  #dielectric constant of benzene in coulomb/m\n",
    "er2    = 81;                    #dielectric constant of water in coulomb/m\n",
    "\n",
    "\n",
    "#fomula\n",
    "#p=e0*E*(er-1)\n",
    "#calculation\n",
    "pB     = e0*E*(er1-1);        #polarisation of benzene in c/m**2\n",
    "pW     = e0*E*(er2-1);        #polarisation of water in c/m**2\n",
    " \n",
    "\n",
    "#result\n",
    "print'polarisation of benzene = %3.2e'%pB,'c/m**2';\n",
    "print'polarisation of water = %3.2e.'%pW,'c/m**2';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.6,Page No:4.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "percentage contribution from ionic polaristion = 59.82 %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "er0  = 5.6;              #static dielectric cnstant of NaCl \n",
    "n    = 1.5;               #optical index of refraction\n",
    " \n",
    "\n",
    "#calculation\n",
    "er = er0-n**2;\n",
    "d  = ((er/float(er0))*100);   #percentage contribution from ionic polaristion in %\n",
    " \n",
    "#result \n",
    "print'percentage contribution from ionic polaristion = %3.2f'%d,'%';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.7,Page No:4.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "separation=1.69e-17 m\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "alpha       = 0.18*10**-40;         #polarisability of He in F *m**2\n",
    "E           = 3*10**5;               #constant in V/m\n",
    "N           = 2.6*10**25;            #number of atoms in per m**3\n",
    "e           = 1.6*10**-19;\n",
    " \n",
    " \n",
    "#formula\n",
    "#P=N*p\n",
    "#charge of He=2*electron charge\n",
    "#p=2(e*d)\n",
    "#calculation\n",
    "P      = N*alpha*E;                   #in coul/m**2\n",
    "p      = P/float(N);                  #polarisation of He in coul.m\n",
    "d      = p/float(2*e);                #separation between charges in m\n",
    " \n",
    " \n",
    "#result \n",
    "print'separation=%3.2e'%d,'m';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Example 4.8,Page No:4.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "oriental polarisation=9.66e-08 coul/m**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "N      = 10**27;                     #number of HCl molecules in molecules/m**3\n",
    "E      = 10**5;                      #electric field in V/m\n",
    "P      = 1.04*3.33*10**-30;          #permanent dipole moment in coul.m\n",
    "T      = 300;                        #temperature in kelvin\n",
    "K      = 1.38*10**-23;\n",
    " \n",
    " \n",
    "#calculation\n",
    "P0     = (N*(P**2)*E)/float(3*K*T);        #oriental polarisation in coul/m^2\n",
    "\n",
    " \n",
    "#result\n",
    "print'oriental polarisation=%3.2e'%P0,'coul/m**2';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Example 4.9,Page No:4.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relative dielectric constant =1.0\n",
      " Note: calculation mistake in text book in calculating relative dielectric constant\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "N      = 6.023*10**26;      #avagadro number  (lb-mol)**-1\n",
    "alpha  = 3.28*10**-40;      #polarisability in F*m**2\n",
    "M      = 32;               #molecular weight in kilograms\n",
    "p      = 2.08*10**3;        #density of sulphur in g/cm**3\n",
    "e0     = 8.85*10**12;       #permitivity in F/m\n",
    "\n",
    "#calculation\n",
    "er = ((2*N*p*alpha)+(3*M*e0))/float((3*M*e0)-(N*p*alpha));          \n",
    "\n",
    "#result\n",
    "\n",
    "print'relative dielectric constant =%3.1f'%er;\n",
    "print' Note: calculation mistake in text book in calculating relative dielectric constant';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.10,Page No:4.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of electronic and ionic probabilities =1.6\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "er         = 4.94;\n",
    "n          = 1.64;\n",
    "\n",
    "\n",
    "#calculation\n",
    "#(alphae)/(alphai) =x\n",
    "x       = ((er-1)/float(er+2))*(((n**2)+2)/float((n**2)-1));    #ratio of electronic and ionic probabilities\n",
    "\n",
    "\n",
    "#result\n",
    "print'ratio of electronic and ionic probabilities =%3.1f'%x;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.11,Page No:4.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dielectric constant=16.43\n",
      "electrical suseptibility=1.3711e-10 c**2*N**-1*M**-2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declartion\n",
    "E      = 1.46*10**-10;             #permitivity in c**2*N**-1*m**-2\n",
    "E0      = 8.885*10**-12;           #permitivity in c**2*N**-1*m**-2\n",
    "\n",
    "\n",
    "#calculation\n",
    "Er         = E/float(E0);\n",
    "sighe      = E0*(Er-1);         #electrical suseptbility in c**2*N**-1*M**-2\n",
    " \n",
    " \n",
    "#result\n",
    "print'dielectric constant=%3.2f'%Er;\n",
    "print'electrical suseptibility=%3.4e'%sighe,'c**2*N**-1*M**-2';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.12,Page No:4.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "polarisation=8.4e-07 cm**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "r       = 0.1;                    #radius in  m\n",
    "pw      = 1;                     #density of water in  g/ml\n",
    "Mw      = 18;                    # molecular mass of water \n",
    "E       = 6.0*10**-30;           #dipole moment of water in cm\n",
    "N       = 6.0*10**26;           #avagadro constant in (lb-mol)−1\n",
    " \n",
    " \n",
    "#calculation\n",
    "n  = N*(4*(math.pi)*(r**3)*pw)/(Mw*3);      #number of water molecules in a water drop \n",
    "p  = n*E;                               #polarisation in cm**2\n",
    "\n",
    "\n",
    "#result\n",
    "print'polarisation=%3.1e'%p,'cm**2';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.13,Page No:4.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dielectric susceptibility=0.000074\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Er     = 1.000074;                 #dielectric constant for a gas at 0°C\n",
    "\n",
    "\n",
    "#calculation\n",
    "sighe      = Er-1;               #dielectric susceptibility\n",
    " \n",
    " \n",
    "#result\n",
    "print'dielectric susceptibility=%3.6f'%sighe;\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.14,Page No:4.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "free charge=2.65e-05 Coul/m**2\n",
      "polarisation=5.31e-05 Coul/m\n",
      "displacement=7.96e-05\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "E        = 10**6;               #dielectric in volts/s\n",
    "er       = 3;                  #dielectric in mm\n",
    "e0       = 8.85*10**-12;\n",
    "\n",
    "\n",
    "#calculation\n",
    "E0      = er*E;                  #electric field in V/m\n",
    "sigma   = e0*E0;                 #free charge in Coul/m^2\n",
    "P       = e0*(er-1)*E0;          #polarisation in coul/m\n",
    "D       = e0*er*E0;              #displacement in in dielectric\n",
    " \n",
    " \n",
    "#result\n",
    "print'free charge=%3.2e'%sigma,'Coul/m**2';\n",
    "print'polarisation=%3.2e'%P,'Coul/m';\n",
    "print'displacement=%3.2e'%D; "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.15,Page No:4.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "capacitance = 3.42e-11 Farad\n",
      "charge =3.42e-10 coulomb\n",
      "displacement =5.31e-07 c/m**2\n",
      "polarisation =4.42e-07 c/m**2\n",
      "Note:error in calculation of P,E value is taken as 5000 instead of 10**4\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "d     = 1.0*10**-3;             #separation between plates in m\n",
    "A     = 6.45*10**-4;            # surface area in m^2\n",
    "e0     = 8.85*10**-12;          #permitivity of electron in (m**-3)*(kg**-1)*(s**4)*(A**2)\n",
    "er    = 6.0;                    #relative permitivity in (m**-3)*(kg**-1)*(s**4)*(A**2)\n",
    "V     = 10;                     #voltage in V\n",
    "E     = 10;                    \n",
    " \n",
    " \n",
    "#calculation\n",
    "C      = (e0*er*A)/float(d);             #capacitance in Farad\n",
    "q      = C*V;                            #charge in coulomb\n",
    "D      = (e0*er*E)/float(10**-3);        #displacement vector in c/m**2\n",
    "P      = D-(e0*E/float(10**-3));         #polarisation vector in c/m**2\n",
    "\n",
    "\n",
    "#result\n",
    "print'capacitance = %3.2e'%C,'Farad';\n",
    "print'charge =%3.2e'%q,'coulomb';\n",
    "print'displacement =%3.2e'%D,'c/m**2';\n",
    "print'polarisation =%3.2e'%P,'c/m**2';\n",
    "print'Note:error in calculation of P,E value is taken as 5000 instead of 10**4\\n';\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Example 4.16,Page No:4.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency = 8.84 KHz\n",
      "phase difference = 45 °\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "t       = 18*10**-6;            #relaxation time in s\n",
    "er1     = 1;                   #permitivity in F/m\n",
    "er      = 1;                   #permitivity in F/m\n",
    "t       = 18*10**-6;            #relaxation time in s\n",
    " \n",
    "#calculation\n",
    "f                = 1/float(2*math.pi*t);               #frequency in Hz\n",
    "theta_c          = math.atan(er1/float(er));\n",
    "#theta_c_deg      = (theta_c*180)/float(math.pi);\n",
    "#phi              = 90-theta_c_deg;             #phase difference in degrees\n",
    " \n",
    " \n",
    "#result\n",
    "print'frequency = %3.2f'%(f*10**-3),'KHz';\n",
    "print'phase difference =%3.0f'%((theta_c*180)/float(math.pi)),'°';\n",
    " "
   ]
  }
 ],
 "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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}