{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1:Introduction to electrical engineering" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.1:Page number-6" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "E= 90065423.52 N\n" ] } ], "source": [ "import math\n", "\n", "q1=q2=0.1\n", "r=1\n", "e=8.84*(10**-12)\n", "\n", "E=(q1*q2)/float(4*3.14*e*(r**2))\n", "\n", "print \"E=\",format(E,'.2f'),\"N\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.2:Page number-7" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "5.52146091786 J\n", "Vab=-vba=5.4V\n" ] } ], "source": [ "import math\n", "\n", "#given\n", "\n", "q1=2*(10**-9)\n", "q2=3*(10**-9)\n", "\n", "#q1 and q2 are 6m apart in air\n", "#on substituting the values in the formula for calculating force between q and q1 and q and q2 we get 9[(3/(6-x**2)-(2/(x**2)))]\n", "\n", "import sympy as sp\n", "x=sp.Symbol('x')\n", "sp.integrate(((3/(6-x)**2)-(2/x**2)),x)\n", "\n", "from scipy.integrate import quad\n", "import scipy.integrate\n", "\n", "def f(x):\n", " return -(x+12)/(x**2 - 6*x)\n", " \n", " \n", " \n", "\n", "i=quad(f,1,4)\n", "print (i[0]),\"J\"\n", "\n", "\n", "print \"Vab=-vba=5.4V\"\n", "\n", "#the value obtained is directly given with print \n", "\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.3:Page number-11" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "iav= 1.6 A\n" ] } ], "source": [ "import math\n", "\n", "charge=1.6*(10**-19)\n", "iav=1.6*(10**-19)*(10**19) #total charge movement per second\n", "\n", "print \"iav=\",format(iav,'.1f'),\"A\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.4:Page number-14" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "energy of each coulomb of charge= 3.0 J\n" ] } ], "source": [ "import math\n", "\n", "p=30\n", "i=10\n", "\n", "v=p/i\n", "dt=1\n", "dq=i*dt\n", "\n", "dw=v*dq\n", "energy=dw/i\n", "\n", "print \"energy of each coulomb of charge=\",format(energy,'.1f'),\"J\"\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.5" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "torque= 95.54 Nm\n" ] } ], "source": [ "import math\n", "\n", "#given\n", "\n", "p=15000\n", "n=1500\n", "\n", "t=(60*p)/float(1500*2*3.14)\n", "\n", "print \"torque=\",format(t,'.2f'),\"Nm\"\n" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Example 1.6:Page number-16" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " R= 0.1376 ohm\n" ] } ], "source": [ "import math\n", "\n", "res=1.72*(10**-8)\n", "l=200\n", "a=25*(10**-6)\n", "\n", "R=(res*l)/float(a)\n", "\n", "print \"R=\",format(R,'.4f'),\"ohm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.7 " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "R= 0.00000270 ohm\n" ] } ], "source": [ "import math\n", "\n", "#given and derived\n", "meanrad=0.08\n", "meanlen=3.14*meanrad\n", "a=0.04*0.04\n", "res=1.72*(10**-8)\n", "\n", "R=(res*meanlen)/float(a)\n", "\n", "print \"R=\",format(R,'.8f'),\"ohm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.8:Page number-17 " ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "R= 80.0000 ohm\n", "power= 661.25 W\n" ] } ], "source": [ "import math\n", "\n", "res=0.02*(10**-6)\n", "l=4000*80*(10**-2)\n", "a=0.8*(10**-6)\n", "\n", "R=(res*l)/float(a)\n", "\n", "print \"R=\",format(R,'.4f'),\"ohm\"\n", "\n", "power=(230*230)/float(80)\n", "\n", "print \"power=\",format(power,'.2f'),\"W\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.9" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "R= 0.2675 ohm\n", "0.40127388535\n", "dcu= 0.000569 nm\n" ] } ], "source": [ "import math\n", "\n", "lal=7.5\n", "lcu=6\n", "rcu=0.017*(10**-6)\n", "ral=0.028*(10**-6)\n", "d=(10**-6)\n", "a=((3.14*d))/float(4)\n", "Ral=(lal*ral)/float(a)\n", "\n", "print \"R=\",format(Ral,'.4f'),\"ohm\"\n", "\n", "ial=3\n", "\n", "pv=Ral*ial\n", "\n", "\n", "Rcu=pv/float(2)\n", "print Rcu\n", "\n", "a=(rcu*lcu)/float(Rcu)\n", "\n", "dcu=(((a*4)/3.14)**0.5)\n", "\n", "print \"dcu=\",format(dcu,'.6f'),\"nm\"\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.10" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "l= 2706.896552 cm\n" ] } ], "source": [ "import math\n", "\n", "#given and derived\n", "\n", "a=100/0.32 #area required to dissipate 100W power\n", "d=5\n", "#length of cyclinder L,length of wire if l,diameter of the wire is d\n", "L=a/float(3.14*d)\n", "\n", "r=100/1**2\n", "\n", "#spacing is d cm\n", "#distance along the axis of the cylinder is 2d cm\n", "\n", "#no of turns is 10/d\n", "#length of one turn of the wire is 3.14*5 cm\n", "#length of the wire is 50*3.14/d\n", "res=10**-4\n", "\n", "#d=(((2*10**-4))**(0.6))\n", "d=0.058\n", "\n", "l=(50*3.14)/d\n", "\n", "print \"l=\",format(l,'.6f'),\"cm\"\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.11: Page number-20" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "t= 84.62 centigrade\n" ] } ], "source": [ "import math\n", "\n", "#given\n", "v=250\n", "i=5\n", "i1=3.91\n", "\n", "t0=0.00426 #temperature coefficient\n", "\n", "r15=v/i #at 15 degrees\n", "\n", "rt=v/i1 #at t degrees\n", "\n", "l=(rt*(1+t0*15))/50 #left hand side\n", "\n", "t=(l-1)/t0\n", "\n", "print \"t=\",format(t,'.2f'),\"centigrade\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.12" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "al2=al1/(1+al1*(t1-t2))\n" ] } ], "source": [ "import math\n", "\n", "#this is a derivation by substitution problem\n", "\n", "#al1=al0/(1+al0*t1)\n", "#al2=al0/(1+al0*t2)\n", "#where t1 and t2 are different temperatures al0,al1 and al2 are temperature coefficients\n", "\n", "#substitute al0 in al2\n", "\n", "#on deriving and solving for al2 we get,\n", "print \"al2=al1/(1+al1*(t1-t2))\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.13:Page number-22" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "v= 20.0 v\n", "v= -10.0 v\n" ] } ], "source": [ "import math\n", "\n", "#values are obtained from the graph\n", "\n", "i=10 #10t A for 0 to 1 second\n", "\n", "d=10 #where di/dt is 10\n", "L=2\n", "# at one second\n", "\n", "v=L*d\n", "\n", "print \"v=\",format(v,'.1f'),\"v\"\n", "\n", "#for 1 to 5 seconds\n", "\n", "d=-5\n", "\n", "#at t=3 seconds voltage across the inductor is\n", "\n", "v=L*d\n", "print \"v=\",format(v,'.1f'),\"v\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.16:Page number-27" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " i= 0.0005 A\n", "q= 0.0005 C\n", "p= 0.0100 W\n", "wc= 0.0050 J\n" ] } ], "source": [ "import math\n", "\n", "#given\n", "\n", "dv=20 #dv/dt\n", "c=25*(10**-6)\n", "\n", "#case a\n", "\n", "i=c*dv\n", "\n", "print \"i=\",format(i,'.4f'),\"A\"\n", "\n", "#case b\n", "q=c*dv\n", "\n", "print \"q=\",format(q,'.4f'),\"C\"\n", "\n", "#case c\n", "\n", "p=dv*i\n", "\n", "print \"p=\",format(p,'.4f'),\"W\"\n", "\n", "#case d\n", "v=dv**2\n", "wc=(c*v)/2\n", "\n", "print \"wc=\",format(wc,'.4f'),\"J\"\n", " " ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Example 1.18:Page number-34" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "f= 75.0 N\n", "p= 375.0 W\n", "e= 7.5 V\n" ] } ], "source": [ "import math\n", "\n", "l=1\n", "b=1.5\n", "i=50\n", "u=5\n", "\n", "#case a\n", "\n", "f=b*i*l\n", "\n", "print \"f=\",format(f,'.1f'),\"N\"\n", "\n", "#case b\n", "\n", "p=f*u\n", "\n", "print \"p=\",format(p,'.1f'),\"W\"\n", "\n", "#case c\n", "\n", "e=b*l*u\n", "\n", "print \"e=\",format(e,'.1f'),\"V\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.19:Page number-35" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "e= 30.0 V\n", "e= 15.0 V\n" ] } ], "source": [ "import math\n", "\n", "#e=b*l*u*sin(angle)\n", "\n", "b=0.5\n", "l=40\n", "u=1.5\n", "\n", "#when angle=90 sin(90)=1=s\n", "s=1\n", "e=b*l*u*s\n", "\n", "print \"e=\",format(e,'.1f'),\"V\"\n", "\n", "#when angle=30 sin(angle)=s=0.5\n", "s=0.5\n", "e=b*l*u*s\n", "\n", "print \"e=\",format(e,'.1f'),\"V\"\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.22:Page number-37" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vse= 8.0 V\n" ] } ], "source": [ "import math\n", "\n", "#applying kcl to circuit at node b i3+i4=6-4=2\n", "i3=i4=1 #potential of node b with respect to node c\n", "vb=8\n", "vba=2 #voltage drop across nodes b and a\n", "va=6 #potential of node a w.r.t note c\n", "i2=3\n", "#applying kcl to node a\n", "\n", "isa=1\n", "\n", "vs=va+2*isa\n", "\n", "print \"vse=\",format(vs,'.1f'),\"V\"\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "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.9" } }, "nbformat": 4, "nbformat_minor": 0 }