diff options
author | hardythe1 | 2015-06-17 11:14:34 +0530 |
---|---|---|
committer | hardythe1 | 2015-06-17 11:14:34 +0530 |
commit | 37d315828bbfc0f5cabee669d2b9dd8cd17b5154 (patch) | |
tree | 18b9d2929b329e112462bca900e9ae25c4c03006 /Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb | |
parent | 79c59acc7af08ede23167b8455de4b716f77601f (diff) | |
download | Python-Textbook-Companions-37d315828bbfc0f5cabee669d2b9dd8cd17b5154.tar.gz Python-Textbook-Companions-37d315828bbfc0f5cabee669d2b9dd8cd17b5154.tar.bz2 Python-Textbook-Companions-37d315828bbfc0f5cabee669d2b9dd8cd17b5154.zip |
add books
Diffstat (limited to 'Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb')
-rwxr-xr-x | Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb | 455 |
1 files changed, 455 insertions, 0 deletions
diff --git a/Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb b/Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb new file mode 100755 index 00000000..8ff8dd45 --- /dev/null +++ b/Electronic_Devices_and_Circuits_By_I.JNagrath/chapter10.ipynb @@ -0,0 +1,455 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b691445f839d23d9b5a14c2197009ca3f35812a374a93d76637f2ad2cb582157"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10 : Circuit Theory"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.1,Page number 477"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "i1=4. #current through r1(A) \n",
+ "v3=3 #voltage(V)\n",
+ "v4=8 #voltage(V)\n",
+ "r3=3 #resistance(ohms)\n",
+ "r2=2 #resistance(ohms)\n",
+ "r4=4 #resistance(ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "i3=v3/r3 #current through r3(A)\n",
+ "i4=v4/r4 #current through r4(A)\n",
+ "i2=-(i3+i4-i1)/2 #current through r2(A)\n",
+ "v2=i2*r2 #voltage through r2(V)\n",
+ "\n",
+ "#Result\n",
+ "print\"v2 is\",v2,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "v2 is 1.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.2,Page number 478"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "v1=6 #current through r1(A) \n",
+ "i2=2 #voltage through r3(V)\n",
+ "i3=4 #voltage through r4(V)\n",
+ "r3=2 #resistance(ohms)\n",
+ "v3=3 #voltage through r3(ohms)\n",
+ "r2=2 #resistance(ohms)\n",
+ "r4=3 #resistance(ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "v2=i2*r2 #voltage through r2(ohms)\n",
+ "v3=i3*r3 #voltage through r3(ohms)\n",
+ "v4=4*i2+v3-v2-v1 #voltage through r4(ohms)\n",
+ "i4=v4/r4 #current through r4(A)\n",
+ "\n",
+ "#Result\n",
+ "print\"i4 is\",i4,\"A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i4 is 2 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.3,Page number 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import numpy as np\n",
+ "\n",
+ "#Calculations\n",
+ "a=np.array([[7,-3,-4],[-3,6,-2],[-4,-2,11]]) #solving three linear mesh equations\n",
+ "b=np.array([-11,3,25])\n",
+ "x=np.linalg.solve(a,b)\n",
+ "x\n",
+ "v=x[2]-x[1] #voltage across 2mho conductance(V)\n",
+ "\n",
+ "#Results\n",
+ "print\"v is\",v,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "v is 1.0"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.4,Page number 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "R=20 #resistance across which voltage is to be calculated(ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "a=np.array([[35,-20],[-20,50]]) #solving two linear mesh equations\n",
+ "b=np.array([50,-100])\n",
+ "x=np.linalg.solve(a,b)\n",
+ "x\n",
+ "i=x[0]-x[1] #current through 20 ohms resistor(ohms)\n",
+ "V=20*i #voltage across 20 ohms(V)\n",
+ "\n",
+ "#Results\n",
+ "print\"i is\",round(i,2)\n",
+ "print\"voltage across 20 ohms is\",round(V,1),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i is 2.22\n",
+ "voltage across 20 ohms is 44.4 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.5,Page number 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Vs=16. #source voltage(V)\n",
+ "\n",
+ "#Calculations\n",
+ "#Part b\n",
+ "I=0 #current through 10 V\n",
+ "Is=-4*(I-(Vs/32)) #current of current source(A)\n",
+ "\n",
+ "#Part c\n",
+ "Is1=16 #current of current source(A)\n",
+ "I=0 #current through 10 V\n",
+ "Vs1=(I+(Is1/4))*32 #source voltage(V)\n",
+ "\n",
+ "#Results\n",
+ "print\"Is is\",Is,\"A\"\n",
+ "print\"Vs1 is\",Vs1,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Is is 2.0 A\n",
+ "Vs1 is 128 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.6,Page number 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V=9 #voltmeter of voltage(V)\n",
+ "i=9 #ammeter current of 9V\n",
+ "r1=1 #resistance(ohms)\n",
+ "r2=3 #resistance(ohms)\n",
+ "r=5 #resistance parallel to ammeter(ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "Isc=((i*r)-V)/(r1+r) #short circuiting a and b and converting current source to a voltage source(A)\n",
+ "Ro=((r+r1)*r2)/((r+r1)+r2) #output resistance(ohms)\n",
+ "\n",
+ "#Results\n",
+ "print\"Isc is\",Isc,\"A\"\n",
+ "print\"Ro is\",Ro,\"ohms\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Isc is 6 A\n",
+ "Ro is 2 ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.7,Page number 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import cmath\n",
+ "import math\n",
+ "from sympy import *\n",
+ "import sympy\n",
+ "\n",
+ "#Variable declaration\n",
+ "t = symbols('t') #symbol defined\n",
+ "et1 = complex(50,86.6) #defining complex number\n",
+ "\n",
+ "#calculations\n",
+ "et = (et1.real*sympy.sqrt(2)*sympy.cos(314*t))+et1.imag*sympy.sqrt(2)*sympy.cos(314*t+90) #expression\n",
+ "\n",
+ "#Result\n",
+ "print et"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "50.0*sqrt(2)*cos(314*t) + 86.6*sqrt(2)*cos(314*t + 90)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.9,Page number 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import cmath\n",
+ "import math\n",
+ "from sympy import *\n",
+ "import sympy\n",
+ "\n",
+ "#Variable declarations\n",
+ "V1, V2=symbols('V1 V2')\n",
+ "\n",
+ "#Calculations\n",
+ "V = 0.3*V1 #voltage(V)\n",
+ "I1 = 0.007*V1 #current \n",
+ "y11 = I1/V1 #y parameter\n",
+ "\n",
+ "I2 = -V/40 #current \n",
+ "y21 = I2/V1 #y parameter\n",
+ "\n",
+ "I2 = V2/(((40+100)*200.)/((40+100)+200.)) #y parameter\n",
+ "y22 = I2/V2 #incorrect answer in textbook #y parameter\n",
+ "\n",
+ "I1 = (-I2*200)/300 #current \n",
+ "y12 = I1/V2 #y parameter\n",
+ "\n",
+ "#Results\n",
+ "print \"y11+y12 is\",round(y11+y12,5),\"mho\"\n",
+ "print \"y22+y12 is\",round(y22+y12,5),\"mho\"\n",
+ "print \"y21-y12 is\",round(y21-y12,5),\"mho\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "y11+y12 is -0.0011 mho\n",
+ "y22+y12 is 0.00405 mho\n",
+ "y21-y12 is 0.0006 mho\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.10,Page number 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "\n",
+ "#port 2 open circuited,port 1 excited\n",
+ "z11=1075+1075j #as z11=V1/I1=(1.52<45)/(10**-3<0)=1075+1075j\n",
+ "z21=2022-1075j #as z21=V2/I1=(2.29<-28)/(10**-3<0)=2022+1075j\n",
+ "\n",
+ "#port 1 open circuited and port 2 excited\n",
+ "z12=-1075j #as z12=V1/I2=(1.075<-90)/(10**3<0)=-1075j\n",
+ "z22=751-1073j #as z22=V2/I2=(1.31<-55)/(10**-3<0)=751-j1073\n",
+ "\n",
+ "#Calculations\n",
+ "z=z11-z12 #parameters with reference to circuit\n",
+ "z1=z22-z12\n",
+ "z2=z21-z12\n",
+ "\n",
+ "#Results\n",
+ "print\"z11-z12(z) is\",z\n",
+ "print\"z22-z12(z1) is\",z1\n",
+ "print\"z21-z12(z2) is\",z2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "z11-z12(z) is (1075+2150j)\n",
+ "z22-z12(z1) is (751+2j)\n",
+ "z21-z12(z2) is (2022+0j)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.11,Page number 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V2=6/7. #voltage source(V)\n",
+ "\n",
+ "#Calculations \n",
+ "Rth=V2 #thevinin resistance(ohms)\n",
+ "Zl=Rth #load resistance(ohms)\n",
+ "\n",
+ "#Result\n",
+ "print\"load resistance is\",round(Zl,3),\"ohms\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "load resistance is 0.857 ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |