Chapter 1:Introduction to electrical engineering

Example 1.1:Page number-6

In [1]:
import math
q1=q2=0.1
r=1
e=8.84*(10**-12)
E=(q1*q2)/float(4*3.14*e*(r**2))
print "E=",format(E,'.2f'),"N"
E= 90065423.52 N

Example 1.2:Page number-7

In [38]:
import math
#given
q1=2*(10**-9)
q2=3*(10**-9)
#q1 and q2 are 6m apart in air
#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)))]
import sympy as sp
x=sp.Symbol('x')
sp.integrate(((3/(6-x)**2)-(2/x**2)),x)
from scipy.integrate import quad
import scipy.integrate
def f(x):
    return -(x+12)/(x**2 - 6*x)
i=quad(f,1,4)
print (i[0]),"J"
print "Vab=-vba=5.4V"
#the value obtained is directly given with print 
5.52146091786 J
Vab=-vba=5.4V

Example 1.3:Page number-11

In [2]:
import math
charge=1.6*(10**-19)
iav=1.6*(10**-19)*(10**19) #total charge movement per second
print "iav=",format(iav,'.1f'),"A"
iav= 1.6 A

Example 1.4:Page number-14

In [3]:
import math
p=30
i=10
v=p/i
dt=1
dq=i*dt
dw=v*dq
energy=dw/i
print "energy of each coulomb of charge=",format(energy,'.1f'),"J"
energy of each coulomb of charge= 3.0 J

Example 1.5

In [4]:
import math
#given
p=15000
n=1500
t=(60*p)/float(1500*2*3.14)
print "torque=",format(t,'.2f'),"Nm"
torque= 95.54 Nm

Example 1.6:Page number-16

In [2]:
import math
res=1.72*(10**-8)
l=200
a=25*(10**-6)
R=(res*l)/float(a)
print "R=",format(R,'.4f'),"ohm"
 R= 0.1376 ohm

Example 1.7

In [4]:
import math
#given and derived
meanrad=0.08
meanlen=3.14*meanrad
a=0.04*0.04
res=1.72*(10**-8)
R=(res*meanlen)/float(a)
print "R=",format(R,'.8f'),"ohm"
R= 0.00000270 ohm

Example 1.8:Page number-17

In [2]:
import math
res=0.02*(10**-6)
l=4000*80*(10**-2)
a=0.8*(10**-6)
R=(res*l)/float(a)
print "R=",format(R,'.4f'),"ohm"
power=(230*230)/float(80)
print "power=",format(power,'.2f'),"W"
R= 80.0000 ohm
power= 661.25 W

Example 1.9

In [11]:
import math
lal=7.5
lcu=6
rcu=0.017*(10**-6)
ral=0.028*(10**-6)
d=(10**-6)
a=((3.14*d))/float(4)
Ral=(lal*ral)/float(a)
print "R=",format(Ral,'.4f'),"ohm"
ial=3
pv=Ral*ial
Rcu=pv/float(2)
print Rcu
a=(rcu*lcu)/float(Rcu)
dcu=(((a*4)/3.14)**0.5)
print "dcu=",format(dcu,'.6f'),"nm"
R= 0.2675 ohm
0.40127388535
dcu= 0.000569 nm

Example 1.10

In [9]:
import math
#given and derived
a=100/0.32 #area required to dissipate 100W power
d=5
#length of cyclinder L,length of wire if l,diameter of the wire is d
L=a/float(3.14*d)
r=100/1**2
#spacing is d cm
#distance along the axis of the cylinder is 2d cm
#no of turns is 10/d
#length of one turn of the wire is 3.14*5 cm
#length of the wire is 50*3.14/d
res=10**-4
#d=(((2*10**-4))**(0.6))
d=0.058
l=(50*3.14)/d
print "l=",format(l,'.6f'),"cm"
l= 2706.896552 cm

Example 1.11: Page number-20

In [10]:
import math
#given
v=250
i=5
i1=3.91
t0=0.00426 #temperature coefficient
r15=v/i #at 15 degrees
rt=v/i1 #at t degrees
l=(rt*(1+t0*15))/50 #left hand side
t=(l-1)/t0
print "t=",format(t,'.2f'),"centigrade"
t= 84.62 centigrade

Example 1.12

In [11]:
import math
#this is a derivation by substitution problem
#al1=al0/(1+al0*t1)
#al2=al0/(1+al0*t2)
#where t1 and t2 are different temperatures al0,al1 and al2 are temperature coefficients
#substitute al0 in al2
#on deriving and solving for al2 we get,
print "al2=al1/(1+al1*(t1-t2))"
al2=al1/(1+al1*(t1-t2))

Example 1.13:Page number-22

In [12]:
import math
#values are obtained from the graph
i=10 #10t A for 0 to 1 second
d=10 #where di/dt is 10
L=2
# at one second
v=L*d
print "v=",format(v,'.1f'),"v"
#for 1 to 5 seconds
d=-5
#at t=3 seconds voltage across the inductor is
v=L*d
print "v=",format(v,'.1f'),"v"
v= 20.0 v
v= -10.0 v

Example 1.16:Page number-27

In [2]:
import math
#given
dv=20 #dv/dt
c=25*(10**-6)
#case a
i=c*dv
print "i=",format(i,'.4f'),"A"
#case b
q=c*dv
print "q=",format(q,'.4f'),"C"
#case c
p=dv*i
print "p=",format(p,'.4f'),"W"
#case d
v=dv**2
wc=(c*v)/2
print "wc=",format(wc,'.4f'),"J"
    
 i= 0.0005 A
q= 0.0005 C
p= 0.0100 W
wc= 0.0050 J

Example 1.18:Page number-34

In [3]:
import math
l=1
b=1.5
i=50
u=5
#case a
f=b*i*l
print "f=",format(f,'.1f'),"N"
#case b
p=f*u
print "p=",format(p,'.1f'),"W"
#case c
e=b*l*u
print "e=",format(e,'.1f'),"V"
f= 75.0 N
p= 375.0 W
e= 7.5 V

Example 1.19:Page number-35

In [5]:
import math
#e=b*l*u*sin(angle)
b=0.5
l=40
u=1.5
#when angle=90 sin(90)=1=s
s=1
e=b*l*u*s
print "e=",format(e,'.1f'),"V"
#when angle=30 sin(angle)=s=0.5
s=0.5
e=b*l*u*s
print "e=",format(e,'.1f'),"V"
e= 30.0 V
e= 15.0 V

Example 1.22:Page number-37

In [6]:
import math
#applying kcl to circuit at node b i3+i4=6-4=2
i3=i4=1 #potential of node b with respect to node c
vb=8
vba=2 #voltage drop across nodes b and a
va=6 #potential of node a w.r.t note c
i2=3
#applying kcl to node a
isa=1
vs=va+2*isa
print "vse=",format(vs,'.1f'),"V"
vse= 8.0 V
In [ ]: