{
 "metadata": {
  "name": "",
  "signature": "sha256:07d1a1891f05681129f5b923a45c9d13a9e8c4e25902a3f29878a40044aa6a7c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : Circuit Laws"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3  Page No : 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given\n",
      "#Equivalent resistance of three resistors is 750 ohm\")\n",
      "#values of two resistors are 40 ohm and 410 ohm\")\n",
      "Req = 750;\n",
      "R1 = 40;\n",
      "R2 = 410;\n",
      "\n",
      "#For series resistance \n",
      "#Req = R1+R2+R3\")\n",
      "#On solving for R3\n",
      "R3 = Req-R1-R2\n",
      "print \"Value of third ohmic resistor is %d ohm\"%(R3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of third ohmic resistor is 300 ohm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4  Page No : 49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 3.4\")\n",
      "# Given\n",
      "#values of two capacitors are 2uF and 10uF\")\n",
      "C1 = 2*10**-6;\n",
      "C2 = 10*10**-6;\n",
      "#For two capacitors in series\n",
      "#Ceq = (C1*C2)/(C1+C2)\")\n",
      "#On solving for Ceq\n",
      "Ceq = ((C1*C2)/(C1+C2))*10**6\n",
      "print \"Value of equivalent capacitance is %3.2fuF\"%(Ceq)\n",
      "\n",
      "#If C2 = 10pF\")\n",
      "C2 = 10*10**-12;\n",
      "\n",
      "Ceq = ((C1*C2)/(C1+C2))*10**12\n",
      "print \"Value of equivalent capacitance is %3.2fpF\"%(Ceq)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of equivalent capacitance is 1.67uF\n",
        "Value of equivalent capacitance is 10.00pF\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5  Page No : 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 3.5\")\n",
      "# Given\n",
      "#a)\")\n",
      "#values of two resistors are 60 ohm and 60 ohm\")\n",
      "R1 = 60;\n",
      "R2 = 60.;\n",
      "#If resistors are parallel\")\n",
      "Req = (R1*R2)/(R1+R2)\n",
      "print \"Value of equivalent resistance is %d ohm\"%(Req)\n",
      "\n",
      "#b)\")\n",
      "#values of three equal resistors are 60 ohm\")\n",
      "R1 = 60.;\n",
      "R2 = 60.;\n",
      "R3 = 60.;\n",
      "#If resistors are parallel\")\n",
      "x = 1/R1+1/R2+1/R3\n",
      "Req = 1/x;\n",
      "print \"Value of equivalent resistance is %d ohm\"%(Req)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of equivalent resistance is 30 ohm\n",
        "Value of equivalent resistance is 20 ohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6  Page No : 55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 3.6\")\n",
      "\n",
      "# Given\n",
      "#values of two inductors are 3mH and 6 mH\")\n",
      "L1 = 3*10**-3;\n",
      "L2 = 6*10**-3;\n",
      "#If inductors are parallel\")\n",
      "Leq = ((L1*L2)/(L1+L2))*10**3\n",
      "print \"Value of equivalent inductance is %3.1f mH\"%(Leq)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of equivalent inductance is 2.0 mH\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7  Page No : 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 3.7\")\n",
      "\n",
      "# Given\n",
      "#Total resistance of three resistors is 50 ohm\")\n",
      "R = 50;\n",
      "#Output voltage is 10 percent of the input voltage\")\n",
      "#Let v be input voltage and v1 be output voltage\n",
      "#Let v1/v = V\n",
      "V = 0.1;\n",
      "#As V = R1/(Total resistance)\n",
      "\n",
      "#Solving for R1\n",
      "R1 = V*R;\n",
      "#As R = R1+R2\n",
      "#Solving for R2\n",
      "R2 = R-R1;\n",
      "\n",
      "# Results\n",
      "print \"R1 = %dohm R2 = %dohm\"%(R1,R2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 5ohm R2 = 45ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8  Page No : 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 3.8\")\n",
      "\n",
      "# Given\n",
      "#Total current is 30mA\")\n",
      "#Branch currents are 20mA and 10mA\")\n",
      "#Equivalent resistance is equal to or greater than 10 ohm\")\n",
      "\n",
      "#From Fig 3.6\n",
      "#Current flowing through R1 be i1 and let it be equal to 10mA\n",
      "#Current flowing through R2 be i2 and let it be equal to 20mA\n",
      "i1 = 10*10**-3;\n",
      "i2 = 20*10**-3;\n",
      "i = 30*10**-3;\n",
      "\n",
      "# Calculation\n",
      "#Let R1/(R1+R2) = X1        (1)\n",
      "#Let R2/(R1+R2) = X2        (2)\n",
      "X1 = i1/i;\n",
      "X2 = i2/i;\n",
      "#Let R1*R2(R1+R2) = Y        (3)\n",
      "\n",
      "# Results\n",
      "#Given that \n",
      "print \" Given\"\n",
      "#R1*R2(R1+R2)> = 10\")\n",
      "#Solving (1),(2) and (3) we get\n",
      "print \"R1> = %dohmR2> = %dohm\"%(15,30)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Given\n",
        "R1> = 15ohmR2> = 30ohm\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}