{
 "metadata": {
  "name": "",
  "signature": "sha256:b71c5763a44a53c43becf4b38bc4dc6ca15fcaba00869ac6f1172cbb9803b804"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 - ELECTRONIC MATERIALS AND COMPONENTS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the value of resistor\n",
      "print '%s' %(\"Refer to the figure 1.52\")\n",
      "print '%s' %(\"Hold the resistor as shown in the figure such that tolerance is on your extreme right.\")\n",
      "print '%s' %(\"Now the value of the resistor is equal to\")\n",
      "print '%s' %(\"  Red      Black       Blue        Gold\")\n",
      "print '%s' %(\"   2         0          6         (+/-)5%\")\n",
      "red=2. #red value\n",
      "blk=0 #black value\n",
      "blu=6. #blue value\n",
      "gld=5. #gold value\n",
      "value_res=(red*10.+blk)*10.**blu #value of resistor\n",
      "print '%s %.0f %s %.0f' %(\"\\n The value of resistor is\",value_res,\"ohm (+/-)\",gld)\n",
      "per_val=0.05*value_res\n",
      "pos_value_res=value_res+per_val #positive range of resistor\n",
      "neg_value_res=value_res-per_val #negative range of resistor\n",
      "print '%s %.0f %s %.0f %s ' %(\"\\n The value of resistor is\",neg_value_res*1e-6,\" Mohm and\",pos_value_res*1e-6,\"Mohm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to the figure 1.52\n",
        "Hold the resistor as shown in the figure such that tolerance is on your extreme right.\n",
        "Now the value of the resistor is equal to\n",
        "  Red      Black       Blue        Gold\n",
        "   2         0          6         (+/-)5%\n",
        "\n",
        " The value of resistor is 20000000 ohm (+/-) 5\n",
        "\n",
        " The value of resistor is 19  Mohm and 21 Mohm \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the value of the resistor\n",
      "print '%s' %(\"With the help of colour coding table, one finds\")\n",
      "print '%s' %(\"  1st_Band    2nd_Band    3rd_Band    4th_Band\")\n",
      "print(\"    Yellow      Violet      Orange      Gold\")\n",
      "print '%s' %(\"      4          7         10**3     (+/-)5%\")\n",
      "yel=4. #yellow value\n",
      "vio=7. #violet value\n",
      "org=1e3 #orange value\n",
      "gld=5. #gold value in %\n",
      "val_res=(yel*10.+vio)*org\n",
      "print '%s %.2f %s %.0f' %(\"\\n The value of resistor is\",val_res*1e-3,\"kohm (+/-)\",gld)\n",
      "gld_ab=0.05 #absolute gold value\n",
      "per_val=gld_ab*val_res\n",
      "print '%s %.0f %s'%(\"\\n Now, 5%% of 47k_ohm =\",per_val, \"ohm\")\n",
      "range_high=val_res+per_val #higher range\n",
      "range_low=val_res-per_val #lower range\n",
      "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%(\"\\n\\n Thus resistance should be within the range\",val_res*1e-3, \"kohm(+/-)\",per_val*1e-3 ,\"Kohm\\n or between\",range_low*1e-3 ,\"kohm and\",range_high*1e-3, \"kohm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "With the help of colour coding table, one finds\n",
        "  1st_Band    2nd_Band    3rd_Band    4th_Band\n",
        "    Yellow      Violet      Orange      Gold\n",
        "      4          7         10**3     (+/-)5%\n",
        "\n",
        " The value of resistor is 47.00 kohm (+/-) 5\n",
        "\n",
        " Now, 5%% of 47k_ohm = 2350 ohm\n",
        "\n",
        "\n",
        " Thus resistance should be within the range 47.00 kohm(+/-) 2.35 Kohm\n",
        " or between 44.65 kohm and 49.35 kohm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the value of the resistor\n",
      "print '%s' %(\"The specification of the resistor from the color coding table is as follows\")\n",
      "print '%s' %(\"  1st_Band    2nd_Band    3rd_Band    4th_Band\")\n",
      "print '%s' %(\"     Gray        Blue        Gold       Silver\")\n",
      "print '%s' %(\"      8          6        10**(-1)     (+/-)10%\")\n",
      "gray=8. #gray value\n",
      "blu=6. #blue value\n",
      "gld=10.**-1 #gold value\n",
      "sil=10. #silver value in %\n",
      "val_res=(gray*10.+blu)*gld\n",
      "print '%s %.2f %s %.2f' %(\"\\n The value of resistor is\",val_res, \"ohm (+/-)\",sil)\n",
      "sil_ab=0.1 #absolute gold value\n",
      "per_val=sil_ab*val_res\n",
      "print '%s %.2f %s' %(\"\\n Now, 10%% of 8.6 ohm =\",per_val,\" ohm\")\n",
      "range_high=val_res+per_val #higher range\n",
      "range_low=val_res-per_val #lower range\n",
      "print '%s %.2f %s %.2f %s %.2f %s %.2f %s' %(\"\\n\\n Obviously resistance should lie within the range\",val_res,\"ohm(+/-)\",per_val,\"ohm\\n or between\",range_high,\"ohm and\",range_low,\"ohm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The specification of the resistor from the color coding table is as follows\n",
        "  1st_Band    2nd_Band    3rd_Band    4th_Band\n",
        "     Gray        Blue        Gold       Silver\n",
        "      8          6        10**(-1)     (+/-)10%\n",
        "\n",
        " The value of resistor is 8.60 ohm (+/-) 10.00\n",
        "\n",
        " Now, 10%% of 8.6 ohm = 0.86  ohm\n",
        "\n",
        "\n",
        " Obviously resistance should lie within the range 8.60 ohm(+/-) 0.86 ohm\n",
        " or between 9.46 ohm and 7.74 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the load voltage and load current\n",
      "print '%s' %(\"Refer to the figure 1.53\")\n",
      "Vs=2. #supply voltage in V\n",
      "Rs=1. #resistance in ohm\n",
      "Is=Vs/Rs\n",
      "print '%s %.2f %s' %(\"\\n Current Is =\",Is,\" A \\n\")\n",
      "print '%s' %(\"     Internal resistance remains the same but is now connected in parralel with the current sourceIS,as shown in Figure 1.51(a)\")\n",
      "print '%s' %(\"    Now,we connect a load resistance R_L=1 ohm across the terminals of two representations ,and find I_L and V_L.  From Figure 1.54(b) and using the current-divider concept,one obtains\")\n",
      "RL=1. #load resistance in ohm\n",
      "IL=Is*(Rs/(Rs+RL)) #load current using current-divider\n",
      "VL=IL*RL #load voltage\n",
      "print '%s %.0f %s' %(\"\\n Load voltage =\",VL,\"V\")\n",
      "print '%s %.0f %s' %(\"\\n Load current =\",IL,\"A \\n\")\n",
      "print '%s' %(\"From equation 53(b),using the voltage-divider concept,one obtains\")\n",
      "VD_vl=Vs*(RL/(RL+Rs)) #load voltage using voltage divider \n",
      "VD_il=VL/RL #load current\n",
      "print '%s %.0f %s' %(\"\\n Load voltage =\",VD_vl,\"V\")\n",
      "print '%s %.0f %s' %(\"\\n Load current =\",VD_il,\"A \\n\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to the figure 1.53\n",
        "\n",
        " Current Is = 2.00  A \n",
        "\n",
        "     Internal resistance remains the same but is now connected in parralel with the current sourceIS,as shown in Figure 1.51(a)\n",
        "    Now,we connect a load resistance R_L=1 ohm across the terminals of two representations ,and find I_L and V_L.  From Figure 1.54(b) and using the current-divider concept,one obtains\n",
        "\n",
        " Load voltage = 1 V\n",
        "\n",
        " Load current = 1 A \n",
        "\n",
        "From equation 53(b),using the voltage-divider concept,one obtains\n",
        "\n",
        " Load voltage = 1 V\n",
        "\n",
        " Load current = 1 A \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the percentage variation in current, current for two extreme values R_L\n",
      "print '%s' %(\"Refer to the figure 1.55\")\n",
      "print '%s' %(\"(a) R_L varies from 1 ohm to 10 ohm.\")\n",
      "print '%s' %(\"Currents for two extreme values of R_L are\")\n",
      "Vs=10. #supply voltage\n",
      "RL1=1. #resistance RL1\n",
      "Rs=100. #source resistance\n",
      "IL1=(Vs/(RL1+Rs))\n",
      "RL2=10.\n",
      "IL2=(Vs/(RL2+Rs))\n",
      "per_var_cur=((IL1-IL2)/IL1)*100.\n",
      "print '%s %.2f %s' %(\"\\n Percentage variation in current =\",per_var_cur,\"\\n\")#answer in the text book took a .3 decimal round off value\n",
      "print '%s' %(\"   Now,load voltage for the two extreme values of R_L are\")\n",
      "VL1=IL1*RL1\n",
      "VL2=IL2*RL2\n",
      "per_var_vol=((VL2-VL1)/VL2)*100.\n",
      "print '%s %.2f %s' %(\"\\n Percentage variation in current =\",per_var_vol,\"\\n\")\n",
      "\n",
      "print '%s' %(\"(b) R_L varies from 1 k-ohm to 10 k-ohm(Figure 1.55(b))\")\n",
      "print '%s' %(\"Currents for the two extreme values R_L are\")\n",
      "RL11=1000.\n",
      "IL11=(Vs/(RL11+Rs))\n",
      "RL22=10000.\n",
      "IL22=(Vs/(RL22+Rs)) #mistake in book value\n",
      "per_var_cur11=((IL11-IL22)/IL11)*100.\n",
      "print '%s %.2f %s' %(\"\\n Percentage variation in current =\",per_var_cur11,\"\\n\") #mistake in book value\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to the figure 1.55\n",
        "(a) R_L varies from 1 ohm to 10 ohm.\n",
        "Currents for two extreme values of R_L are\n",
        "\n",
        " Percentage variation in current = 8.18 \n",
        "\n",
        "   Now,load voltage for the two extreme values of R_L are\n",
        "\n",
        " Percentage variation in current = 89.11 \n",
        "\n",
        "(b) R_L varies from 1 k-ohm to 10 k-ohm(Figure 1.55(b))\n",
        "Currents for the two extreme values R_L are\n",
        "\n",
        " Percentage variation in current = 89.11 \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}