{
 "metadata": {
  "name": "",
  "signature": "sha256:31450cb4fbdeff508f73b1f734eeeccc850933334f8ee10004b73433a5bc86e4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Cells and Batteries"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.1: page 166:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "n=20;#  dry  cells  of  emf\n",
      "E=1.5;#  emf  in  volts\n",
      "R=5;  #  external  resistance  in  ohm\n",
      "r=0.5;#  internal  resistance  in  ohm\n",
      "\n",
      "#calculations:\n",
      "I=(n*E)/(R+(n*r));\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",I"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   2.0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.2: Page 167:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "n=10;#  dry  cells  of  emf\n",
      "E=1.5;#  emf  in  volts\n",
      "R=4.9;#  resistance  in  ohm\n",
      "r=1;  #  internal  resistance  in  ohm\n",
      "\n",
      "#calculations:\n",
      "I=(n*E)/((n*R)+(r));\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",I"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   0.3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.3: page 167:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "m=3;  \n",
      "n=10;#  dry  cells  of  emf\n",
      "E=1.5;#  emf  in  volts\n",
      "R=2.5;#  resistance  in  ohm\n",
      "r=0.5;#  internal  resistance  in  ohm\n",
      "\n",
      "#colculations:\n",
      "I=(m*n*E)/((m*R)+(n*r));\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",I"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   3.6\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.4: page 172:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "n=10  #  no.  of  cells\n",
      "Rl=4  #  LOAD  RESISTANCE\n",
      "V=12  #  in  volts\n",
      "Va=18#  IN  VOLTS\n",
      "\n",
      "#calculations:\n",
      "r=((Va-V)*Rl)/(n*V)#  internal  resistance  in  ohms\n",
      "Il=V/Rl#  IN  AMPERES\n",
      "\n",
      "#Results\n",
      "print  \"(a)internal  resistance  in  ohms  is\",r\n",
      "print  \"(b)load  current  in  amperes  is\", Il"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)internal  resistance  in  ohms  is 0.2\n",
        "(b)load  current  in  amperes  is 3.0\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.5: page 173:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "n=6    #  no.  of  cells\n",
      "Rl=3  #  LOAD  RESISTANCE\n",
      "I=2.5#  IN  AMPERES\n",
      "r1=9  #  in  ohms\n",
      "I2=1.25#  om  amperes\n",
      "\n",
      "#calculations:\n",
      "r=((r1*I2)-(Rl*I))/(n*(I-I2))#  internal  resistance  in  ohms\n",
      "E=((I*(Rl+n*r))/n)#  emf  of  each  cell  in  volts\n",
      "\n",
      "#Results\n",
      "print  \"emf  of  each  cell  in  volts  is\", E \n",
      "print  \"internal  resistance  of  each  cell  in  ohms is\",r "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "emf  of  each  cell  in  volts  is 2.5\n",
        "internal  resistance  of  each  cell  in  ohms is 0.5\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.6: page 173:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "I=20  #  in  amperes\n",
      "t=15  #  in  hours\n",
      "\n",
      "#calculations\n",
      "Ah=I*t#  ampere  hour  capacity  of  the  battery\n",
      "\n",
      "#Results\n",
      "print  \"ampere  hour  capacity  of  the  battery  in  A-h is\",Ah "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ampere  hour  capacity  of  the  battery  in  A-h is 300\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.7: page 174:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "I=30  #  in  amperes\n",
      "t=6    #  in  hours\n",
      "Vt=2  #  terminal  voltage\n",
      "Ic=40#  in  amperes\n",
      "tc=5  #  in  hours\n",
      "Vc=2.5#  in  volts\n",
      "\n",
      "#calculations:\n",
      "Aho=I*t#  ampere  hour  output  of  the  battery\n",
      "Ahi=Ic*tc#  ampere  hour  input  of  the  battery\n",
      "nAh=(Aho/Ahi)*100#  ampere  hour  efficiency\n",
      "Who=I*t*Vt#  watt  hour  output  of  the  battery\n",
      "Whi=Ic*tc*Vc#  watt  hour  input  of  the  battery\n",
      "nWh=(Who/Whi)*100#  ampere  hour  efficiency\n",
      "\n",
      "#Results\n",
      "print  \"(a)ampere  hour  efficiency  of  the  battery  in  percentage  is\",nAh\n",
      "print  \"(b)watt  hour  efficiency  of  the  battery  in  percentage  is\",nWh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)ampere  hour  efficiency  of  the  battery  in  percentage  is 90.0\n",
        "(b)watt  hour  efficiency  of  the  battery  in  percentage  is 72.0\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.8: page 176:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "n=50  #  no.  of  cells\n",
      "Vc=250#  in  volts\n",
      "Vd=1.8#in  volts\n",
      "Vcs=2.2#in  volts\n",
      "r=0.01#internal  resistance  of  each  cell  in  ohms\n",
      "rl=0.1#lead  resistance  in  ohms\n",
      "Re=19.4#external  resitance  in  ohms\n",
      "\n",
      "#calculations:\n",
      "Ib=n*r#  internal  resistnce  of  battery\n",
      "Tb=rl+Ib#total  resistance  of  battery\n",
      "Eb=Vd*n#total  rmf  of  battery\n",
      "I=(Vc-Eb)/(Re+Tb)#  initial  charging  current  in  amperes\n",
      "Ebf=Vcs*n#emf  of  the  battery  at  the  end  of  charging\n",
      "If=(Vc-Ebf)/(Re+Tb)#  initial  charging  current  in  amperes\n",
      "#Results\n",
      "print  \"(a)initial  charging  current  in  amperes  is\",I\n",
      "print  \"(b)final  charging  current  in  amperes  is\",If"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)initial  charging  current  in  amperes  is 8.0\n",
        "(b)final  charging  current  in  amperes  is 7.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.9: page 182:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#given data:\n",
      "V=230#  in  volts\n",
      "emf1=122#in  volts\n",
      "r=0.4#internal  resistance  in  ohms\n",
      "emf2=130#in  volts\n",
      "r1=0.5#in  ohms\n",
      "R = 5; #in ohm\n",
      "\n",
      "# calculations:\n",
      " #apllying  kirchoff's  low\n",
      " #  x  ampere  is  the  total  current  taken  by  battery\n",
      " #  x1  ampere  is  the  total  current  taken  by  battery  A\n",
      " #  x-x1  ampere  is  the  total  current  taken  by  battery  B\n",
      " #  5*x+0.4*y=180  is  the  equation  in  mesh  ABEF\n",
      " #  5.5*x+0.5*y=100  equation  in  the  mesh  CDEF\n",
      " #  equation  1  is  25*x+2*y=540  and  equation  2  is  22*x-2*y=400\n",
      "A=np.array([[25, 2],[22,-2]])#  EQUATIONS  \n",
      "B=np.array([540,400])#  VALUES\n",
      "X=np.linalg.solve(A, B)#  UNKNOW  VALUES\n",
      "I=X[0]#TOTAL  CURRENT  IN  AMPERES\n",
      "x1=X[1]#current  taken  by  battery  A\n",
      "x2=I-x1#\n",
      "p=(I**2)*R#  in  watt\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"(a1)current  in  battery  A  in  amperes  (discharging) is\",x1\n",
      "print  \"(a2)current  in  bettery  B  in  amperes is\",round(x2,1)\n",
      "print  \"(b)total  current  in  battery  A  and  B  in  amperes  (charging)\",I\n",
      "print  \"(c)power  dissipated  in  watts  is\",p\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a1)current  in  battery  A  in  amperes  (discharging) is 20.0\n",
        "(a2)current  in  bettery  B  in  amperes is 0.0\n",
        "(b)total  current  in  battery  A  and  B  in  amperes  (charging) 20.0\n",
        "(c)power  dissipated  in  watts  is 2000.0\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 9.10: page 183:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#given data:\n",
      "V=34  #  in  volts\n",
      "emf1=2#in  volts\n",
      "r1=6  #in  ohms\n",
      "r2=1  #in  ohms\n",
      "r3=2  #in  ohms\n",
      "r4=4  #  in  ohms\n",
      "\n",
      "# calculations:\n",
      " #apllying  kirchoff's  low\n",
      " #  x  ampere  is  the  current  in  branch  AB\n",
      " #  x1  ampere  is  the  current  in  branch  AC\n",
      " #x2  ampere  is  the  current  in  the  Branch  BD\n",
      " #  x-x2  ampere  is  the  current  in  the  branch  BC\n",
      " #  x1+x2  ampere  is  the  current  in  the  branch  DC\n",
      " #  x-6*x1+8*x2=2  in  mesh  ABD\n",
      " #  2*x-4*x1-14*x2=-2  in  mesh  BCD\n",
      " #  10*x1+4*x2=34;//in  mesh  ADCEF\n",
      "A=np.array([[1,-6,8],[2,-4,-14],[0,10,4]])#  EQUATIONS  \n",
      "B=np.array([2,-2,34])#  VALUES\n",
      "X=np.linalg.solve(A, B)#  UNKNOW  VALUES\n",
      "x=X[0]#TOTAL  CURRENT  IN  AMPERES\n",
      "x1=X[1]#current  taken  by  battery  A\n",
      "x2=X[2]#\n",
      "b1=x-x2#  in  amperes\n",
      "b2=x1+x2#in  amperes\n",
      "R=((r1*x1+r4*(x2+x1))/(x+x1))#total  resistance  in  ohms\n",
      "\n",
      "#Results\n",
      "print  \"current  in  1  ohms  resistance  from  A  to  B  in  amperes is\",x\n",
      "print  \"current  in  6  ohms  resistance  from  A  to  D  in  amperes is\",x1\n",
      "print  \"current  in  8  ohms  resistance  from  B  to  D  in  amperes is\",x2\n",
      "print  \"current  in  2  ohm  resistance  from  B  to  C  in  amperes  is\",b1\n",
      "print  \"current  in  4  ohm  resistance  from  D  to  C  in  amperes  is\",b2\n",
      "print  \"total  reistance  in  ohms  is\",round(R,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  in  1  ohms  resistance  from  A  to  B  in  amperes is 12.0\n",
        "current  in  6  ohms  resistance  from  A  to  D  in  amperes is 3.0\n",
        "current  in  8  ohms  resistance  from  B  to  D  in  amperes is 1.0\n",
        "current  in  2  ohm  resistance  from  B  to  C  in  amperes  is 11.0\n",
        "current  in  4  ohm  resistance  from  D  to  C  in  amperes  is 4.0\n",
        "total  reistance  in  ohms  is 2.27\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}