diff options
author | Trupti Kini | 2016-01-17 23:30:12 +0600 |
---|---|---|
committer | Trupti Kini | 2016-01-17 23:30:12 +0600 |
commit | d386545d7d76f53f459bfd1a9ddf60d3755db9da (patch) | |
tree | 13a7462ee5df1ec703996055f0a45ee6a62903a3 /Electrical_Network_by_R._Singh/Chapter3_1.ipynb | |
parent | c0b55e25248c0a1fd475aa60beae4cdc89c69c08 (diff) | |
download | Python-Textbook-Companions-d386545d7d76f53f459bfd1a9ddf60d3755db9da.tar.gz Python-Textbook-Companions-d386545d7d76f53f459bfd1a9ddf60d3755db9da.tar.bz2 Python-Textbook-Companions-d386545d7d76f53f459bfd1a9ddf60d3755db9da.zip |
Added(A)/Deleted(D) following books
A Electrical_Network_by_R._Singh/Chapter10_1.ipynb
A Electrical_Network_by_R._Singh/Chapter11_1.ipynb
A Electrical_Network_by_R._Singh/Chapter12_1.ipynb
A Electrical_Network_by_R._Singh/Chapter1_1.ipynb
A Electrical_Network_by_R._Singh/Chapter2_1.ipynb
A Electrical_Network_by_R._Singh/Chapter3_1.ipynb
A Electrical_Network_by_R._Singh/Chapter4_1.ipynb
A Electrical_Network_by_R._Singh/Chapter6_1.ipynb
A Electrical_Network_by_R._Singh/Chapter7_1.ipynb
A Electrical_Network_by_R._Singh/Chapter8_1.ipynb
A Electrical_Network_by_R._Singh/screenshots/chapter4_1.png
A Electrical_Network_by_R._Singh/screenshots/chapter6_1.png
A Electrical_Network_by_R._Singh/screenshots/chapter7_1.png
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter10_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter11_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter12_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter13_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter14_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter15_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter16_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter17_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter1_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter2_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter3_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter4_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter5_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter6_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter7_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter8_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/Chapter9_1.ipynb
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/screenshots/chapter3.png
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/screenshots/chapter4.png
A Electronic_Circuit_Analysis_And_Design_by_D._A._Neamen/screenshots/chapter5.png
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter1.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter10.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter11.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter12.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter13.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter14.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter15.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter16.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter17.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter18.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter19.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter2.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter20.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter3.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter4.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter5.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter6.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter7.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/Chapter8.ipynb
A Machine_Design_by_T._H._Wentzell,_P._E/screenshots/chapter1.png
A Machine_Design_by_T._H._Wentzell,_P._E/screenshots/chapter2.png
A Machine_Design_by_T._H._Wentzell,_P._E/screenshots/chapter3.png
Diffstat (limited to 'Electrical_Network_by_R._Singh/Chapter3_1.ipynb')
-rw-r--r-- | Electrical_Network_by_R._Singh/Chapter3_1.ipynb | 2941 |
1 files changed, 2941 insertions, 0 deletions
diff --git a/Electrical_Network_by_R._Singh/Chapter3_1.ipynb b/Electrical_Network_by_R._Singh/Chapter3_1.ipynb new file mode 100644 index 00000000..6d33a416 --- /dev/null +++ b/Electrical_Network_by_R._Singh/Chapter3_1.ipynb @@ -0,0 +1,2941 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:232ca964f6cb50454cfbdf0b82acf046a9abb3f3780b179ff1b54c28005cb225"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter3-Network Theorem 2"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1-pg3.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.2\n",
+ "##example 3.1\n",
+ "print(\"When 10-V source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I1=10.*(0.87/(1.0+0.87));\n",
+ "print\"%s %.2f %s\"%(\"I1=10*(0.87/(10+0.87))= \",I1,\" A (down)\");\n",
+ "print(\"When 4 A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I2=2.86*(0.875/(10.+0.875));\n",
+ "print\"%s %.2f %s\"%(\"I2=2.86*(0.875/(10+0.875))= \",I2,\" A (down)\");\n",
+ "print(\"By superposition theorem:\");\n",
+ "I=I1+I2;\n",
+ "print\"%s %.2f %s\"%(\"\\nI=I1+I2=0.8+0.23= \",I,\" A (down)\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When 10-V source is acting alone:\n",
+ "By current-division formula :\n",
+ "I1=10*(0.87/(10+0.87))= 4.65 A (down)\n",
+ "When 4 A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I2=2.86*(0.875/(10+0.875))= 0.23 A (down)\n",
+ "By superposition theorem:\n",
+ "\n",
+ "I=I1+I2=0.8+0.23= 4.88 A (down)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2-pg3.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.4\n",
+ "##example 3.2\n",
+ "print(\"When 4-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I1=3.33*(3.53/(6.+3.53));\n",
+ "print\"%s %.2f %s\"%(\"I1=3.33*(3.53/(6+3.53)) = \",I1,\" A (down)\");\n",
+ "print(\"When 10-V source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I2=0.833*(3.53/(6.+3.53));\n",
+ "print\"%s %.2f %s\"%(\"I2=0.833*(3.53/(6+3.53))= \",I2,\" A (up)\");\n",
+ "print(\"When 3-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I3=3*(3.53/(6.+3.53));\n",
+ "print\"%s %.2f %s\"%(\"I3=3*(3.53/(6+3.53))= \",I3,\" A (down)\");\n",
+ "print(\"By superposition theorem:\");\n",
+ "I=I1-I2+I3;\n",
+ "print\"%s %.2f %s\"%(\"\\nI=I1-I2+I3=1.23-0.31+1.11= \",I,\" A (down)\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When 4-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I1=3.33*(3.53/(6+3.53)) = 1.23 A (down)\n",
+ "When 10-V source is acting alone:\n",
+ "By current-division formula :\n",
+ "I2=0.833*(3.53/(6+3.53))= 0.31 A (up)\n",
+ "When 3-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I3=3*(3.53/(6+3.53))= 1.11 A (down)\n",
+ "By superposition theorem:\n",
+ "\n",
+ "I=I1-I2+I3=1.23-0.31+1.11= 2.04 A (down)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3-pg3.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.5\n",
+ "##example 3.3\n",
+ "print(\"When 4-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I1=4./(2.+1.);\n",
+ "print\"%s %.2f %s\"%(\"I1=4/(2+1) = \",I1,\" A (down)\");\n",
+ "print(\"When 3-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I2=3.*(2./(2.+1.));\n",
+ "print\"%s %.2f %s\"%(\"I2=3*(2/(2+1)) = \",I2,\" A (down)\");\n",
+ "print(\"When 1-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I3=1.*(2./(2.+1.));\n",
+ "print\"%s %.2f %s\"%(\"I3=1*(2/(2+1)) = \",I3,\" A (down)\");\n",
+ "print(\"By superposition theorem:\");\n",
+ "I=I1+I2+I3;\n",
+ "print\"%s %.2f %s\"%(\"\\nI=I1+I2+I3=1.33+2+0.66= \",I,\" A (down)\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When 4-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I1=4/(2+1) = 1.33 A (down)\n",
+ "When 3-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I2=3*(2/(2+1)) = 2.00 A (down)\n",
+ "When 1-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I3=1*(2/(2+1)) = 0.67 A (down)\n",
+ "By superposition theorem:\n",
+ "\n",
+ "I=I1+I2+I3=1.33+2+0.66= 4.00 A (down)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4-pg3.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.\n",
+ "##example 3.4\n",
+ "print(\"When 6-V source is acting alone:\");\n",
+ "VAB1=6.;\n",
+ "print\"%s %.2f %s\"%(\"VAB1 = \",VAB1,\" V\");\n",
+ "print(\"When 10-V source is acting alone:\");\n",
+ "print(\"Since the resistor of 5 ohm is shorted,the voltage across it is zero\")\n",
+ "VAB2=10.;\n",
+ "print\"%s %.2f %s\"%(\"VAB2= \",VAB2,\" V\" );\n",
+ "print(\"When 5-A source is acting alone:\");\n",
+ "print(\"Due to short circuit in both the parts\");\n",
+ "VAB3=0.;\n",
+ "print\"%s %.2f %s\"%(\"VAB3 = \",VAB3,\" V\");\n",
+ "print(\"By superposition theorem:\");\n",
+ "VAB=VAB1+VAB2+VAB3;\n",
+ "print\"%s %.2f %s\"%(\"\\nVAB=VAB=VAB1+VAB2+VAB3= \",VAB,\" V\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When 6-V source is acting alone:\n",
+ "VAB1 = 6.00 V\n",
+ "When 10-V source is acting alone:\n",
+ "Since the resistor of 5 ohm is shorted,the voltage across it is zero\n",
+ "VAB2= 10.00 V\n",
+ "When 5-A source is acting alone:\n",
+ "Due to short circuit in both the parts\n",
+ "VAB3 = 0.00 V\n",
+ "By superposition theorem:\n",
+ "\n",
+ "VAB=VAB=VAB1+VAB2+VAB3= 16.00 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5-pg3.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.7\n",
+ "##example 3.5\n",
+ "print(\"When 5-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I1=5.*(2./(2.+4.));\n",
+ "print\"%s %.2f %s\"%(\"I1=5*(2/(2+4)) = \",I1,\" A (down)\");\n",
+ "print(\"When 2-A source is acting alone:\");\n",
+ "print(\"By current-division formula :\");\n",
+ "I2=2.*(2./(2.+4.));\n",
+ "print\"%s %.2f %s\"%(\"I2=2*(2/(2+4)) = \",I2,\" A (down)\");\n",
+ "print(\"When 6-V source is acting alone:\");\n",
+ "print(\"Applying KVL to the mesh\");\n",
+ "print(\"-2*I3-6-4*I3=0\");\n",
+ "print(\"I3=-1\");\n",
+ "I3=-1.;\n",
+ "print\"%s %.2f %s\"%(\"I3=-1 A= \",I3,\" A (down)\");\n",
+ "print(\"By superposition theorem:\");\n",
+ "I=I1+I2+I3;\n",
+ "print\"%s %.2f %s\"%(\"\\nI=I1+I2+I3=1.67+0.67-1= \",I,\" A (down)\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When 5-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I1=5*(2/(2+4)) = 1.67 A (down)\n",
+ "When 2-A source is acting alone:\n",
+ "By current-division formula :\n",
+ "I2=2*(2/(2+4)) = 0.67 A (down)\n",
+ "When 6-V source is acting alone:\n",
+ "Applying KVL to the mesh\n",
+ "-2*I3-6-4*I3=0\n",
+ "I3=-1\n",
+ "I3=-1 A= -1.00 A (down)\n",
+ "By superposition theorem:\n",
+ "\n",
+ "I=I1+I2+I3=1.67+0.67-1= 1.33 A (down)\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6-pg3.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.8\n",
+ "##example 3.6\n",
+ "a=15./38.;\n",
+ "b=10./38.;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\nApplying KCL at node 1, \\nI1 =\",a,\"\");##When the 15 V source is acting alone\n",
+ "print\"%s %.2f %s\"%(\"\\nApplying KCL at node 1, \\nI1 = \",b,\"\");##When the 10 V source is acting alone\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\nI = I1+I2 = \",x,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Applying KCL at node 1, \n",
+ "I1 = 0.39 \n",
+ "\n",
+ "Applying KCL at node 1, \n",
+ "I1 = 0.26 \n",
+ "\n",
+ "By superposition theorem, \n",
+ "I = I1+I2 = 0.66 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7-pg3.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.8\n",
+ "##example 3.7\n",
+ "a=3.;\n",
+ "b=2.;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\napplying KCL at node 1, \\nIx1 = \",a,\" A\");##when the 30 V source is acting alone\n",
+ "print\"%s %.2f %s\"%(\"\\napplying KCL at the mesh, \\nIx2 = \",b,\" A\");##when the 20 V source is acting alone\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, Ix = Ix1+Ix2 = \",x,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "applying KCL at node 1, \n",
+ "Ix1 = 3.00 A\n",
+ "\n",
+ "applying KCL at the mesh, \n",
+ "Ix2 = 2.00 A\n",
+ "\n",
+ "By superposition theorem, Ix = Ix1+Ix2 = 5.00 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8-pg3.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.10\n",
+ "##example 3.8\n",
+ "##when 5 V source is acting alone\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "print(\"Vx+10I1=5\");##equation 1\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"4Vx+12I1=5\");##equation 2\n",
+ "A=numpy.matrix([[1, 10],[4 ,12]]);##solving equation in matrix form\n",
+ "B=([[5],[5]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 0.535 A\");\n",
+ "##when the 2 A source is acting alone\n",
+ "print(\"Vx+10I2=0\");##equation 1\n",
+ "print(\"Applying KCL at Node x,\");\n",
+ "print(\"Vx=-10/7\");##equation 2\n",
+ "A1=numpy.matrix([[1, 10],[1 ,0]]);##solving equation in matrix form\n",
+ "B1=numpy.matrix([[0], [-10/7]])\n",
+ "X1=numpy.dot(numpy.linalg.inv(A1),B1);\n",
+ "print[X1];\n",
+ "print(\"I2 = 0.1428 A\");\n",
+ "a=0.535;\n",
+ "b=0.1428;\n",
+ "x=a+b;\n",
+ "print\"%s %.3f %s\"%(\"\\nBy superposition theorem, \\nI = I1+I2 = \",x,\" A \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vx+10I1=5\n",
+ "Applying KVL to mesh,\n",
+ "4Vx+12I1=5\n",
+ "[matrix([[-0.35714286],\n",
+ " [ 0.53571429]])]\n",
+ "I1 = 0.535 A\n",
+ "Vx+10I2=0\n",
+ "Applying KCL at Node x,\n",
+ "Vx=-10/7\n",
+ "[matrix([[-2. ],\n",
+ " [ 0.2]])]\n",
+ "I2 = 0.1428 A\n",
+ "\n",
+ "By superposition theorem, \n",
+ "I = I1+I2 = 0.678 A \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9-pg3.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.10\n",
+ "##example 3.9\n",
+ "##when 100 V source is acting alone\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "print(\"Vx-5I1=0\");##equation 1\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"10Vx-15I1=-100\");##equation 2\n",
+ "A=numpy.matrix([[1, -5],[10 ,-15]]);##solving equation in matrix form\n",
+ "B=numpy.matrix([[0], [-100]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];##negative because of opposite direction\n",
+ "print(\"I1 = 2.857 A\");\n",
+ "##when the 10 A source is acting alone\n",
+ "print(\"9Vx+10I2=0\");##equation 1\n",
+ "print(\"Applying KCL at Node 1,\");\n",
+ "print(\"Vx=-100/7\");##equation 2\n",
+ "A=numpy.matrix([[9, 10],[1, 0]]);##solving equation in matrix form\n",
+ "B=numpy.matrix([[0] ,[-100/7]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I2 = 12.857 A\");\n",
+ "a=2.857;\n",
+ "b=12.857;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\nI = I1+I2 = \",x,\" A \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vx-5I1=0\n",
+ "Applying KVL to mesh,\n",
+ "10Vx-15I1=-100\n",
+ "[matrix([[-14.28571429],\n",
+ " [ -2.85714286]])]\n",
+ "I1 = 2.857 A\n",
+ "9Vx+10I2=0\n",
+ "Applying KCL at Node 1,\n",
+ "Vx=-100/7\n",
+ "[matrix([[-15. ],\n",
+ " [ 13.5]])]\n",
+ "I2 = 12.857 A\n",
+ "\n",
+ "By superposition theorem, \n",
+ "I = I1+I2 = 15.71 A \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10-pg3.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.11\n",
+ "##example 3.10\n",
+ "##when 17 V source is acting alone\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "print(\"Vx+2I1=0\");##equation 1\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"-5Vx-5I1=17\");##equation 2\n",
+ "A=numpy.matrix([[1, 2],[-5 ,-5]]);##solving equation in matrix form\n",
+ "B=([[0], [17]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 3.4 A\");\n",
+ "##when the 1 A source is acting alone\n",
+ "print(\"4Vx+3I2=0\");##equation 1\n",
+ "print(\"Applying KCL at Node x,\");\n",
+ "print(\"Vx=-6/5\");##equation 2\n",
+ "A=numpy.matrix([[4, 3],[1, 0]]);##solving equation in matrix form\n",
+ "B=numpy.matrix([[0],[-6/5]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I2 = 1.6 A\");\n",
+ "a=3.4;\n",
+ "b=1.6;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\nI = I1+I2 = \",x,\" A \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vx+2I1=0\n",
+ "Applying KVL to mesh,\n",
+ "-5Vx-5I1=17\n",
+ "[matrix([[-6.8],\n",
+ " [ 3.4]])]\n",
+ "I1 = 3.4 A\n",
+ "4Vx+3I2=0\n",
+ "Applying KCL at Node x,\n",
+ "Vx=-6/5\n",
+ "[matrix([[-2. ],\n",
+ " [ 2.66666667]])]\n",
+ "I2 = 1.6 A\n",
+ "\n",
+ "By superposition theorem, \n",
+ "I = I1+I2 = 5.00 A \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex11-pg3.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.12\n",
+ "##example 3.11\n",
+ "##when 5 A source is acting alone\n",
+ "print(\"-V1+4I=0\");##equation 1\n",
+ "print(\"Applying KCL to node 1,\");\n",
+ "print(\"1.25V1-4I=5\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[-1, 4],[1.25 ,-4]]);##solving equation in matrix form\n",
+ "B=([[0] ,[5]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"V1 = 20 V\");\n",
+ "##when the 20 V source is acting alone\n",
+ "print(\"from the figure,\");\n",
+ "print(\"V2-3I=0\");##equation 1\n",
+ "print(\"Applying KVL to the mesh,\");\n",
+ "print(\"I=-20\");##equation 2\n",
+ "A=([[1 ,-3],[0 ,1]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-20]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"V2 = -60 V\");\n",
+ "a=20.;\n",
+ "b=-60.;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\n V = V1+V2 =\",x,\" V \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-V1+4I=0\n",
+ "Applying KCL to node 1,\n",
+ "1.25V1-4I=5\n",
+ "[matrix([[ 20.],\n",
+ " [ 5.]])]\n",
+ "V1 = 20 V\n",
+ "from the figure,\n",
+ "V2-3I=0\n",
+ "Applying KVL to the mesh,\n",
+ "I=-20\n",
+ "[array([[-60.],\n",
+ " [-20.]])]\n",
+ "V2 = -60 V\n",
+ "\n",
+ "By superposition theorem, \n",
+ " V = V1+V2 = -40.00 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex12-pg3.13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.13\n",
+ "##example 3.12\n",
+ "##when 18 V source is acting alone\n",
+ "print(\"Vx+I1=0\");##equation 1\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"3Vx-6I1=-18\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, 1],[3 ,-6]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-18]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 2 A\");\n",
+ "##when the 3 A source is acting alone\n",
+ "print(\"from the figure,\");\n",
+ "print(\"Vx=2 V\");##equation 1\n",
+ "print(\"Applying KCL at node 1,\");\n",
+ "print(\"3Vx-6I2=0\");##equation 2\n",
+ "A=([[1 ,0],[3 ,-6]]);##solving equation in matrix form\n",
+ "B=([[2] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I2 =1 V\");\n",
+ "a=2;\n",
+ "b=1;\n",
+ "x=a+b;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\n I = I1+I2 = \",x,\" A \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vx+I1=0\n",
+ "Applying KVL to mesh,\n",
+ "3Vx-6I1=-18\n",
+ "[matrix([[-2.],\n",
+ " [ 2.]])]\n",
+ "I1 = 2 A\n",
+ "from the figure,\n",
+ "Vx=2 V\n",
+ "Applying KCL at node 1,\n",
+ "3Vx-6I2=0\n",
+ "[array([[ 2.],\n",
+ " [ 1.]])]\n",
+ "I2 =1 V\n",
+ "\n",
+ "By superposition theorem, \n",
+ " I = I1+I2 = 3.00 A \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex13-pg3.14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.14\n",
+ "##example 3.13\n",
+ "##when 120 V source is acting alone\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"Iy1=5.45 A\");\n",
+ "##when the 12 A source is acting alone\n",
+ "print(\"from the figure,\");\n",
+ "print(\"V1+4Iy2=0\");##equation 1\n",
+ "print(\"Applying KCL at node 1,\");\n",
+ "print(\"-V1/8 +9/4Iy2=-12\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, 4],[-1/8 ,9/4]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-12]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"Iy2 =-4.36 A\");\n",
+ "##when 40 V source is acting alone\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"Iy3=-1.82 A\");\n",
+ "a=5.45;\n",
+ "b=-4.36;\n",
+ "c=-1.82;\n",
+ "x=a+b+c;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\n I = Iy1+Iy2+Iy3 = \",x,\" A \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh,\n",
+ "Iy1=5.45 A\n",
+ "from the figure,\n",
+ "V1+4Iy2=0\n",
+ "Applying KCL at node 1,\n",
+ "-V1/8 +9/4Iy2=-12\n",
+ "[matrix([[ 8.],\n",
+ " [-2.]])]\n",
+ "Iy2 =-4.36 A\n",
+ "Applying KVL to mesh,\n",
+ "Iy3=-1.82 A\n",
+ "\n",
+ "By superposition theorem, \n",
+ " I = Iy1+Iy2+Iy3 = -0.73 A \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14-pg3.15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.15\n",
+ "##example 3.14\n",
+ "##when 18 V source is acting alone\n",
+ "print(\"Vx1-31=0\");##equation 1\n",
+ "print(\"Applying KVL to mesh,\");\n",
+ "print(\"-3Vx1-9I=-18\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, -3],[-3 ,-9]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-18]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"Vx1 = 3 V\");\n",
+ "##when the 5 A source is acting alone\n",
+ "print(\"from the figure,\");\n",
+ "print(\"V1+Vx2=0\");##equation 1\n",
+ "print(\"Applying KCL at node 1,\");\n",
+ "print(\"1/2V1-1/2Vx2=5\");##equation 2\n",
+ "A=numpy.matrix([[1, 1],[1/2 ,-1/2]]);##solving equation in matrix form\n",
+ "B=([[0] ,[5]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"Vx2= -5 V\");\n",
+ "##when the 36 V source is acting alone\n",
+ "print(\"from the figure,\");\n",
+ "print(\"Vx3+3I=0\");##equation 1\n",
+ "print(\"Applying KVL to the mesh,\");\n",
+ "print(\"3Vx3-9I=-36\");##equation 2\n",
+ "A=numpy.matrix([[1, 3],[3 ,-9]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-36]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"Vx3= -6 V\");\n",
+ "a=3.;\n",
+ "b=-5.;\n",
+ "c=-6.;\n",
+ "x=a+b+c;\n",
+ "print\"%s %.2f %s\"%(\"\\nBy superposition theorem, \\n Vx = Vx1+Vx2+Vx3 = \",x,\" V \");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vx1-31=0\n",
+ "Applying KVL to mesh,\n",
+ "-3Vx1-9I=-18\n",
+ "[matrix([[ 3.],\n",
+ " [ 1.]])]\n",
+ "Vx1 = 3 V\n",
+ "from the figure,\n",
+ "V1+Vx2=0\n",
+ "Applying KCL at node 1,\n",
+ "1/2V1-1/2Vx2=5\n",
+ "[matrix([[ 5.],\n",
+ " [-5.]])]\n",
+ "Vx2= -5 V\n",
+ "from the figure,\n",
+ "Vx3+3I=0\n",
+ "Applying KVL to the mesh,\n",
+ "3Vx3-9I=-36\n",
+ "[matrix([[-6.],\n",
+ " [ 2.]])]\n",
+ "Vx3= -6 V\n",
+ "\n",
+ "By superposition theorem, \n",
+ " Vx = Vx1+Vx2+Vx3 = -8.00 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex15-pg3.16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.16\n",
+ "##example 3.15\n",
+ "a=10.;\n",
+ "b=2.;\n",
+ "c=(5.*a)-(20.*b);\n",
+ "x=20.;\n",
+ "y=30.;\n",
+ "z=5.;\n",
+ "r=z+((x*y)/(x+y));\n",
+ "i=c/(r+c);\n",
+ "##Calculation of Vth(Thevenin's voltage)\n",
+ "print(\"removing the 10 ohm resistor from the circuit\");\n",
+ "print\"%s %.2f %s\"%(\"\\nFor mesh 1, \\nI1 = \",a,\" A\");\n",
+ "print\"%s %.2f %s\"%(\"\\nApplying KVL to mesh 2,, \\nI2 = \",b,\" A\");\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",c,\" V\");\n",
+ "##Calculation of Rth(Thevenin's Resistance)\n",
+ "print(\"replacing the current source of 10 A with an open circuit and voltage source of 100 V with a short circuit,\");\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Calculation of IL(load current)\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 10 ohm resistor from the circuit\n",
+ "\n",
+ "For mesh 1, \n",
+ "I1 = 10.00 A\n",
+ "\n",
+ "Applying KVL to mesh 2,, \n",
+ "I2 = 2.00 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 10.00 V\n",
+ "replacing the current source of 10 A with an open circuit and voltage source of 100 V with a short circuit,\n",
+ "\n",
+ "Rth = 17.00 Ohm\n",
+ "\n",
+ "IL = 0.37 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex16-pg3.17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.17\n",
+ "##example 3.16\n",
+ "a=30.;\n",
+ "b=20.;\n",
+ "c=50.;\n",
+ "d=5.;\n",
+ "e=24.;\n",
+ "v=220.;\n",
+ "x=(v/(a+c));\n",
+ "y=(v/(b+d));\n",
+ "z=(20.*y)-(30.*x);\n",
+ "r=((a*c)/(a+c))+((b*d)/(b+d));\n",
+ "i=z/(r+e);\n",
+ "##Calculation the Vth (Thevenin's voltage)\n",
+ "print(\"removing the 24 Ohm resistor from the network\");\n",
+ "print\"%s %.2f %s\"%(\"\\nI1 = \",x,\" A\");\n",
+ "print\"%s %.2f %s\"%(\"\\nI2 = \",y,\" A\");\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",z,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "print(\"replacing the 220 V source with short circuit\");\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Calculation of IL (load current)\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 24 Ohm resistor from the network\n",
+ "\n",
+ "I1 = 2.75 A\n",
+ "\n",
+ "I2 = 8.80 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 93.50 V\n",
+ "replacing the 220 V source with short circuit\n",
+ "\n",
+ "Rth = 22.75 Ohm\n",
+ "\n",
+ "IL = 2.00 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex17-pg3.18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.18\n",
+ "##example 3.17\n",
+ "print(\"removing the 3 Ohm resistor from the network\");\n",
+ "print(\"Applying KVL to mesh 1\");\n",
+ "print(\"11*I1-9*I2=50\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2\");\n",
+ "print(\"-9*I1+18*I2=0\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[11, -9],[-9 ,18]]);##solving equation in matrix form\n",
+ "B=numpy.matrix([[50] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1=7.69 A\");\n",
+ "print(\"I2=3.85 A\");\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=7.69;\n",
+ "b=3.85;\n",
+ "v=-((5.*b)+(8.*(b-a)));##the B terminal is positive w.r.t A\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "x=4.;\n",
+ "y=2.;\n",
+ "z=5.;\n",
+ "##delta into star network\n",
+ "r1=((x*y)/(x+y+z));\n",
+ "r2=((x*z)/(x+y+z));\n",
+ "r3=((z*y)/(x+y+z));\n",
+ "print\"%s %.2f %s %.2f %s %.2f %s \"%(\"\\nR1 = \",r1,\" Ohm\"and \" \\nR2 = \",r2,\" Ohm\" and \"\\nR3 =\",r3,\" Ohm\");\n",
+ "m=1.73;\n",
+ "n=8.91;\n",
+ "r=(r2+(m*n)/(m+n));\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Claculation of IL (Load Current)\n",
+ "i=v/(r+3.);\t\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 3 Ohm resistor from the network\n",
+ "Applying KVL to mesh 1\n",
+ "11*I1-9*I2=50\n",
+ "Applying KVL to mesh 2\n",
+ "-9*I1+18*I2=0\n",
+ "[matrix([[ 7.69230769],\n",
+ " [ 3.84615385]])]\n",
+ "I1=7.69 A\n",
+ "I2=3.85 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 11.47 V\n",
+ "\n",
+ "R1 = 0.73 \n",
+ "R2 = 1.82 \n",
+ "R3 = 0.91 Ohm \n",
+ "\n",
+ "Rth = 3.27 Ohm\n",
+ "\n",
+ "IL = 1.83 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex18-pg3.21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.21\n",
+ "##example 3.18\n",
+ "print(\"removing the 20 Ohm resistor from the network\");\n",
+ "print(\"Applying KVL to mesh 1\");\n",
+ "print(\"30*I1-15*I2=-75\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2\");\n",
+ "print(\"-15*I1+20*I2=20\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[30, -15],[-15 ,20]]);##solving equation in matrix form\n",
+ "B=numpy.matrix([[-75] ,[20]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1=-3.2 A\");\n",
+ "print(\"I2=-1.4 A\");\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=-3.2;\n",
+ "b=-1.4;\n",
+ "v=45.;\n",
+ "v1=45.-10.*(a-b);\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v1,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "x=10.;\n",
+ "y=5.;\n",
+ "z=5.;\n",
+ "##delta into star network\n",
+ "r1=((x*y)/(x+y+z));\n",
+ "r2=((x*z)/(x+y+z));\n",
+ "r3=((z*y)/(x+y+z));\n",
+ "print\"%s %.2f %s %.2f %s %.2f %s\"%(\"\\nR1 = \",r1,\" Ohm\" and \" \\nR2 = \",r2,\" Ohm \" and \"\\nR3 = \",r3,\" Ohm\");\n",
+ "m=16.25;\n",
+ "r=((m*r1)/(m+r1))+r1;\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Claculation of IL (Load Current)\n",
+ "i=v1/(r+20.);\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 20 Ohm resistor from the network\n",
+ "Applying KVL to mesh 1\n",
+ "30*I1-15*I2=-75\n",
+ "Applying KVL to mesh 2\n",
+ "-15*I1+20*I2=20\n",
+ "[matrix([[-3.2],\n",
+ " [-1.4]])]\n",
+ "I1=-3.2 A\n",
+ "I2=-1.4 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 63.00 V\n",
+ "\n",
+ "R1 = 2.50 \n",
+ "R2 = 2.50 \n",
+ "R3 = 1.25 Ohm\n",
+ "\n",
+ "Rth = 4.67 Ohm\n",
+ "\n",
+ "IL = 2.55 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex19-pg3.22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.22\n",
+ "##example 3.19\n",
+ "print(\"removing the 3 Ohm resistor from the network\");\n",
+ "print(\"Applying KVL to mesh 1\");\n",
+ "print(\"I1=6\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2\");\n",
+ "print(\"-12*I1+18*I2=42\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix ([[1, 0],[-12 ,18]]);##solving equation in matrix form\n",
+ "B=numpy.matrix ([[6] ,[42]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I2= 6.33 A\");\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=6.33;\n",
+ "v=6.*a;\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "print(\"replacing the voltage source with short circuit and current source by open circuit\");\n",
+ "x=6.;\n",
+ "y=12.;\n",
+ "r=(x*y)/(x+y);\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Calculation of IL (load current)\n",
+ "i=v/(r+3.);\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 3 Ohm resistor from the network\n",
+ "Applying KVL to mesh 1\n",
+ "I1=6\n",
+ "Applying KVL to mesh 2\n",
+ "-12*I1+18*I2=42\n",
+ "[matrix([[ 6. ],\n",
+ " [ 6.33333333]])]\n",
+ "I2= 6.33 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 37.98 V\n",
+ "replacing the voltage source with short circuit and current source by open circuit\n",
+ "\n",
+ "Rth = 4.00 Ohm\n",
+ "\n",
+ "IL = 5.43 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex20-pg3.23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.23\n",
+ "##example 3.20\n",
+ "print(\"removing the 30 Ohm resistor from the network\");\n",
+ "print(\"Applying KVL to supermesh \");\n",
+ "print(\"-I1+I2=13\");##equation 1\n",
+ "print(\"15*I1+100*I2=150\");##equation 2\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=3.;\n",
+ "v=(40.*a)-50.;\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "print(\"replacing the voltage source with short circuit and current source by open circuit\");\n",
+ "r=(75.*40.)/(75.+40.);\n",
+ "print\"%s %.2f %s\"%(\"\\nRth = \",r,\" Ohm\");\n",
+ "##Calculation of IL (load current)\n",
+ "i=v/(r+30.);\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 30 Ohm resistor from the network\n",
+ "Applying KVL to supermesh \n",
+ "-I1+I2=13\n",
+ "15*I1+100*I2=150\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 70.00 V\n",
+ "replacing the voltage source with short circuit and current source by open circuit\n",
+ "\n",
+ "Rth = 26.09 Ohm\n",
+ "\n",
+ "IL = 1.25 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex21-pg3.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.25\n",
+ "##example 3.21\n",
+ "##Calculation of Vth\n",
+ "v=100.;\n",
+ "r=20.;\n",
+ "x=v/r;\n",
+ "print(\"Removing the 20 Ohm resistor from the network\");\n",
+ "print\"%s %.2f %s\"%(\"\\nVth = \",v,\" V \");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit and current source by open circuit\");\n",
+ "print(\"Rth = 0\");\n",
+ "##calculation of IL\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",x,\" A\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex22-pg3.25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.25\n",
+ "##example 3.22\n",
+ "print(\"removing the 10 Ohm resistor from the network\");\n",
+ "print(\"Applying KVL to mesh 1\");\n",
+ "print(\"4*I1-I2=-25\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2\");\n",
+ "print(\"-I1+4*I2=10\");##equation 2\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[4, -1],[-1 ,4]]);##solving equation in matrix form\n",
+ "B=([[-25] ,[10]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1=-6 A\");\n",
+ "print(\"I2=1 A\");\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=-6.;\n",
+ "b=1.;\n",
+ "v=-((2.*a)+(2.*b));##the terminal B is positive w.r.t A\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "x=2.;\n",
+ "y=2.;\n",
+ "z=1.;\n",
+ "##star into delta network\n",
+ "r1=x+y+((x*y)/z);\n",
+ "r2=x+z+((x*z)/y);\n",
+ "r3=z+y+((z*y)/x);\n",
+ "print\"%s %.2f %s %.2f %s %.2f %s \"%(\"\\nR1 = \",r1,\" Ohm\" and \" \\nR2 = \",r2,\" Ohm\" and \"\\nR3 = \",r3,\" Ohm\");\n",
+ "##Claculation of IL (Load Current)\n",
+ "r=1.33;\n",
+ "i=v/(r+v);\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 10 Ohm resistor from the network\n",
+ "Applying KVL to mesh 1\n",
+ "4*I1-I2=-25\n",
+ "Applying KVL to mesh 2\n",
+ "-I1+4*I2=10\n",
+ "[matrix([[-6.],\n",
+ " [ 1.]])]\n",
+ "I1=-6 A\n",
+ "I2=1 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 10.00 V\n",
+ "\n",
+ "R1 = 8.00 \n",
+ "R2 = 4.00 \n",
+ "R3 = 4.00 Ohm \n",
+ "\n",
+ "IL = 0.88 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex23-pg3.28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 2\n",
+ "##pg no 3.28\n",
+ "##example 3.23\n",
+ "print(\"removing the 1 Ohm resistor from the network\");\n",
+ "print(\"writing current equation for meshes 1 & 2 \");\n",
+ "print(\"I1= -3 A\");##equation 1\n",
+ "print(\"I2=1 A\");##equation 2\n",
+ "##Calculation of Vth (Thevenin's voltage)\n",
+ "a=-3.;\n",
+ "b=1.;\n",
+ "r=2.;\n",
+ "v=4.-2.*(a-b);\n",
+ "print\"%s %.2f %s\"%(\"\\nWriting Vth equation, \\n Vth = \",v,\" V\");\n",
+ "##Calculation of Rth (Thevenin's resistance)\n",
+ "print(\"replacing the voltage source with short circuit and current source by open circuit\");\n",
+ "print(\"Rth = 2 Ohm\");\n",
+ "##Calculation of IL (load current)\n",
+ "i=v/(r+1.);\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "removing the 1 Ohm resistor from the network\n",
+ "writing current equation for meshes 1 & 2 \n",
+ "I1= -3 A\n",
+ "I2=1 A\n",
+ "\n",
+ "Writing Vth equation, \n",
+ " Vth = 12.00 V\n",
+ "replacing the voltage source with short circuit and current source by open circuit\n",
+ "Rth = 2 Ohm\n",
+ "\n",
+ "IL = 4.00 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex24-pg3.29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.29\n",
+ "##example3.24\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"I1=2\");##equation 1\n",
+ "print(\"Writing current equation to supermesh:\");##meshes 2 & 3 will form a supermesh \n",
+ "print(\"I3-I2=4\");##equation 2\n",
+ "print(\"Applying KVL to supermesh:\");\n",
+ "print(\"-5I2-15I3=0\");##equation 3\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=([[1, 0 ,0],[0 ,-1, 1],[0 ,-5, -15]]);\n",
+ "B=([[2], [4] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 2 A\");\n",
+ "print(\"I2 = -3 A\");\n",
+ "print(\"I3 = 1 A\");\n",
+ "a=2.;\n",
+ "b=-3.;\n",
+ "x=a-b;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = \",x,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit and current source by open circuit\");\n",
+ "c=1.;\n",
+ "m=15.;\n",
+ "y=(c*(m+x))/(c+m+x);\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",y,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "z=10.;\n",
+ "i=x*(y/(z+y));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "I1=2\n",
+ "Writing current equation to supermesh:\n",
+ "I3-I2=4\n",
+ "Applying KVL to supermesh:\n",
+ "-5I2-15I3=0\n",
+ "solving these equations we get :\n",
+ "[array([[ 2.],\n",
+ " [-3.],\n",
+ " [ 1.]])]\n",
+ "I1 = 2 A\n",
+ "I2 = -3 A\n",
+ "I3 = 1 A\n",
+ "\n",
+ "Isc = 5.00 A\n",
+ "replacing the voltage source with short circuit and current source by open circuit\n",
+ "\n",
+ "Rn = 0.95 Ohm\n",
+ "\n",
+ "IL = 0.43 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex25-pg3.30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.30\n",
+ "##example3.25\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"7*I1-2*I2=20\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2,\"); \n",
+ "print(\"-2*I1+10*I2=-12\");##equation 2\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[7, -2],[-2 ,10]]);##solving equation in matrix form\n",
+ "B=([[20] ,[-12]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I2 = -0.67 A\");\n",
+ "a=-0.67;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = I2 = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "b=5.;\n",
+ "c=2.;\n",
+ "d=8.;\n",
+ "y=((b*c)/(b+c))+d;\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",y,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "z=10.;\n",
+ "i=-a*(y/(10.+y));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "7*I1-2*I2=20\n",
+ "Applying KVL to mesh 2,\n",
+ "-2*I1+10*I2=-12\n",
+ "solving these equations we get :\n",
+ "[matrix([[ 2.66666667],\n",
+ " [-0.66666667]])]\n",
+ "I2 = -0.67 A\n",
+ "\n",
+ "Isc = I2 = -0.67 A\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rn = 9.43 Ohm\n",
+ "\n",
+ "IL = 0.33 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex26-pg3.31"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.31\n",
+ "##example3.26\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"7*I1-I2=10\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"-I1+6*I2-3*I3=0\");##equation 2\n",
+ "print(\"Applying KVL to mesh 3:\");\n",
+ "print(\"3*I2-3*I3=20\");##equation 3\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=([[7, -1 ,0],[-1 ,6, -3],[0 ,3, -3]]);\n",
+ "B=([[10], [0] ,[20]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = -13.17 A\");\n",
+ "a=13.17;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "c=1.;\n",
+ "b=6.;\n",
+ "x=(c*b)/(c+b);\n",
+ "y=x+2.;\n",
+ "z=(y*3.)/(y+3.);\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",z,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "n=10.;\n",
+ "i=a*(z/(z+n));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "7*I1-I2=10\n",
+ "Applying KVL to mesh 2:\n",
+ "-I1+6*I2-3*I3=0\n",
+ "Applying KVL to mesh 3:\n",
+ "3*I2-3*I3=20\n",
+ "solving these equations we get :\n",
+ "[array([[ 0.5 ],\n",
+ " [ -6.5 ],\n",
+ " [-13.16666667]])]\n",
+ "I1 = -13.17 A\n",
+ "\n",
+ "Isc = 13.17 A\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rn = 1.46 Ohm\n",
+ "\n",
+ "IL = 1.68 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex27-pg3.32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.32\n",
+ "##example3.27\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"20*I1-20*I2=10\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"-20*I1+60*I2-20*I3=40\");##equation 2\n",
+ "print(\"Applying KVL to mesh 3:\");\n",
+ "print(\"-20*I2+50*I3=-100\");##equation 3\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=([[20, -20 ,0],[-20 ,60, -20],[0 ,-20, -50]]);\n",
+ "B=([[10], [40] ,[-100]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 0.81A\");\n",
+ "a=0.81;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "c=20.;\n",
+ "b=30.;\n",
+ "x=(c*b)/(c+b);\n",
+ "y=x+c;\n",
+ "z=(y*c)/(y+c);\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",z,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "n=10.;\n",
+ "i=a*(z/(z+n));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "20*I1-20*I2=10\n",
+ "Applying KVL to mesh 2:\n",
+ "-20*I1+60*I2-20*I3=40\n",
+ "Applying KVL to mesh 3:\n",
+ "-20*I2+50*I3=-100\n",
+ "solving these equations we get :\n",
+ "[array([[ 2.375],\n",
+ " [ 1.875],\n",
+ " [ 1.25 ]])]\n",
+ "I1 = 0.81A\n",
+ "\n",
+ "Isc = 0.81 A\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rn = 12.31 Ohm\n",
+ "\n",
+ "IL = 0.45 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex28-pg3.33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.33\n",
+ "##example3.28\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"90*I1-60*I2=120\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"-60*I1+100*I2-30*I3=40\");##equation 2\n",
+ "print(\"Applying KVL to mesh 3:\");\n",
+ "print(\"30*I2-30*I3=-10\");##equation 3\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=([[90, -60 ,0],[-60 ,100, -30],[0 ,30, -30]]);\n",
+ "B=([[102], [40] ,[-10]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I3 = 4.67A\");\n",
+ "a=4.67;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "c=30.;\n",
+ "b=60.;\n",
+ "x=(c*b)/(c+b);\n",
+ "y=x+10.;\n",
+ "z=(y*c)/(y+c);\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",z,\" Ohm\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "90*I1-60*I2=120\n",
+ "Applying KVL to mesh 2:\n",
+ "-60*I1+100*I2-30*I3=40\n",
+ "Applying KVL to mesh 3:\n",
+ "30*I2-30*I3=-10\n",
+ "solving these equations we get :\n",
+ "[array([[ 3.75555556],\n",
+ " [ 3.93333333],\n",
+ " [ 4.26666667]])]\n",
+ "I3 = 4.67A\n",
+ "\n",
+ "Isc = 4.67 A\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rn = 15.00 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex29-pg3.34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.34\n",
+ "##example3.29\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Writing current equation for supermesh :\");\n",
+ "print(\"I2-I1=2\");##equation 1\n",
+ "print(\"Applying KVL to supermesh ,\"); \n",
+ "print(\"12*I1= 55\");##equation 2\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[-1, 1],[12 ,0]]);##solving equation in matrix form\n",
+ "B=([[2] ,[55]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = 4.58 A\");\n",
+ "print(\"I2 = 6.58 A\");\n",
+ "a=6.58;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = I2 = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit and current source with open circuit \");\n",
+ "b=12.;\n",
+ "c=4.;\n",
+ "y=((b*c)/(b+c));\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",y,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "z=8.;\n",
+ "i=a*(y/(z+y));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Writing current equation for supermesh :\n",
+ "I2-I1=2\n",
+ "Applying KVL to supermesh ,\n",
+ "12*I1= 55\n",
+ "solving these equations we get :\n",
+ "[matrix([[ 4.58333333],\n",
+ " [ 6.58333333]])]\n",
+ "I1 = 4.58 A\n",
+ "I2 = 6.58 A\n",
+ "\n",
+ "Isc = I2 = 6.58 A\n",
+ "replacing the voltage source with short circuit and current source with open circuit \n",
+ "\n",
+ "Rn = 3.00 Ohm\n",
+ "\n",
+ "IL = 1.79 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex30-pg3.35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.35\n",
+ "##example3.30\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"5*I1-2*I2=-2\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"4*I2-2*I3=-1\");##equation 2\n",
+ "print(\"Applying KVL to mesh 3:\");\n",
+ "print(\"-2*I1-2*I2+4*I3=0\");##equation 3\n",
+ "print(\"solving these equations we get :\");##solving equations in matrix form\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=([[5, -2 ,0],[0 ,4, -2],[-2,-2, 4]]);\n",
+ "B=([[-2], [-1] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "print[X];\n",
+ "print(\"I1 = -0.64A\");\n",
+ "print(\"I2 = -0.55A\");\n",
+ "print(\"I3 = -0.59A\");\n",
+ "a=-0.64;\n",
+ "b=-0.55;\n",
+ "c=-0.59;\n",
+ "print\"%s %.2f %s\"%(\"\\nIsc = I3 = \",a,\" A\");\n",
+ "##calculation of Rn (norton's resistance)\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "z=2.2;\n",
+ "print\"%s %.2f %s\"%(\"\\nRn = \",z,\" Ohm\");\n",
+ "##calculation of IL (load current)\n",
+ "n=1.;\n",
+ "i=-c*(z/(z+n));\n",
+ "print\"%s %.2f %s\"%(\"\\nIL = \",i,\" A\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Applying KVL to mesh 1:\n",
+ "5*I1-2*I2=-2\n",
+ "Applying KVL to mesh 2:\n",
+ "4*I2-2*I3=-1\n",
+ "Applying KVL to mesh 3:\n",
+ "-2*I1-2*I2+4*I3=0\n",
+ "solving these equations we get :\n",
+ "[array([[-0.61538462],\n",
+ " [-0.53846154],\n",
+ " [-0.57692308]])]\n",
+ "I1 = -0.64A\n",
+ "I2 = -0.55A\n",
+ "I3 = -0.59A\n",
+ "\n",
+ "Isc = I3 = -0.64 A\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rn = 2.20 Ohm\n",
+ "\n",
+ "IL = 0.41 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex31-pg3.37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.39\n",
+ "##example3.31\n",
+ "##calculation of Vth (Thevenin's voltage)\n",
+ "a=0.25;\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "v=(10.*a)+(8.*a);\n",
+ "print(\"Writing Vth equation,\");\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"4*I1-2*I2 = 1\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"-18*I1-11*I2=0\");##equation 2\n",
+ "A=numpy.matrix([[4, -2],[8 ,-11]]);##solving equation in matrix form\n",
+ "B=([[1] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "print(\"I2 = 2.25 A\");\n",
+ "a=2.25;\n",
+ "print'%s %.2f %s'%(\"\\nIsc = I2 = \",a,\" A\");\n",
+ "##Calculation of Rth\n",
+ "x=v/a;\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",x,\" Ohm\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 4.50 V\n",
+ "Applying KVL to mesh 1:\n",
+ "4*I1-2*I2 = 1\n",
+ "Applying KVL to mesh 2:\n",
+ "-18*I1-11*I2=0\n",
+ "[matrix([[ 0.39285714],\n",
+ " [ 0.28571429]])]\n",
+ "I2 = 2.25 A\n",
+ "\n",
+ "Isc = I2 = 2.25 A\n",
+ "\n",
+ "Rth = 2.00 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex33-pg3.39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.39\n",
+ "##example3.33\n",
+ "##calculation of Vth (Thevenin's voltage)\n",
+ "a=0.25;\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "v=(10.*a)+(8.*a);\n",
+ "print(\"Writing Vth equation,\");\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Isc (short-circuit current)\n",
+ "print(\"Applying KVL to mesh 1:\");\n",
+ "print(\"4*I1-2*I2 = 1\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"-18*I1-11*I2=0\");##equation 2\n",
+ "A=numpy.matrix([[4, -2],[8 ,-11]]);##solving equation in matrix form\n",
+ "B=([[1] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "print(\"I2 = 2.25 A\");\n",
+ "a=2.25;\n",
+ "print'%s %.2f %s'%(\"\\nIsc = I2 = \",a,\" A\");\n",
+ "##Calculation of Rth\n",
+ "x=v/a;\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",x,\" Ohm\");\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[4, -2],[8 ,-11]]);##solving equation in matrix form\n",
+ "B=([[1] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 4.50 V\n",
+ "Applying KVL to mesh 1:\n",
+ "4*I1-2*I2 = 1\n",
+ "Applying KVL to mesh 2:\n",
+ "-18*I1-11*I2=0\n",
+ "[matrix([[ 0.39285714],\n",
+ " [ 0.28571429]])]\n",
+ "I2 = 2.25 A\n",
+ "\n",
+ "Isc = I2 = 2.25 A\n",
+ "\n",
+ "Rth = 2.00 Ohm\n",
+ "[matrix([[ 0.39285714],\n",
+ " [ 0.28571429]])]\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex41-pg3.47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.47\n",
+ "##example3.41\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"I2-I1=4\");##equation 1\n",
+ "print(\"Applying KVL at the outerpath:\"); \n",
+ "print(\"-6*I1-5*I2=2\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[-1, 1],[-6 ,-5]]);##solving equation in matrix form\n",
+ "B=([[4] ,[2]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "print(\"I1 = -2 A\");\n",
+ "print(\"I2 = 2 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=-2;\n",
+ "v=8-a;\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit and current source by an open circuit \");\n",
+ "x=(v*1.)/(v+1.);\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",x,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",x,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "m=(v**2)/(4.*x);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",m,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "I2-I1=4\n",
+ "Applying KVL at the outerpath:\n",
+ "-6*I1-5*I2=2\n",
+ "[matrix([[-2.],\n",
+ " [ 2.]])]\n",
+ "I1 = -2 A\n",
+ "I2 = 2 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 10.00 V\n",
+ "replacing the voltage source with short circuit and current source by an open circuit \n",
+ "\n",
+ "Rth = 0.91 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 0.91 Ohm\n",
+ "\n",
+ "Pmax = 27.50 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex42-pg3.48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.48\n",
+ "##example3.42\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"I1=50\");##equation 1\n",
+ "print(\"Applying KVL to mesh 2:\"); \n",
+ "print(\"5*I1-10*I2=0\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, 0],[5 ,-10]]);##solving equation in matrix form\n",
+ "B=([[50] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"I2 = 25 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=25;\n",
+ "v=3*a;\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the current source of 50 A by an open circuit \");\n",
+ "x=7.;\n",
+ "y=3.;\n",
+ "m=(x*y)/(x+y);\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "I1=50\n",
+ "Applying KVL to mesh 2:\n",
+ "5*I1-10*I2=0\n",
+ "[matrix([[ 50.],\n",
+ " [ 25.]])]\n",
+ "I2 = 25 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 75.00 V\n",
+ "replacing the current source of 50 A by an open circuit \n",
+ "\n",
+ "Rth = 2.10 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 2.10 Ohm\n",
+ "\n",
+ "Pmax = 669.64 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex43-pg3.49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.49\n",
+ "##example3.43\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"Writing the current equation for the supermesh\");\n",
+ "print(\"I2-I1=6\");##equation 1\n",
+ "print(\"Applying KVL to the supermesh :\"); \n",
+ "print(\"5*I1+2*I2=10\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[-1, 1],[5 ,1]]);##solving equation in matrix form\n",
+ "B=([[6] ,[10]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"I1 = -0.29 A\");\n",
+ "print(\"I2 = 5.71 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=5.71;\n",
+ "v=2*a;\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the current source of 50 A by an open circuit \");\n",
+ "x=5.;\n",
+ "y=2.;\n",
+ "m=((x*y)/(x+y))+3.+4.;\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "Writing the current equation for the supermesh\n",
+ "I2-I1=6\n",
+ "Applying KVL to the supermesh :\n",
+ "5*I1+2*I2=10\n",
+ "[matrix([[ 0.66666667],\n",
+ " [ 6.66666667]])]\n",
+ "I1 = -0.29 A\n",
+ "I2 = 5.71 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 11.42 V\n",
+ "replacing the current source of 50 A by an open circuit \n",
+ "\n",
+ "Rth = 8.43 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 8.43 Ohm\n",
+ "\n",
+ "Pmax = 3.87 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex44-pg3.50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.50\n",
+ "##example3.44\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"Applying KVL to mesh 1\");\n",
+ "print(\"15*I1-5*I2=120\");##equation 1\n",
+ "print(\"Applying KVL to the mesh 2:\"); \n",
+ "print(\"I2=-6\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[15, -5],[0 ,1]]);##solving equation in matrix form\n",
+ "B=([[120] ,[-6]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"I1 = 6 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=6.;\n",
+ "v=120.-(10.*a);\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the current source of 50 A by an open circuit \");\n",
+ "x=10.;\n",
+ "y=5.;\n",
+ "m=((x*y)/(x+y));\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "Applying KVL to mesh 1\n",
+ "15*I1-5*I2=120\n",
+ "Applying KVL to the mesh 2:\n",
+ "I2=-6\n",
+ "[matrix([[ 6.],\n",
+ " [-6.]])]\n",
+ "I1 = 6 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 60.00 V\n",
+ "replacing the current source of 50 A by an open circuit \n",
+ "\n",
+ "Rth = 3.33 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 3.33 Ohm\n",
+ "\n",
+ "Pmax = 270.00 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex45-pg3.45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.51\n",
+ "##example3.45\n",
+ "\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"I1=3 A\");##equation 1\n",
+ "print(\"Applying KVL to the mesh 2:\"); \n",
+ "print(\"-25*I1+41*I2=0\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, 0],[-25 ,41]]);##solving equation in matrix form\n",
+ "B=([[3] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"I2 = 1.83 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=1.83;\n",
+ "v=-20.+(10.*a)+(6.*a);\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the current source of 50 A by an open circuit \");\n",
+ "x=25.;\n",
+ "y=16.;\n",
+ "m=((x*y)/(x+y));\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "I1=3 A\n",
+ "Applying KVL to the mesh 2:\n",
+ "-25*I1+41*I2=0\n",
+ "[matrix([[ 3. ],\n",
+ " [ 1.82926829]])]\n",
+ "I2 = 1.83 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 9.28 V\n",
+ "replacing the current source of 50 A by an open circuit \n",
+ "\n",
+ "Rth = 9.76 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 9.76 Ohm\n",
+ "\n",
+ "Pmax = 2.21 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex46-pg3.52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.52\n",
+ "##example3.46\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"I2-I1=2\");##equation 1\n",
+ "print(\"I2=-3 A\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[-1, 1],[0 ,1]]);##solving equation in matrix form\n",
+ "B=([[2] ,[-3]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"I1 = -5 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=-5.;\n",
+ "b=-3.;\n",
+ "v=8.-(2.*a)-b-6.;\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit and current source by an open circuit \");\n",
+ "m=5.;\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "I2-I1=2\n",
+ "I2=-3 A\n",
+ "[matrix([[-5.],\n",
+ " [-3.]])]\n",
+ "I1 = -5 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 15.00 V\n",
+ "replacing the voltage source with short circuit and current source by an open circuit \n",
+ "\n",
+ "Rth = 5.00 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 5.00 Ohm\n",
+ "\n",
+ "Pmax = 11.25 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex47-pg3.53"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.52\n",
+ "##example3.46\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"By star-delta transformation\");\n",
+ "a=5.;\n",
+ "b=20.;\n",
+ "c=9.;\n",
+ "v=100.;\n",
+ "i=v/(a+a+b+c+c);\n",
+ "print(\"Writing Vth equation,\");\n",
+ "vth=v-(14.*i);\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",vth,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit \");\n",
+ "m=23.92;\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(vth**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "By star-delta transformation\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 70.83 V\n",
+ "replacing the voltage source with short circuit \n",
+ "\n",
+ "Rth = 23.92 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 23.92 Ohm\n",
+ "\n",
+ "Pmax = 52.44 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex48-pg3.55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.55\n",
+ "##example3.48\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"Applying KVL to the mesh 1:\"); \n",
+ "print(\"35*I1-30*I2=60\");##equation 1\n",
+ "print(\"Applying KVL to the mesh 2:\"); \n",
+ "print(\"I2=2\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[35, -30],[60 ,2]]);##solving equation in matrix form\n",
+ "B=([[60] ,[2]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "print(\"I1 = 3.43 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=3.43;\n",
+ "b=2.;\n",
+ "v=20.*(a-b)+20.;\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit and current source by an open circuit \");\n",
+ "x=15.;\n",
+ "y=20.;\n",
+ "m=((x*y)/(x+y));\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "Applying KVL to the mesh 1:\n",
+ "35*I1-30*I2=60\n",
+ "Applying KVL to the mesh 2:\n",
+ "I2=2\n",
+ "[matrix([[ 0.09625668],\n",
+ " [-1.88770053]])]\n",
+ "I1 = 3.43 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 48.60 V\n",
+ "replacing the voltage source with short circuit and current source by an open circuit \n",
+ "\n",
+ "Rth = 8.57 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 8.57 Ohm\n",
+ "\n",
+ "Pmax = 68.89 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex49-pg3.56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.56\n",
+ "##example3.49\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "x=100.;\n",
+ "a=10.;\n",
+ "b=20.;\n",
+ "c=30.;\n",
+ "d=40.;\n",
+ "i1=x/(a+c);\n",
+ "i2=x/(b+d);\n",
+ "print'%s %.2f %s'%(\"\\nI1 = \",i1,\" A\");\n",
+ "print'%s %.2f %s'%(\"\\ni2 = \",i2,\" A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "x=2.5;\n",
+ "y=1.66;\n",
+ "v=(20.*y)-(10.*x);\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source of 100V with short circuit \");\n",
+ "m=((a*c)/(a+c))+((b*d)/(b+d));\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",m,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",m,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*m);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "\n",
+ "I1 = 2.50 A\n",
+ "\n",
+ "i2 = 1.67 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 8.20 V\n",
+ "replacing the voltage source of 100V with short circuit \n",
+ "\n",
+ "Rth = 20.83 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 20.83 Ohm\n",
+ "\n",
+ "Pmax = 0.81 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex50-pg3.57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.57\n",
+ "##example3.50\n",
+ "##calculation of Vth\n",
+ "print(\"Removing the variable resistor RL from the network:\");\n",
+ "print(\"Applying KVL to the mesh 1:\"); \n",
+ "print(\"9*I1-3*I2=72\");##equation 1\n",
+ "print(\"Applying KVL to the mesh 2:\"); \n",
+ "print(\"-3*I1+9*I2=0\");##equation 2\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[9, -3],[-3 ,9]]);##solving equation in matrix form\n",
+ "B=([[72] ,[0]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "print(\"I1 = 9 A\");\n",
+ "print(\"I2 = 3 A\");\n",
+ "print(\"Writing Vth equation,\");\n",
+ "a=9.;\n",
+ "b=3.;\n",
+ "v=(6.*a)+(2.*b);\n",
+ "print'%s %.2f %s'%(\"\\nVth = \",v,\" V\");\n",
+ "##calculation of Rth\n",
+ "print(\"replacing the voltage source with short circuit and current source by an open circuit \");\n",
+ "x=6.;\n",
+ "y=2.;\n",
+ "z=4.;\n",
+ "m=((x*b)/(x+b))+2.;\n",
+ "l=((m*z)/(m+z));\n",
+ "print'%s %.2f %s'%(\"\\nRth = \",l,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",l,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "n=(v**2)/(4.*l);\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Removing the variable resistor RL from the network:\n",
+ "Applying KVL to the mesh 1:\n",
+ "9*I1-3*I2=72\n",
+ "Applying KVL to the mesh 2:\n",
+ "-3*I1+9*I2=0\n",
+ "[matrix([[ 9.],\n",
+ " [ 3.]])]\n",
+ "I1 = 9 A\n",
+ "I2 = 3 A\n",
+ "Writing Vth equation,\n",
+ "\n",
+ "Vth = 60.00 V\n",
+ "replacing the voltage source with short circuit and current source by an open circuit \n",
+ "\n",
+ "Rth = 2.00 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 2.00 Ohm\n",
+ "\n",
+ "Pmax = 450.00 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex51-pg3.58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "##Network Theorem 1\n",
+ "##page no-3.58\n",
+ "##example3.51\n",
+ "##Calculation of Vth\n",
+ "print(\"from the figure\");\n",
+ "print(\"Vth=4*I\");\n",
+ "print(\"Applying KVL to the mesh\");\n",
+ "print(\"0.5*Vth-8*I=-12\");\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "A=numpy.matrix([[1, -4],[0.5 ,-8]]);##solving equation in matrix form\n",
+ "B=([[0] ,[-12]])\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);\n",
+ "\n",
+ "print[X];\n",
+ "\n",
+ "print(\"Vth=8 V\");\n",
+ "##Calculation of Isc\n",
+ "v=8.;\n",
+ "i=12./4.;\n",
+ "print'%s %.2f %s'%(\"\\nIsc = \",i,\" A\");\n",
+ "##Calculation of Rth\n",
+ "r=v/i;\n",
+ "print'%s %.2f %s'%(\"\\nRth = Vth/Isc = \",r,\" Ohm\");\n",
+ "##calculation of RL\n",
+ "print(\"For maximum power transfer\");\n",
+ "print'%s %.2f %s'%(\"\\nRth = RL = \",r,\" Ohm\");\n",
+ "##calculation of Pmax\n",
+ "x=v/(2.*r);\n",
+ "print'%s %.2f %s'%(\"\\nIL = \",x,\" A\");\n",
+ "n=(x**2)*r;\n",
+ "print'%s %.2f %s'%(\"\\nPmax = \",n,\" W\");"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "from the figure\n",
+ "Vth=4*I\n",
+ "Applying KVL to the mesh\n",
+ "0.5*Vth-8*I=-12\n",
+ "[matrix([[ 8.],\n",
+ " [ 2.]])]\n",
+ "Vth=8 V\n",
+ "\n",
+ "Isc = 3.00 A\n",
+ "\n",
+ "Rth = Vth/Isc = 2.67 Ohm\n",
+ "For maximum power transfer\n",
+ "\n",
+ "Rth = RL = 2.67 Ohm\n",
+ "\n",
+ "IL = 1.50 A\n",
+ "\n",
+ "Pmax = 6.00 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |