{
 "metadata": {
  "name": "",
  "signature": "sha256:50315b4dee267422712255a4580dea3156e39933e372f17694b3cb35adb8e098"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "4: Capacitors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.1, Page number 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "r=6750*10**3;    #radius of earth(m)\n",
      "#let x=4*pi*epsilon0\n",
      "x=1/(9*10**9);  \n",
      "\n",
      "#Calculation\n",
      "C=x*r;    #capacitance(F)\n",
      "C=C*10**6;    #capacitance(micro F)\n",
      "\n",
      "#Result\n",
      "print \"capacitance is\",C,\"micro F\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "capacitance is 750.0 micro F\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.2, Page number 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "C1=20*10**-6;    #capacitance(F)\n",
      "V1=500;    #potential(V)\n",
      "C2=10*10**-6;   #capacitance(F)\n",
      "V2=200;    #potential(V)\n",
      "\n",
      "#Calculation\n",
      "q1=C1*V1;   #charge on 1st capacitor(C)\n",
      "q2=C2*V2;   #charge on 2nd capacitor(C)\n",
      "C=C1+C2;   #resultant capacitance(C)\n",
      "V=(q1+q2)/C;   #combined potential(V)\n",
      "\n",
      "#Result\n",
      "print \"combined potential is\",V,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "combined potential is 400.0 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.3, Page number 92"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "Cp=5;   #resultant capacitance in parallel(micro F)\n",
      "Cs=1.2;   #resultant capacitance in series(micro F)\n",
      "\n",
      "#Calculation\n",
      "C1C2=Cp*Cs;    #product of capacitance(micro F)\n",
      "C1_C2=math.sqrt((Cp**2)-(4*C1C2));    #difference of capacitance(micro F)\n",
      "twoC1=Cp+C1_C2;   \n",
      "C1=twoC1/2;   \n",
      "twoC2=Cp-C1_C2;\n",
      "C2=twoC2/2;\n",
      "\n",
      "#Result\n",
      "print \"values of capacitors are\",C1,\"micro F and\",C2,\"micro F\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "values of capacitors are 3.0 micro F and 2.0 micro F\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.4, Page number 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "C=0.2*10**-6;   #capacitance(F)\n",
      "V=2;   #potential(V)\n",
      "\n",
      "#Calculation\n",
      "U=(1/2)*C*(V**2);    #energy stored(J)\n",
      "\n",
      "#Result\n",
      "print \"energy stored is\",U,\"J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy stored is 4e-07 J\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.5, Page number 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "A=1;   #area of plates(m**2)\n",
      "k=7;   #dielectric constant\n",
      "d=0.01*10**-2;   #distance between plates(m)\n",
      "V=300;    #potential(V)\n",
      "epsilon0=8.85*10**-12;   #dielectric permittivity of free space\n",
      "\n",
      "#Calculation\n",
      "C=k*epsilon0*A/d;    #capacitance(F)\n",
      "E=(1/2)*C*(V**2);    #energy stored in capacitor(J)\n",
      "\n",
      "#Result\n",
      "print \"energy stored in capacitor is\",round(E*10**3,3),\"*10**-3 J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy stored in capacitor is 27.877 *10**-3 J\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.6, Page number 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "A=2;    #area(m**2)\n",
      "d=1*10**-2;   #distance(m)\n",
      "V0=6000;   #potential(V)\n",
      "V=2000;    #potential(V)\n",
      "epsilon0=8.85*10**-12;   #dielectric permittivity of free space\n",
      "\n",
      "#Calculation\n",
      "C0=epsilon0*A/d;    #capacitance when there is no dielectric(F)\n",
      "Q=C0*V0;    #charge on each plate(C)\n",
      "C=Q/V;      #capacitance when there is dielectric(F)\n",
      "k=C/C0;   #dielectric constant\n",
      "E0=V0/d;   #electric field intensity with air medium(V/m)\n",
      "E=V/d;    #electric field intensity with dielectric(V/m)\n",
      "\n",
      "#Result\n",
      "print \"capacitance when there is no dielectric is\",C0*10**9,\"nF\"\n",
      "print \"charge on each plate is\",Q,\"C\"\n",
      "print \"capacitance when there is dielectric is\",C*10**9,\"nF\"\n",
      "print \"dielectric constant is\",k\n",
      "print \"electric field intensity with air medium is\",E0/10**5,\"*10**5 V/m\"\n",
      "print \"electric field intensity with dielectric is\",E/10**5,\"*10**5 V/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "capacitance when there is no dielectric is 1.77 nF\n",
        "charge on each plate is 1.062e-05 C\n",
        "capacitance when there is dielectric is 5.31 nF\n",
        "dielectric constant is 3.0\n",
        "electric field intensity with air medium is 6.0 *10**5 V/m\n",
        "electric field intensity with dielectric is 2.0 *10**5 V/m\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 4.7, Page number 95"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "k=5.4;   #dielectric constant\n",
      "E=10**6;   #electric field intensity(V/m)\n",
      "A=50*10**-4;   #area(m**2)\n",
      "epsilon0=8.85*10**-12;   #dielectric permittivity of free space\n",
      "d=5*10**-3;   #distance(m)\n",
      "\n",
      "#Calculation\n",
      "u=(1/2)*k*epsilon0*(E**2);    #energy density(J/m**3)\n",
      "\n",
      "#Result\n",
      "print \"energy density is\",u,\"J/m**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy density is 23.895 J/m**3\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}