{
 "metadata": {
  "name": "",
  "signature": "sha256:1f479e444a408fcb9cb7e4430e1c4545dad453af571a814f51ef48ce1d81ede8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 Direct current circut"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1 page no 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(6,6.0,12)                          #Resistances from circuit diagram 12.34 on page no.192 in ohms\n",
      "V=(5,2)                             #Voltage in V from circuit diagram 12.20 on page no.192\n",
      "\n",
      "#Calculations\n",
      "Re=(R[2]*R[1])/(R[2]+R[1])\n",
      "Re2=Re+R[1]\n",
      "I=V[0]/Re2\n",
      "Ve=I*Re\n",
      "I1=Ve/R[2]\n",
      "RE=(R[0]*R[1])/(R[0]+R[1])\n",
      "RE2=RE+R[2]\n",
      "I2=Ve/RE2\n",
      "Itotal=I1-I2\n",
      "\n",
      "#Output\n",
      "print\"The current is \",round(Itotal,2),\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current is  0.03 A\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2 page no 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(3,5,6,7)                                  #Resistances from circuit diagram 12.36(a) on page no. 193 in ohms\n",
      "V=12                                         #Voltage in V from circuit diagram 12.36(a) on page no. 193\n",
      "\n",
      "#Calculations\n",
      "Vth=(V*R[2])/(R[2]+R[3]+R[1])\n",
      "Rth=R[0]+(V*R[2])/(V+R[2])\n",
      "\n",
      "#Output\n",
      "print\"Thevenin equivalent resistance is \",Rth,\"ohms\" \n",
      "print\"Thevenin equivalent voltage is \",Vth,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thevenin equivalent resistance is  7 ohms\n",
        "Thevenin equivalent voltage is  4 V\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3 page no 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(2,3,4.0)                                 #Resistances from circuit diagram 12.37(a) on page no.194 in ohms\n",
      "V=5                                       #Voltage in V from circuit diagram 12.37(a) on page no.194\n",
      "\n",
      "#Calculations\n",
      "RN=(V*R[2])/(V+R[2])\n",
      "IN=V/(R[0]+R[1])\n",
      "\n",
      "#Output\n",
      "print\"Nortons equivalent resistance is \",round(RN,1),\"ohms\"\n",
      "print\"Nortons equivalent current is \",IN,\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nortons equivalent resistance is  2.2 ohms\n",
        "Nortons equivalent current is  1 A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4 page no 194 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "C=10*10**-6                                          #Capicitance in F\n",
      "R=10.0*10.0**3                                       #Resistance in ohms\n",
      "e=6                                                  #Emf of the battery in V\n",
      "\n",
      "#Calculations\n",
      "t=C*R\n",
      "Qm=(C*e)/10.0**-6\n",
      "Im=(e/R)*1000\n",
      "\n",
      "#Output\n",
      "print\"Time constant of the circuit is \",t,\"s\" \n",
      "print\"Maximum charge on the capacitor is \",Qm,\"micro C\" \n",
      "print\"Maximum current in the circuit is \",Im,\"mA\" \n",
      "print\"Charge at time t is Q(t) = \",Qm,\"micro C\"\n",
      "print\"Currrent at time t is I(t) = \",Im,\"mA\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constant of the circuit is  0.1 s\n",
        "Maximum charge on the capacitor is  60.0 micro C\n",
        "Maximum current in the circuit is  0.6 mA\n",
        "Charge at time t is Q(t) =  60.0 micro C\n",
        "Currrent at time t is I(t) =  0.6 mA\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5 page no 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "L=50                                    #Inductance in mH\n",
      "R=5.0                                   #Resistance in ohms\n",
      "V=6                                     #Volatage of the battery in V\n",
      "t=5                                     #Time in ms\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "t1=(L/R)\n",
      "I=(V/R)*(1-math.exp(-t/t1))\n",
      "\n",
      "#Output\n",
      "print\"The time constant of the circuit is \",t1,\"ms\" \n",
      "print\"The current in the circuit is \",round(I,2),\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time constant of the circuit is  10.0 ms\n",
        "The current in the circuit is  0.47 A\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6 page no 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "L=6                                         #Inductance in mH\n",
      "C=12                                        #Capacitance in pF\n",
      "V=6                                         #Voltage of the battery in V\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "f=(1/(2.0*3.14*math.sqrt(L*10**-3*C*10**-12)))/10**5\n",
      "Qm=(C*10**-12*V)/10.0**-12\n",
      "Im=(2*3.14*f*10**5*Qm*10**-12)/10.0**-6\n",
      "\n",
      "#Output\n",
      "print\"Frequency of oscillation is \",round(f,2),\"*10^5 Hz\" \n",
      "print\"The maximum value of charge on capacitor is \",Qm,\"*10**-12 C\" \n",
      "print\"The current in the circuit is \",round(Im,0),\"micro A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency of oscillation is  5.93 *10^5 Hz\n",
        "The maximum value of charge on capacitor is  72.0 *10**-12 C\n",
        "The current in the circuit is  268.0 micro A\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.1 Page no 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "V=10                                          #voltage in V from fig.12.7 on page no.175\n",
      "R=10.0                                        #Resistance in ohms from fig.12.7 on page no.175\n",
      "\n",
      "#Calculations\n",
      "I=(V/R)\n",
      "\n",
      "#Output\n",
      "print\"Current in the circuit shown in fig.12.7 is \",I,\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current in the circuit shown in fig.12.7 is  1.0 A\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.2 Page no 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(6,6,3.0)                                #Resistances in the circuit from circuit diagram 12.9 on page no. 175 in ohms\n",
      "V=(24,16)                                #Voltages in the circuit from circuit diagram 12.9 on page no. 175 in V\n",
      "\n",
      "#Calculations\n",
      "Re=(R[1]*R[2])/(R[1]+R[2])\n",
      "Re1=Re+R[0]\n",
      "I=V[0]/Re1\n",
      "Ve=I*Re\n",
      "Ie=Ve/R[2]\n",
      "RE=(R[0]*R[1])/(R[0]+R[1])\n",
      "RE1=RE+R[2]\n",
      "I1=V[1]/RE1\n",
      "VE=R[2]*I1\n",
      "I2=VE/R[0]\n",
      "Itotal=Ie+I2\n",
      "#Output\n",
      "print\"The current shown in the circiut is \",round(Itotal,1),\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current shown in the circiut is  3.3 A\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.3 Page no 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(4,12,2.0,12)                               #Resistances from circuit diagram 12.12 on page no. 177 in ohms\n",
      "V=12                                        #Voltage in V from circuit diagram 12.12 on page no. 177\n",
      "\n",
      "#Calculations\n",
      "Rth=((R[0]+R[2])*R[1])/(R[0]+R[2]+R[1])\n",
      "Vth=(V*R[1])/(R[0]+R[2]+R[1])\n",
      "I=(Vth/(Rth+R[3]))\n",
      "\n",
      "#Output\n",
      "print\"The current through the resistor is \",I,\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current through the resistor is  0.5 A\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.4 Page no 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(2,3,6)                                   #Resistances from circuit diagram 12.15 on page no. 178 in ohms\n",
      "I=2                                         #Current in A from circuit diagram 12.15 on page no. 178\n",
      "\n",
      "#Calculations\n",
      "Rth=(R[1]+R[2])\n",
      "Vth=(R[2]*I)\n",
      "\n",
      "#Output\n",
      "print\"Thevenin equivalent resistance is \",Rth,\"ohms\" \n",
      "print\"Thevenin equivalent voltage is \",Vth,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thevenin equivalent resistance is  9 ohms\n",
        "Thevenin equivalent voltage is  12 V\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.5 Page no 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(12,8.0,3.0,6)                          #Resistances from circuit diagram 12.17 on page no.179 in ohms\n",
      "V=12                                      #Voltage in V from circuit diagram 12.17 on page no.179\n",
      "\n",
      "#Calculations\n",
      "Rth=((R[2]*R[0])/(R[2]+R[0]))+((R[1]*R[3])/(R[1]+R[3]))\n",
      "Vth=V*((R[1]*R[3])/(R[1]+R[3]))/(R[0]+R[2])\n",
      "\n",
      "#Output\n",
      "print\"Thevenin equivalent resistance is \",round(Rth,2),\"ohms\" \n",
      "print\"Thevenin equivalent voltage is \",round(Vth,2),\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thevenin equivalent resistance is  5.83 ohms\n",
        "Thevenin equivalent voltage is  2.74 V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.6 Page no 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(4,12,2,12)                                     #Resistances from circuit diagram 12.20 on page no.180 in ohms\n",
      "V=12                                              #Voltage in V from circuit diagram 12.20 on page no.180\n",
      "\n",
      "#Calculations\n",
      "RN=((R[0]+R[2])*R[1])/(R[0]+R[2]+R[1])\n",
      "IN=V/(RN+R[2])\n",
      "\n",
      "#Output\n",
      "print\"Nortons equivalent resistance is \",RN,\"ohms\"\n",
      "print\"Nortons equivalent current is \",IN,\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nortons equivalent resistance is  4 ohms\n",
        "Nortons equivalent current is  2 A\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.e.7 Page no 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "R=(4.0,5,6)                              #Resistances from circuit diagram 12.22 on page no.181 in ohms\n",
      "I=2                                    #Current in A from circuit diagram 12.22 on page no.181\n",
      "\n",
      "#Calculations\n",
      "RN=(R[0]+R[1]+R[2])\n",
      "IN=(R[0]*I)/RN\n",
      "\n",
      "#Output\n",
      "print\"Nortons equivalent resistance is \",RN,\"ohms\"\n",
      "print\"Nortons equivalent current is \",round(IN,2),\"A\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nortons equivalent resistance is  15.0 ohms\n",
        "Nortons equivalent current is  0.53 A\n"
       ]
      }
     ],
     "prompt_number": 35
    }
   ],
   "metadata": {}
  }
 ]
}