{ "metadata": { "name": "", "signature": "sha256:e72fe3ba0215215547973defaa93d1e04f3f859c30d61d6e8cd806a66ccb1f3d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 2: D.C. Circuits" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.1, Page 32" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "E = 24.; # E.m.f of battery,V\n", "R1 = 330; # Resistance, ohms\n", "R2 = 1500; # Resistance, ohms\n", "R3 = 470; # Resistance, ohms\n", "\n", "#Calculations\n", "# As resistances R1, R2 & R3 are joined end-to-end hence, they are in series & in series connection, circuit resistance is the sum of individual resistances present in the circuit\n", "R = R1 + R2 + R3; # Resistance of circuit, ohms\n", "I = E/R; # Circuit current, A\n", "# As the resistances are in series so same current flows through each resistor & potential drop across each resistor is equal to the product of circuit current & its respective resistance( from Ohm's law, V = I*R )\n", "V1 = I*R1; # Potential difference developed across resistance R1, V\n", "V2 = I*R2; # Potential difference developed across resistance R2, V\n", "V3 = I*R3; # Potential difference developed across resistance R3, V\n", "P = E*I; # Electric power dissipated by the complete circuit, W\n", "\n", "# Results\n", "print \"The circuit resistance = %4d ohms or %3.1f kilo-ohms\"%(R, R*1e-03);\n", "print \"The circuit current = %5.2f milli-ampere\"%(I/1e-03);\n", "print \"The potential drop across resisatnce R1 = %4.2f volts\\nThe potential drop across resistance R2 = %5.2f volts\\nThe potential drop across resistance R3 = %4.2f volts\"%(V1, V2, V3);\n", "print \"The power dissipated by the complete circuit = %4.2f watt or %3d milli-watt\"%(P,P/1e-03)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The circuit resistance = 2300 ohms or 2.3 kilo-ohms\n", "The circuit current = 10.43 milli-ampere\n", "The potential drop across resisatnce R1 = 3.44 volts\n", "The potential drop across resistance R2 = 15.65 volts\n", "The potential drop across resistance R3 = 4.90 volts\n", "The power dissipated by the complete circuit = 0.25 watt or 250 milli-watt\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2, Page 34" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "E = 12.; # E.m.f of battery, V\n", "R_BC = 16.; # Resistance across branch BC, ohms\n", "P_BC = 4; # Electric power dissipated by resistance R_BC, W\n", "\n", "#Calculations\n", "# using relation P = I^2/R, solving for I\n", "I = math.sqrt( P_BC/R_BC); # Electric current,A\n", "R = E/I; # Total circuit resistance, ohms\n", "R_AB = R - R_BC; # Resistance across branch AB, ohms\n", "\n", "# Result\n", "print \"The circuit current = %3.1f A\\nThe value of other resistor = %1d ohms\"%(I, R_AB)\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The circuit current = 0.5 A\n", "The value of other resistor = 8 ohms\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.3, Page 37" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "E = 24.; # E.m.f of battery, V\n", "R_1 = 330.; # Resistance, ohms\n", "R_2 = 1500.; #Resistance, ohms\n", "R_3 = 470.; #Resistance, ohms\n", "\n", "#Calculations\n", "# Since one end of each resistor is connected to positive terminal of battery and the other end to the negative terminal, therefore, the resistors are in parallel & in parallel connection the equivalent resistance of the circuit is equal to the reciprocal of the sum of conductances of individual resistances present in the circuit i.e 1/R = 1/R_1 + 1/R_2 + 1/R_3, solving for R \n", "R = (R_1*R_2*R_3)/( R_1*R_2 + R_2*R_3 + R_3*R_1); # Equivalent resisance of circuit, ohms\n", "# Since the resistances are in parallel so potetial difference across each resistor is same & in our case is equal to e.m.f of battery & from Ohm's law, V = I*R, solving for I\n", "I_1 = E/R_1; # Current through resistor R_1, A\n", "I_2 = E/R_2; # Current through resistor R_2, A\n", "I_3 = E/R_3; # Current through resistance R_3, A\n", "# Current drawn from battery is equal to the sum of branch currents\n", "I = I_1 + I_2 + I_3; # Current drawn from battery, A\n", "\n", "# Results\n", "print \"The total resistance of the circuit = %6.2f ohms\"%(R);\n", "print \"The branch current I1 = %5.2f mA\\nThe branch current I2 = %2d mA\\nThe branch current I3 = %5.2f mA\"%(I_1/1e-03, I_2/1e-03, I_3/1e-03);\n", "print \"The current drawn from the battery = %5.1f mA\"%(I/1e-03)\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The total resistance of the circuit = 171.68 ohms\n", "The branch current I1 = 72.73 mA\n", "The branch current I2 = 16 mA\n", "The branch current I3 = 51.06 mA\n", "The current drawn from the battery = 139.8 mA\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4, Page 38" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "E = 12; # E.m.f of battery, V\n", "R1 = 6; # Resistance, ohms\n", "R2 = 3; # Resistance, ohms\n", "\n", "#Calculations\n", "# Since the two resistances are in parallel, therefore effective resistance of the circuit is equal to the reciprocal \n", "#of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2, \n", "#simplifying for R \n", "R = ( R1*R2)/(R1 + R2); # Effective resistance of the circuit, ohms\n", "# Fron Ohm's law, V = I*R, solving for I\n", "I = E/R; # Circuit current, A\n", "I1 = E/R1; # Current through resistance R1, A\n", "I2 = E/R2; # Current thrugh resistance R2, A\n", "\n", "# Results\n", "print \"Effective resistance of the circuit = %1d ohms\"%R\n", "print \"The current drawn from the battery = %1d A\"%I\n", "print \"The current through resistor R1 = %1d A\"%I1\n", "print \"The current through R2 resistor = %1d A\"%I2\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Effective resistance of the circuit = 2 ohms\n", "The current drawn from the battery = 6 A\n", "The current through resistor R1 = 2 A\n", "The current through R2 resistor = 4 A\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.5, Page 39" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "R1 = 10.; # Resistance, ohm\n", "R2 = 20.; # Resistance, ohm\n", "R3 = 30.; # Resistance, ohm\n", "\n", "#Calculations\n", "# Part (a)\n", "# Since in series combination, the equivalent resistance of the circuit is the sum of the individual resistances \n", "#present in the circuit i.e R = R1 + R2 + R3\n", "R_s = R1 + R2 + R3; # Equivalent series resistance of the circuit, ohms\n", "# Part (b)\n", "# Since in parallel combination, the equivalent resistance of the circuit is the reciprocal of the sum of the \n", "#conductances of the individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2 + 1/R3, solving for R;\n", "R_p = ( R1*R2*R3 )/( R1*R2 + R2*R3 + R3*R1 ); # Equivalent parallel resistance of the circuit, ohms\n", "\n", "# Results\n", "print \"Equivalent series resistance of the circuit = %2d ohm\"%R_s\n", "print \"Equivalent parallel resistance of the circuit = %4.2f ohm\"%R_p\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Equivalent series resistance of the circuit = 60 ohm\n", "Equivalent parallel resistance of the circuit = 5.45 ohm\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6, Page 44" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "E = 64.; # E.m.f of battery, V\n", "R1 = 6.; # Resistance, ohm\n", "R2 = 4.; # Resistance, ohm\n", "\n", "#Calculations\n", "# Part (a)\n", "# Since R1 & R2 are parallel to one another hence, their equivalent resistance is equal to the sum of reciprocal of \n", "#their individual resistances\n", "R_BC = ( R1*R2)/( R1 + R2 ); # Equivalent resistance across branch BC, ohm\n", "R_AB = 5.6; # Resistance across branch AB, ohm\n", "# Since R_AB & R_BC are in series, therefore, their equivalent resistance is equal to the sum of their individual \n", "#resistances\n", "R_AC = R_AB + R_BC; # Total circuit resistance, ohm\n", "# From Ohm's law, V = I*R, solving for I\n", "I = E/R_AC; # Total circuit current, A\n", "# Part (b)\n", "V_BC = I*R_BC; # Potential difference across branch BC, V\n", "I1 = V_BC/R1; # Electric current through resistor R1, A\n", "# Part (c)\n", "# Since P = I^2*R\n", "P_AB = I**2*R_AB; # Power dissipated by 5.6 ohm resistance, W\n", "\n", "# Results\n", "print \"The current drawn from the supply = %1d A \"%I;\n", "print \"The current through %1d ohm resistor = %3.1f A\"%(R1, I1);\n", "print \"The power dissipated by %3.1f ohm resistor = %5.1f W\"%(R_AB, P_AB);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current drawn from the supply = 8 A \n", "The current through 6 ohm resistor = 3.2 A\n", "The power dissipated by 5.6 ohm resistor = 358.4 W\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.7, Page 46" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "E = 18.; # E.m.f of battery, V\n", "R1 = 4.; # Resistance, ohm\n", "R2 = 6.; # Resistance, ohm\n", "R3 = 5.; # Resistance, ohm\n", "R4 = 3.; # Resistance, ohm\n", "R5 = 6.; # Resistance, ohm\n", "R6 = 8.; # Resistance, ohm\n", "\n", "#Calculations\n", "# Part (a)\n", "# Since resistance R1 & R2 are in parallel, therefore, equivalent resistance across branch AB will be equal to the \n", "#reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit \n", "#i.e 1/R_AB = 1/R1 + 1/R2, simplifying for R_AB \n", "R_AB = ( R1*R2 )/( R1 + R2); # Resistance, ohm\n", "R_BC = R3; # Resistance across branch BC, ohm\n", "# Since resistance R4, R5 & R6 are in parallel, therefore, equivalent resistance across branch CD will be equal to \n", "#the reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit \n", "#i.e 1/R_CD = 1/R4 + 1/R5 + 1/R6, simplifying for R _CD\n", "R_CD = ( R4*R5*R6 )/( R4*R5 + R5*R6 + R6*R4 ); # Resistance, ohm\n", "# Since R_AB, R_BC & R_CD forms series combination, therefore circuit resistance will be their series sum\n", "R = R_AB + R_BC + R_CD; # Circuit resistance, ohm\n", "I = E/R; # Supply current, A\n", "# Part (b)\n", "# AS resistances R1 & R2 are parallel, therefore tere will be same potential difference across them, denoted by V_AB\n", "V_AB = I*R_AB; # Potential difference, V\n", "# AS resistances R4, R5 & R6 are parallel, therefore tere will be same potential difference across them, denoted by V_CD\n", "V_CD = I*R_CD; # Potential difference, V\n", "V_BC = I*R_BC; # Potential difference, V\n", "# Part (c)\n", "I1 = V_AB/R1; # Current through R1 resistor, A\n", "I2 = V_AB/R2; # Current through R2 resistor, A\n", "I4 = V_CD/R4; # Current through R4 resistor, A\n", "I5 = V_CD/R5; # Current through R5 resistor, A\n", "I6 = V_CD/R6; # Current through R6 resistor, A\n", "# Part (d)\n", "P3= I**2*R3; # Power dissipated, W\n", "\n", "# Results\n", "print \"The current drawn from the source = %1d A\"%I\n", "print \"The p.d. across resistor %1d ohm & %1d ohm = %3.1f V\"%(R1, R2, V_AB);\n", "print \"The p.d. across resistor %1d ohm, %1d ohm & %1d ohm = %3.1f V\"%(R4, R5, R6, V_CD);\n", "print \"The p.d. across resistor %1d ohm = %2d V\"%(R3, V_BC);\n", "print \"The current through resistor %1d ohm = %3.1f A\"%(R1, I1);\n", "print \"The current through resistor %1d ohm = %3.1f A\"%(R2, I2);\n", "print \"The current through resistor %1d ohm = %1d A\"%(R3, I);\n", "print \"The current through resistor %1d ohm = %5.3f A\"%(R4, I4);\n", "print \"The current through resistor %1d ohm = %5.3f A\"%(R5,I5);\n", "print \"The current through resistor %1d ohm = %3.1f A\"%(R6, I6);\n", "print \"The power dissipated by the %1d ohm resistor = %2d W\"%(R3, P3);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current drawn from the source = 2 A\n", "The p.d. across resistor 4 ohm & 6 ohm = 4.8 V\n", "The p.d. across resistor 3 ohm, 6 ohm & 8 ohm = 3.2 V\n", "The p.d. across resistor 5 ohm = 10 V\n", "The current through resistor 4 ohm = 1.2 A\n", "The current through resistor 6 ohm = 0.8 A\n", "The current through resistor 5 ohm = 2 A\n", "The current through resistor 3 ohm = 1.067 A\n", "The current through resistor 6 ohm = 0.533 A\n", "The current through resistor 8 ohm = 0.4 A\n", "The power dissipated by the 5 ohm resistor = 20 W\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.8, Page 49" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration&Calculations\n", "# Applying Kirchhoff's current law (the sum of the currents arriving at a junction is equal to the sum of the \n", "#currents leaving that junction) at junction A\n", "I2 = 40 + 10; # Electric current, A\n", "# Applying Kirchhoff's current law at junction C\n", "I1 = 80 - I2; # Electric current, A\n", "# Applying Kirchhoff's current law at junction D\n", "I3 = 80 + 30; # Electric current, A\n", "# Applying Kirchhoff's current law at junction E\n", "I4 = I3 - 25; # Electric current, A\n", "# Applying Kirchhoff's current law at junction F\n", "I5 = 30 - 85; # Electric current, A\n", "\n", "# Result\n", "print \"Current I1 = %2d A\\nCurrent I2 = %2d A\\nCurrent I3 = %3d A\\nCurrent I4 = %2d A\\nCurrent I5 = %2d A,\"%(I1, I2, I3, I4, I5);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Current I1 = 30 A\n", "Current I2 = 50 A\n", "Current I3 = 110 A\n", "Current I4 = 85 A\n", "Current I5 = -55 A,\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.9, Page 52" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "from numpy import linalg\n", "from numpy.linalg import inv\n", "\n", "#Variable declaration\n", "R1 = 3; # Resistance, ohms\n", "R2 = 2; # Resistance, ohms\n", "R3 = 10; # Resistance, ohms\n", "E1 = 10; # E.m.f, V\n", "E2 = 4; # E.m.f, V\n", "\n", "#Calculations\n", "# Applying Kirchhoff's Current Law(the sum of the currents arriving at a junction is equal to the sum of the \n", "#currents leaving that junction) \n", "A = np.array([[3.,-2.],[13.,10.]])\n", "B = np.array([6.,10.])\n", "I1,I2 = np.linalg.solve(A,B)\n", "I3 = ( I1 + I2 ); # Electric current through branch CD, A\n", "V_CD = R3*I3; # P.d.across R3 resistor, V\n", "\n", "# Results\n", "print \"The current through branch FA = %6.3f A\"%I1\n", "print \"The current through branch EB = %5.3f A\"%I2\n", "print \"The current through branch CD = %5.3f A\"%I3\n", "print \"p.d.across %2d resistor = %4.2f V\"%(R3,V_CD)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current through branch FA = 1.429 A\n", "The current through branch EB = -0.857 A\n", "The current through branch CD = 0.571 A\n", "p.d.across 10 resistor = 5.71 V\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.10, Page 53" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "from numpy import linalg\n", "\n", "#Variable declaration\n", "E1 = 6; # E.m.f of battery, V\n", "E2 = 4.5; # E.m.f of battery, V\n", "R1 = 1.5; # Resistance, ohm\n", "R2 = 2; # Resistance, ohm\n", "R3 = 5; # Resistance, ohm\n", "\n", "#Calculations\n", "# Part (a)\n", "# Using matrix method for solving set of equations\n", "A = np.array([[6.5, 5], [5, 7]])\n", "B = np.array([6, 4.5]);\n", "#X = inv(A)*B;\n", "I1,I2 = np.linalg.solve(A,B) # Electric current through branch FA & DC, A\n", "I3 = ( I1 + I2); # Electric current through branch BE, A\n", "# Part (b)\n", "V_BE = I3*R3; # P.d across resistor R3, V\n", "\n", "# Results\n", "print \"Electric current through branch FA = %5.3f A\"%I1\n", "print \"Electric current through branch DC = %6.4f A\"%I2\n", "print \"Electric current through branch BE = %5.3f A\"%I3\n", "print \"p.d across resistor %1d ohms = %5.3f V\"%(R3, V_BE);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Electric current through branch FA = 0.951 A\n", "Electric current through branch DC = -0.0366 A\n", "Electric current through branch BE = 0.915 A\n", "p.d across resistor 5 ohms = 4.573 V\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.11, Page 57" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "from numpy import linalg\n", "\n", "#Variable declaration\n", "R_AB = 6; # Resistance, ohm\n", "R_BC = 4; # Resistance, ohm\n", "R_DC = 1; # Resistance, ohm\n", "R_AD = 3; # Resistance, ohm\n", "R_BD = 5; # Resistance, ohm\n", "\n", "#Calculations\n", "# Using matrix method for solving the set of equations \n", "A = np.array([[6, -3, 5], [-4, 1, 10], [0, 4, 1]]);\n", "B = ([0, 0, 10]);\n", "#X = inv(A)*B;\n", "I1,I2,I3 = np.linalg.solve(A,B); # Electric current, A\n", "I_BC = I1 - I3; # Electric current, A\n", "I_DC = I2 + I3; # Electric current, A\n", "I = I1 + I2; # Supply current, A\n", "\n", "# Results\n", "print \"The current through %1d ohm resistor = %5.3f A\"%(R_AB, I1)\n", "print \"The current through %1d ohm resistor = %4.2f A\"%(R_BC, I_BC);\n", "print \"The current through %1d ohm resistor = %5.3f A\"%(R_DC, I_DC);\n", "print \"The current through %1d ohm resistor = %5.3f A\"%(R_AD, I2);\n", "print \"The current through %1d ohm resistor = %5.3f A\"%(R_BD, I3);\n", "print \"The supply current = %5.3f A\"%I\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current through 6 ohm resistor = 1.074 A\n", "The current through 4 ohm resistor = 0.89 A\n", "The current through 1 ohm resistor = 2.638 A\n", "The current through 3 ohm resistor = 2.454 A\n", "The current through 5 ohm resistor = 0.184 A\n", "The supply current = 3.528 A\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.12, Page 58" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "R_AB = 6; # Resistance across branch AB, ohm \n", "R_AD = 3; # Resistance across branch AD, ohm\n", "R_BC = 4; # Resistance across branch BC, ohm\n", "R_DC = 2; # Resistance across branch DC, ohm\n", "\n", "#Calculations\n", "# Since R_AB/R_AD = R_BC/R_DC, so the wheatstone bridge is balanced hence no current flows through branch BD\n", "I3 = 0;\n", "\n", "# Result\n", "print \"The current through branch BD i.e I3 = %1d A\"%I3\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current through branch BD i.e I3 = 0 A\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1.13, Page 62" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "from numpy import linalg\n", "\n", "#Variable declaration\n", "R1 = 20; # Resistance, ohm\n", "R2 = 10; # Resistance, ohm\n", "R3 = 8; # Resistance, ohm\n", "R4 = 5; # Resistance, ohm\n", "R5 = 2; # Resistance, ohm\n", "\n", "#Calculations\n", "A = np.array([[20, -10, 8], [-5, 2, 15], [0, 12, 2]]);\n", "B = np.array([0, 0, 10]);\n", "I1,I2,I3 = np.linalg.solve(A,B) # Electric current through BD, A\n", "V_BD = I3*R3; # P.d across branch BD, V\n", "# For balance conditions i.e I3 = 0, R1/R2 = R4/R5, solving for R4\n", "R_4 = ( R1*R5 )/R2; # Resistance, ohm\n", "\n", "# Results\n", "print \"The p.d between terminals B and D = %5.3f V\"%V_BD\n", "print \"The value to which %1d ohm resistor must be adjusted in order to reduce the current through %1d ohm resistor to zero = %1d ohm\"%(R4, R3, R_4);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The p.d between terminals B and D = 0.195 V\n", "The value to which 5 ohm resistor must be adjusted in order to reduce the current through 8 ohm resistor to zero = 4 ohm\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.14, Page 64" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "# For part (a)\n", "Rm = 1000.; # Resistance, ohm\n", "Rd = 1; # Resistance, ohm\n", "Rv = 3502.; # Resistance, ohm\n", "# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx\n", "Rx = ( Rm/Rd) * Rv; # Resistance,ohm\n", "print \"The value of the resistance being measured = %5.3f mega-ohm\"%(Rx*1e-06);\n", "\n", "# Part (b)\n", "Rm = 1.; # Resistance, ohm\n", "Rd = 1000; # Resistance, ohm\n", "Rv = 296; # Resistance, ohm\n", "# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx\n", "Rx = ( Rm/Rd )*Rv; # Resistance,ohm\n", "print \"The value of the resistance being measured = %5.3f ohm\"%Rx\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of the resistance being measured = 3.502 mega-ohm\n", "The value of the resistance being measured = 0.296 ohm\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.15, Page 67" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Variable declaration\n", "l1 = 600e-03; # Scale reading, metre\n", "l2 = 745e-03; # Scale reading, metre\n", "l_s = 509.3e-03; # Total scale length, metre\n", "E_s = 1.0186; # Source voltage, V\n", "\n", "#Calculations\n", "E1 = ( l1/l_s )*E_s; # Voltage drop across length l1, V\n", "E2 = ( l2/l_s)*E_s; # Voltage drop across length l2, V\n", "\n", "# Results\n", "print \"The emf of the first cell = %3.1f V \"%E1\n", "print \"The emf of the second cell = %3.2f V \"%E2\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The emf of the first cell = 1.2 V \n", "The emf of the second cell = 1.49 V \n" ] } ], "prompt_number": 15 } ], "metadata": {} } ] }