{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 12: Resistance and DC Circuits" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.1, Page 237" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Magnitude, I4 = -3 A\n" ] } ], "source": [ "#Initialization\n", "i1=8 #current in Amp\n", "i2=1 #current in Amp\n", "i3=4 #current in Amp\n", "\n", "#Calculation\n", "i4=i2+i3-i1 #current in Amp\n", "\n", "#Results\n", "print'Magnitude, I4 = %d A'%i4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.2, Page 239" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Initialization\n", "e=12 #EMF source in volt\n", "v1=3 #node voltage\n", "v3=3 #node voltage\n", "\n", "#Calculation\n", "v2=v1+v3-e #node voltage\n", "\n", "#Results\n", "print'V2 = %d V'%v2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.4, Page 242" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Voc = 10 V\n", "R = 100 ohm\n" ] } ], "source": [ "import numpy as np\n", "\n", "#We have used method II for solving our problem by using simultaneous equations\n", "\n", "a = np.array([[25,-2],[400,-8]]) \n", "b = np.array([[50],[3200]])\n", "c=np.linalg.solve(a,b)\n", "\n", "print'Voc = %d V'%c[0]\n", "print'R = %d ohm'%c[1]\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.5, Page 244" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Voltage, V = 7.14\n" ] } ], "source": [ "#Initialization\n", "r1=100 #Resistance in Ohm\n", "r2=200 #Resistance in Ohm\n", "r3=50 #Resistance in Ohm\n", "v1=15 #voltage source\n", "v2=20 #voltage source\n", "\n", "#Calculation\n", "#Considering 15 V as a source & replace the other voltage source by its internal resistance,\n", "r11=(r2*r3)*(r2+r3)**-1 #resistance in parallel\n", "v11=v1*(r11/(r1+r11)) #voltage\n", "#Considering 20 V as a source & replace the other voltage source by its internal resistance,\n", "r22=(r1*r3)*(r1+r3)**-1 #resistance in parallel\n", "v22=v2*(r22/(r2+r22)) #voltage\n", "\n", "#output of the original circuit\n", "v33=v11+v22\n", "\n", "\n", "\n", "#Results\n", "print'Voltage, V = %.2f'%v33" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.6, Page 246" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Output Current, I = 1.67 A\n" ] } ], "source": [ "#Initialization\n", "r1=10 #Resistance in Ohm\n", "r2=5 #Resistance in Ohm\n", "v2=5 #voltage source\n", "i=2 #current in Amp\n", "\n", "#Calculation\n", "#Considering 5 V as a source & replace the current source by its internal resistance,\n", "i1=v2*(r1+r2)**-1 #current using Ohms law\n", "#Considering current source & replace the voltage source by its internal resistance,\n", "r3=(r1*r2)*(r1+r2)**-1 #resistance in parallel\n", "v3=i*r3 #voltage using Ohms law\n", "i2=v3*r2**-1 #current using Ohms law\n", "i3=i1+i2 #total current\n", "\n", "#Results\n", "print'Output Current, I = %.2f A'%i3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.8, Page 251" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "V2 = 33.04 V\n", "V3 = 43.15 V\n", "Current, I1 = 1.73 A\n" ] } ], "source": [ "import numpy as np\n", "r=25 #resistance in ohm\n", "\n", "#We have used for solving our problem by using simultaneous equations\n", "\n", "a = np.array([[(-13*60**-1),(1*20**-1)],[(1*60**-1),(-9*100**-1)]]) \n", "b = np.array([[-5],[-100*30**-1]])\n", "c=np.linalg.solve(a,b)\n", "i1=c[1]/r #required current\n", "\n", "print'V2 = %.2f V'%c[0] #wrong answer in textbook\n", "print'V3 = %.2f V'%c[1] #wrong answer in textbook\n", "print'Current, I1 = %.2f A'%i1\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12.9, Page 253" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "I1 = 326 mA\n", "I2 = 33 mA\n", "I3 = 53 mA\n", "Voltage, Ve = 0.197 V\n" ] } ], "source": [ "import numpy as np\n", "re=10 #resistance in ohm\n", "\n", "#We have used for solving our problem by using simultaneous equations\n", "\n", "a = np.array([[(-160),(20), (30)],[(20),(-210), (10)], [(30),(10), (-190)]]) \n", "b = np.array([[-50],[0],[0]])\n", "c=np.linalg.solve(a,b)\n", "ve=re*(c[2]-c[1])\n", "\n", "print'I1 = %d mA'%(c[0]*10**3) #current I1\n", "print'I2 = %d mA'%(c[1]*10**3) #current I2\n", "print'I3 = %d mA'%(c[2]*10**3) #current I3\n", "print'Voltage, Ve = %.3f V'%ve\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [Root]", "language": "python", "name": "Python [Root]" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.12" } }, "nbformat": 4, "nbformat_minor": 0 }