{
 "metadata": {
  "name": "",
  "signature": "sha256:f23f1f12c5c13ad8f68288fd358f70344404a6fb4aa236ccdacf571419cfbed9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter3-DC Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.1\n",
      "import math\n",
      "i1=1.5;\n",
      "i2=2.7;##in amp.s\n",
      "i5=i1+i2;\n",
      "i4=3.3;\n",
      "i3=i4+i5;\n",
      "print'%s %.2f %s'%(\"Current b/w A & B = \",i5,\" A\");\n",
      "print'%s %.2f %s'%(\"\\n Current I3 = \",i3,\" A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current b/w A & B =  4.20  A\n",
        "\n",
        " Current I3 =  7.50  A\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.2\n",
      "import math\n",
      "E1=6.;\n",
      "E2=3.;\n",
      "V2=E1-E2;\n",
      "V1=4.5;\n",
      "E3=V1-E2;\n",
      "print'%s %.2f %s'%(\"Value of V2 = \",V2,\" A\");\n",
      "print'%s %.2f %s'%(\"\\n Value of E3 = \",E3,\" A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of V2 =  3.00  A\n",
        "\n",
        " Value of E3 =  1.50  A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.3\n",
      "import math\n",
      "V1=7.5;##in volts\n",
      "V2=4.5;\n",
      "V3=4.5;\n",
      "r1=110.;##in ohms\n",
      "r2=33.;\n",
      "r3=22.;\n",
      "i1=V1/r1;\n",
      "i2=V2/r2;\n",
      "i3=V3/r3;\n",
      "print'%s %.2f %s'%(\"Current I1 = \",i1,\" A\");\n",
      "print'%s %.2f %s'%(\"\\n Current I2 = \",i2,\" A\");\n",
      "print'%s %.2f %s'%(\"\\n Current I3 = \",i3,\" A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current I1 =  0.07  A\n",
        "\n",
        " Current I2 =  0.14  A\n",
        "\n",
        " Current I3 =  0.20  A\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.4\n",
      "import math\n",
      "V_in=5.;##in volts\n",
      "r1=4000.;\n",
      "r2=1000.;\n",
      "r_p=r1*r2/(r1+r2);\n",
      "V_out=V_in*(r2/(r1+r2));\n",
      "V_out_p=V_in*(r_p/(r_p+r2));\n",
      "print'%s %.2f %s'%(\"output voltage at no load = \",V_out,\" A\");\n",
      "print'%s %.2f %s'%(\"\\n output voltage when loaded by 10kohms = \",V_out_p,\"A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "output voltage at no load =  1.00  A\n",
        "\n",
        " output voltage when loaded by 10kohms =  2.22 A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.5\n",
      "import math\n",
      "I_in=5.;##in mA\n",
      "R_m=100.;\n",
      "I_m=1.;\n",
      "R_s=R_m*I_m/(I_in-1.);\n",
      "print'%s %.2f %s'%(\"Value of parallel shunt resistor = \",R_s,\" A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of parallel shunt resistor =  25.00  A\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.6\n",
      "import math\n",
      "r1=100.;\n",
      "r2=1000.;\n",
      "R_x_1=(r2/r1)*10000.;\n",
      "R_x_2=(r1/r2)*10.;\n",
      "print'%s %.2f %s %.2f %s '%(\"Range extends from \",R_x_2,\" ohms to\" and \" \",R_x_1,\" ohms\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Range extends from  1.00   100000.00  ohms \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.7\n",
      "import math\n",
      "E=10.;\n",
      "r1=500.;\n",
      "r2=600.;\n",
      "r3=500.;\n",
      "r4=400.;\n",
      "V_a=E*(r2/(r1+r2));\n",
      "V_b=E*(r4/(r3+r4));\n",
      "V_oc=V_a-V_b;\n",
      "r=((r1*r2)/(r1+r2))+((r3*r4)/(r3+r4));\n",
      "i=(V_oc/(r+100.))*1000.;\n",
      "print'%s %.2f %s'%(\"Current flow in 100 ohm resistor = \",i,\" mA\" );"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current flow in 100 ohm resistor =  1.70  mA\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.8\n",
      "import math\n",
      "I_sc=19.;##in uA\n",
      "R=1000.;\n",
      "R_m=968.;\n",
      "V_out=I_sc*(R*R_m/(R+R_m));\n",
      "print'%s %.2f %s'%(\"Voltage produced = \",V_out,\" uV\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage produced =  9345.53  uV\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.9\n",
      "import math\n",
      "c=1.*10**-6;##in farads\n",
      "r=3.3*10**6;##in ohms\n",
      "t=1.;##in sec.\n",
      "V_s=9.;##in volts\n",
      "V_c=V_s*(1.-math.e**(-t/(r*c)));\n",
      "print'%s %.2f %s'%(\"Voltage produced = \",V_c,\" V\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage produced =  2.35  V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex10-pg59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.10\n",
      "import math\n",
      "c=100.*10**-6;##in farads\n",
      "r=1.*10**3;##in ohms\n",
      "t1=50.*10**-3;##in sec.\n",
      "t2=100.*10**-3;##in sec.\n",
      "V_s=350;##in volts\n",
      "i1=(V_s/1000.)*(math.e**(-t1/(r*c)));\n",
      "i2=(V_s/1000.)*(math.e**(-t2/(r*c)));\n",
      "print'%s %.2f %s %.2f %s '%(\"Charging current after \",t1,\" sec\" and \"\",i1,\"  A\");\n",
      "\n",
      "print'%s %.2f %s %.2f %s '%(\"Charging current after \",t2,\" sec\" and \"\",i2,\"  A\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Charging current after  0.05  0.21   A \n",
        "Charging current after  0.10  0.13   A \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex11-pg61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.11\n",
      "import math\n",
      "c=10.*10**-6;##in farads\n",
      "r=47.*10**3;##in ohms\n",
      "V_s=20.;##in volts\n",
      "V_c=10.;\n",
      "t=-c*r*math.log(V_c/V_s);\n",
      "print'%s %.2f %s'%(\"time taken = \",t,\" sec.\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time taken =  0.33  sec.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex12-pg61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.12\n",
      "import math\n",
      "c=150.*10**-6;##in farads\n",
      "r=2.*10**6;##in ohms\n",
      "V_s=150.;##in volts\n",
      "V_c=0.8187*V_s;\n",
      "print'%s %.2f %s'%(\"Capacitor voltage = \",V_c,\" V\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitor voltage =  122.80  V\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13-pg62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.13\n",
      "import math\n",
      "r=10.*10**3;##in ohms\n",
      "t=1.*10**-3;\n",
      "c=(0.1*t/r)*10**9;\n",
      "print'%s %.2f %s'%(\"Capacitor = \",c,\" nF\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitor =  10.00  nF\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex14-pg63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.14\n",
      "import math\n",
      "r=10.*10**3;##in ohms\n",
      "t=1.*10**-3;\n",
      "c=(10.*t/r)*10**6;\n",
      "print'%s %.2f %s'%(\"Capacitor = \",c,\" uF\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitor =  1.00  uF\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex15-pg64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.15\n",
      "import math\n",
      "L=6.;##in henry\n",
      "r=24.;##in ohms\n",
      "t=0.1;##in sec.\n",
      "V_s=12.;##in volts\n",
      "i=(V_s/r)*(1.-math.e**(-t*r/L));\n",
      "print'%s %.2f %s'%(\"current = \",i,\" A\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current =  0.16  A\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex16-pg64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex:3.16\n",
      "import math\n",
      "V_s=5.;##in volts\n",
      "V_c=0.8647*V_s;\n",
      "print'%s %.2f %s'%(\"Inductor voltage = \",V_c,\" V\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inductor voltage =  4.32  V\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}