{ "metadata": { "name": "", "signature": "sha256:5f4c2f0ce05563ebaa82d1579fc74f4b0a66c01a8b91c63f65c05e0494b44f20" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 1 - Introduction to Electronics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E1 - Pg 8" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Find the range of tolerance\n", "#soltion\n", "#given\n", "#color coding\n", "orange=3.#\n", "gold=5.#\n", "yellow=4.#\n", "violet=7.#\n", "#band pattern\n", "band1=yellow#\n", "band2=violet#\n", "band3=orange#\n", "band4=gold#\n", "#resistor color coding\n", "r=(band1*10.+band2)*10.**(band3)#\n", "tol=r*(band4/100.)#tolerance\n", "ulr=r+tol##upper limit of resistance\n", "llr=r-tol##lower limit of resistance\n", "print 'The range of resistance =',llr/1000. ,'kOhm','to',ulr/1000,'kOhm'\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The range of resistance = 44.65 kOhm to 49.35 kOhm\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E2 - Pg 8" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Find the range of tolerance\n", "#color coding\n", "blue=6.#\n", "gold=-1.#\n", "gray=8.#\n", "silver=10.#\n", "#band pattern\n", "band1=gray#\n", "band2=blue#\n", "band3=gold#\n", "band4=silver#\n", "#resistor color coding\n", "r=(band1*10.+band2)*10.**(band3)#\n", "tol=r*(band4/100.)#tolerance\n", "ulr=r+tol##upper limit of resistance\n", "llr=r-tol##lower limit of resistance\n", "print 'The Range of resistance is',llr,'ohm','to',ulr,'ohm'\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The Range of resistance is 7.74 ohm to 9.46 ohm\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E3 - Pg 19" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Find the equivalent current source\n", "#given\n", "Vs=2.;#Volts #dc voltage source\n", "Rs=1.;#ohm #internal resistance\n", "Rl=1.;#ohm #load resistance\n", "Ise=Vs/Rs;#ampere #equivalent current source\n", "\n", "# In accordance to figure 1.23a\n", "Il1=Ise*(Rs/(Rs+Rl));#using current divider concept\n", "Vl1=Il1*Rl;\n", "print \"In accordance to figure 1.23a\\n\"\n", "print \"The Load current (current source Il=\",Il1,'A'\n", "print \"The Load voltage (current source Vl=\",Vl1,'V','\\n'\n", "\n", "# In accordance to figure 1.23b\n", "Vl2=Vs*(Rs/(Rs+Rl));#using voltage divider concept\n", "Il2=Vl2/Rl;\n", "print \"\\nIn accordance to figure 1.23b\"\n", "print \"\\nThe Load voltage (voltage source) Vl=\",Vl2,'V'\n", "print \"The Load current (voltage source) Il=\",Il2,'A'\n", "print \"\\nTherefore they both provide same voltage and current to load\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "In accordance to figure 1.23a\n", "\n", "The Load current (current source Il= 1.0 A\n", "The Load voltage (current source Vl= 1.0 V \n", "\n", "\n", "In accordance to figure 1.23b\n", "\n", "The Load voltage (voltage source) Vl= 1.0 V\n", "The Load current (voltage source) Il= 1.0 A\n", "\n", "Therefore they both provide same voltage and current to load\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example E4 - Pg 19" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Find percentage variation in load current and load voltage\n", "#given\n", "Vs=10.;#volt#Supply voltage\n", "Rs=100.;#ohm#internal resistance\n", "\n", "# In accordance to figure 1.24a\n", "#For 1ohm - 10 ohm\n", "Rl11=1.;#ohm#min extreme value of Rl\n", "Rl12=10.;#ohm#max extreme value of Rl\n", "Il11=Vs/(Rs+Rl11);\n", "Il12=Vs/(Rs+Rl12);\n", "Pi1=(Il11-Il12)*100./Il11;#Percentage variation in current\n", "Vl11=Il11*Rl11;\n", "Vl12=Il12*Rl12;\n", "Pv1=(Vl12-Vl11)*100./Vl12;#Percentage variation in voltage\n", "print '%s' %(\"In accordance to figure 1.24a \\n\");\n", "print '%s %.2f %s' %(\"Percentage variation in Current(1-10 ohm)=\",Pi1,'percent');\n", "print '%s %.1f %s ' %(\"Percentage variation in Voltage(1-10 ohm)=\",Pv1,'percent\\n\\n');\n", "\n", "# In accordance to figure 1.24b\n", "#For 1kohm - 10kohm\n", "Rl21=1000.;#ohm#min extreme value of Rl\n", "Rl22=10000.;#ohm#max extreme value of Rl\n", "Il21=Vs/(Rs+Rl21);\n", "Il22=Vs/(Rs+Rl22);\n", "Pi2=(Il21-Il22)*100./Il21;#Percentage variation in current\n", "Vl21=Il21*Rl21;\n", "Vl22=Il22*Rl22;\n", "Pv2=(Vl22-Vl21)*100./Vl22;#Percentage variation in voltage\n", "print '%s' %(\"In accordance to figure 1.24b \\n\");\n", "print '%s %.f %s' %(\"Percentage variation in Current(1-10 ohm)=\",Pi2,'percent');\n", "print '%s %.f %s ' %(\"Percentage variation in Voltage(1-10 ohm)=\",Pv2,'percent \\n');\n", "print 'In book the percentage variation in voltage(1kohm-10kohm) is 9 percent due to' \n", "print 'the incorrect value of Il22 i.e. 0.000999 Amp correct value is 0.0009901 Amp'\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "In accordance to figure 1.24a \n", "\n", "Percentage variation in Current(1-10 ohm)= 8.18 percent\n", "Percentage variation in Voltage(1-10 ohm)= 89.1 percent\n", "\n", " \n", "In accordance to figure 1.24b \n", "\n", "Percentage variation in Current(1-10 ohm)= 89 percent\n", "Percentage variation in Voltage(1-10 ohm)= 8 percent \n", " \n", "In book the percentage variation in voltage(1kohm-10kohm) is 9 percent due to\n", "the incorrect value of Il22 i.e. 0.000999 Amp correct value is 0.0009901 Amp\n" ] } ], "prompt_number": 4 } ], "metadata": {} } ] }