{
 "metadata": {
  "name": "",
  "signature": "sha256:237766aed9f535966fc748c815f41de623178c7900cce0f2887b456d4abe99e9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 3: Electricity and its Fundamental Laws<h1>"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.1: Page 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "V = 230;    #  in  volts\n",
      "I = 10;     #  in  A\n",
      "\n",
      "# calculations:\n",
      "R = V/I;\n",
      "\n",
      "#Results\n",
      "print \"resistance  of  element,R =\", R,\"ohm\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resistance  of  element,R = 23.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.2: Page 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "R1 = 0.5;   #  minimum  value  of  resistance  in  ohm\n",
      "R2 = 20;    #  maximum  value  of  resistance  in  ohm\n",
      "I  = 1.2;   #  current  in  A\n",
      "\n",
      "#Calculation\n",
      "V1 = I*R1;\n",
      "V2 = I*R2;\n",
      "\n",
      "#Results\n",
      "print  \"Voltage  drop  in  Ist  case,V1(V)=\",V1,\"volts and voltage  drop  in  IInd  case,V2(V)=\", V2,\"volts\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage  drop  in  Ist  case,V1(V)= 0.6 volts and voltage  drop  in  IInd  case,V2(V)= 24.0 volts\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.3: Page 48"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "L  = 1000;  #  length  of  wire  in  cm\n",
      "d  = 0.14;  #  diameter  of  wire  in  cm\n",
      "R1 = 2.5*10**6;#  resistance  in  micro-ohm\n",
      "\n",
      "# calculations:\n",
      "a  = (math.pi*d**2)/4;  #  cross  section  area\n",
      "p  = (R1*a)/L;\n",
      "\n",
      "#Results\n",
      "print  \"the  specific  resistance,p =\", round(p,1),\" uOhm-cm\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the  specific  resistance,p = 38.5  uOhm-cm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.4: Page 49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "Rt1  = 54.3;#    resistance  in  ohm\n",
      "alfa = 0.0043;#  the  resistance  temperature  of  coeficient  in  per  degree  celcius\n",
      "t1   = 20;#  temperature  in  degree  celcius\n",
      "t2   = 40;#  temperature  in  degree  celcius\n",
      "\n",
      "# calculations\n",
      "Rt2  = (Rt1*(1+(alfa*t2)))/(1+(alfa*t1));\n",
      "\n",
      "#Results\n",
      "print  \"resistance  at  40 degC ,Rt2=\", Rt2,\" ohms\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resistance  at  40 degC ,Rt2= 58.6  ohms\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.5: Page 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "r1=30;#    resistance  in  ohm\n",
      "r2=35;#    resistance  in  ohm\n",
      "r3=45;#    resistance  in  ohm\n",
      "V=220;\n",
      "\n",
      "# calculations:\n",
      "R=r1+r2+r3;\n",
      "I=V/R;\n",
      "\n",
      "#Results\n",
      "print  \"(a)total  resistance,R=\", R,\" ohm\"\n",
      "print  \"(b)current,I=\", I,\"A\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)total  resistance,R= 110  ohm\n",
        "(b)current,I= 2.0 A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.6: Page 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "I=75;#  current  in  A\n",
      "R=0.15;#  resistance  in  ohm\n",
      "v=220;#  voltage  in  volts\n",
      "\n",
      "#calculations\n",
      "V1=I*R;#  voltage  drop  of  the  feeder  in  section  AB\n",
      "V2=I*R;#  voltage  drop  of  the  feeder  in  section  CD\n",
      "V_total=V1+V2;#  total  voltage  drop  in  the  lead  and  return  feeder\n",
      "V=v+V_total;\n",
      "\n",
      "#Results\n",
      "print  \"voltage  at  the  generating  station,V=\", V,\"volts\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage  at  the  generating  station,V= 242.5 volts\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.7: Page 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "r1=6;#    resistance  in  ohm\n",
      "r2=10;#    resistance  in  ohm\n",
      "r3=15;#    resistance  in  ohm\n",
      "\n",
      "#calculations:\n",
      "r=(1/r1)+(1/r2)+(1/r3);\n",
      "R=1/r;\n",
      "\n",
      "#Results\n",
      "print  \"equivalent  resistance,R=\", R,\"ohm\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "equivalent  resistance,R= 3.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.8: Page 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "I=5;  #  current  in  A\n",
      "n=2;  #  number  of  resistance  in  parallel  of  section  BC\n",
      "r1=15;#    resistance  in  ohm\n",
      "r2=20;#    resistance  in  ohm\n",
      "r3=60;#    resistance  in  ohm\n",
      "r4=64;#    resistance  in  ohm\n",
      "r5=64;#    resistance  in  ohm\n",
      "r6=2.5;#    resistance  in  ohm\n",
      "\n",
      "#calculation\n",
      "R1=r4/n;#  equivalent  resistance  of  section  BC\n",
      "R2=(r1*r2*r3)/((r1*r2)+(r2*r3)+(r3*r1));#  equivalent  resistance  of  section  CD\n",
      "R=R1+R2+r6;#  equivalent  resistance  of  section  AD\n",
      "V=I*R;\n",
      "\n",
      "#Results\n",
      "print  \"voltage,V= \", V,\"volts\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage,V=  210.0 volts\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.9: Page 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "V=240;#  voltage  in  volts\n",
      "r1=2;#  resistance  in  ohm\n",
      "r2=3;#  resistance  in  ohm\n",
      "r3=8.8;#  resistance  in  ohm\n",
      "r4=10;#  resistance  in  ohm\n",
      "r5=3;#  resistance  in  ohm\n",
      "\n",
      "# calculations:\n",
      "R1=(r1*r2)/(r1+r2);#  equivalent  resistance  of  parallel  branch\n",
      "R2=R1+r3;#  equivalent  resistance  of  section  ABC\n",
      "R3=(R2*r4)/(R2+r4);\n",
      "R=R3+r5;#  total  resistance  of  section  AD\n",
      "I=V/R;\n",
      "V1=I*r5;#  voltage  drop  across  r5\n",
      "V2=V-V1;#  voltage  drop  across  section  ABC\n",
      "I1=V2/r4;#  current  flowing  through  r4  resistance\n",
      "I2=I-I1;#  current  in  r3  resistance\n",
      "V3=I2*r3;#  voltage  drop  across  r3  resistance,  section  ABC\n",
      "V4=V2-V3;#  voltage  drop  between  section  AB\n",
      "I3=V4/r1;#  current  flowing  through  r1  resistance\n",
      "I4=V4/r2;#    current  flowing  through  r2  resistance\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing  through  r1  (2  ohms)  resistance,I3  =\", I3,\" A\"\n",
      "print  \"current  flowing  through  r2  (3  ohms)resistance,I4    =\", I4,\" A\"\n",
      "print  \"total  resistance,R  =  \", R,\" ohm\"\n",
      "print  \"voltage  drop  across  r5(3  ohms)  resistance,V1  =\", V1,\" volts\"\n",
      "print  \"voltage  drop  across  section  ABC,V2  =  \", V2,\" volts\"\n",
      "print  \"voltage  drop  across  r3  resistance(8.8  ohms),V3  =  \",V3,\" Volts\"\n",
      "print  \"  voltage  drop  between  section  AB,V4  =  \", V4,\"volts\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing  through  r1  (2  ohms)  resistance,I3  = 9.0  A\n",
        "current  flowing  through  r2  (3  ohms)resistance,I4    = 6.0  A\n",
        "total  resistance,R  =   8.0  ohm\n",
        "voltage  drop  across  r5(3  ohms)  resistance,V1  = 90.0  volts\n",
        "voltage  drop  across  section  ABC,V2  =   150.0  volts\n",
        "voltage  drop  across  r3  resistance(8.8  ohms),V3  =   132.0  Volts\n",
        "  voltage  drop  between  section  AB,V4  =   18.0 volts\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.10: Page 54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "I=44;#  current  in  A\n",
      "r1=6;#  resistance  in  ohm\n",
      "r2=12;#  resistance  in  ohm\n",
      "r3=18;#  resistance  in  ohmr1\n",
      "\n",
      "# calculation:\n",
      "a=(1/r1)+(1/r2)+(1/r3);\n",
      "R=1/a;\n",
      "V=I*R;\n",
      "i1=V/r1;\n",
      "i2=V/r2;\n",
      "i3=V/r3;\n",
      "\n",
      "#Results\n",
      "print  \"current  in  6  ohm  resistance,i1  =  \",i1,\"A\" \n",
      "print  \"current  in  12  ohm  resistance,i2 =  \",i2,\"A\"\n",
      "print  \"current  in  18  ohm  resistance,i3 =  \",i3,\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  in  6  ohm  resistance,i1  =   24.0 A\n",
        "current  in  12  ohm  resistance,i2 =   12.0 A\n",
        "current  in  18  ohm  resistance,i3 =   8.0 A\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.11: Page 55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given:\n",
      "t=15  #TOTAL  CURRENT  IN  AMPERES\n",
      "i1=2  #CURRENT  THROUGH  UNKNOWN  RESISTANCE\n",
      "R1=15#in  ohms\n",
      "R2=50/2#in  ohms\n",
      "\n",
      "# calculations:\n",
      "x=(t-i1)*((R1*R2)/(R1+2*R2))#unknown  resistance  in  ohms)\n",
      "PD=i1*x#in  volts\n",
      "RX=((1/R1)+(1/(2*R2))+(1/x))#\n",
      "R=1/RX\n",
      "i5=  PD/(2*R2)#current  in  5  ohms  resistance\n",
      "i15=PD/R1#current  in  15  ohms  resistance\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"(a)unknown  resistance  in  ohms =\", x\n",
      "print  \"(b)potential  drop  across  the  circuit  in  volts  is =\", PD\n",
      "print  \"(c)current  in  5  ohms  resistance  in  ampere =\",i5,\"\\n and current  in  15  ohms  resistance  in  ampere =\", i15\n",
      "print  \"(d)total  resistance  of  the  circuit  in  ohms =\",R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)unknown  resistance  in  ohms = 75.0\n",
        "(b)potential  drop  across  the  circuit  in  volts  is = 150.0\n",
        "(c)current  in  5  ohms  resistance  in  ampere = 3.0 \n",
        " and current  in  15  ohms  resistance  in  ampere = 10.0\n",
        "(d)total  resistance  of  the  circuit  in  ohms = 10.0\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}