# UNIT-5 Electricity¶

## Example no:5.1,Page no:152¶

In [71]:
#Variable declaration
n=10**6     #no. of electrons
e=1.6*10**-19   #charge on an electron in C

#Calculation
q=n*e    #calculating total charge
t=10**-3    #time in second
I=q/t     #calculating current

#Result
print"Current flowing  = ",I,"Ampere"

Current flowing  =  1.6e-10 Ampere


## Example no:5.2,Page no:152¶

In [20]:
#Variable declaration
I=300*10**-3    #current n Ampere
t=60    #time in second
e=1.6*10**-19   #chatge on electron in C

#Calculation
q=I*t   #calculating charge
n=q/e   #calculating no of electrons

#Result
print"No. of electrons = ",n

No. of electrons =  1.125e+20


## Example no:5.3,Page no:154¶

In [72]:
#Variable declaration
V=200   #voltage in volt
R=100   #resistance in Ohm
e=1.6*10**-19   #charge on an electron in C

#Calculation
I=V/R      #Ohm's law
t=1   #time in second
q=I*t   #calculating charge
n=q/e   #calculating no of electrons

#Result
print"No. of electrons = ",n

No. of electrons =  1.25e+19


## Example no:5.4,Page no:156¶

In [73]:
#Variable declaration
l=15    #length in m
A=6*10**-7   #area in m square
R=5   #resistance in Ohm

#Calculation
p=(A*R)/l   #calculating resistivity

#Result
print"Resistivity= ",p,"Ohm metre"

Resistivity=  2e-07 Ohm metre


## Example no:5.5,Page no:157¶

In [74]:
#Variable declaration
l=0.1    #length in m
A=10**-4   #area in m square
R=0.01   #resistance in Ohm

#Calculation
p=(A*R)/l   #calculating resistivity

#Result
print"Resistivity  = ",p,"Ohm metre"

Resistivity  =  1e-05 Ohm metre


## Example no:5.6,Page no:157¶

In [38]:
import math

#Variable declaration
L=1   #length in m
r=0.2*10**-3   #radius in m
R=2   #resistance in Ohm

#Calculation
A=math.pi*(r)**2   #calculating area
P=(R*A)/L   #calculating resistivity

#Result
print"Resistivity =%.2g"%P,"Ohm.metre"

Resistivity =2.5e-07 Ohm.metre


## Example no:5.7,Page no:158¶

In [75]:
#Variable declaration
R1=5    #resisitance in Ohm

#Calculation
#A2=A/3
#R2/5=3l*3/A*A/l
#R2=9*5

R2=9*R1   #calculating using R2/A1=(l2/A2)*(A1/l1)
print"Resisitance = ",R2,"Ohm"

Resisitance =  45 Ohm


## Example no:5.8,Page no:159¶

In [70]:
#Variable declaration
R1=5    #resisitance in Ohm

#Calculation
#A2=A/2
#R1=rho*l1/A1*R2
#R2=rho*l2/A2
#R2/R1=A1/l1
R2=4*R1   #calculating using R2/A1=(l2/A2)*(A1/l1)

#Result
print"Resisitance= ",R2,"Ohm"

Resisitance=  20 Ohm


## Example no:5.9,Page no:162¶

In [39]:
#Variable declaration
R1=2    #resisitance in Ohm
R2=4   #resistance in Ohm
R3=5    #resistance in Ohm

#Calculation
R=(R1**-1)+(R2**-1)+(R3**-1)   #calculating parallel resistance
Rp=(1/R)

#Result
print"Resisitance  = ",Rp,"Ohm"
print"\nNOTE:Incorrect answer in book"

Resisitance  =  1.05263157895 Ohm

NOTE:Incorrect answer in book


## Example no:5.10,Page no:163¶

In [24]:
from scipy.optimize import fsolve

#Variable declaration
Rs=40    #resisitance in Ohm

#Calculation
#R1+R2=40
#R1*R2=256
#R1=256/R2
#Putting this value in eq 1:
#(256/R2)+R2=40
from sympy import solve, symbols, pprint
R2= symbols('R2')
a=1
b=-40
c=256
f = a*R2**2 + b*R2 + c
solution = solve(f, R2)

#Result
print"When R2=",solution[0],"Ohm    R1=",solution[1],"Ohm"
print"When R2=",solution[1],"Ohm    R1=",solution[0],"Ohm"

When R2= 8 Ohm    R1= 32 Ohm
When R2= 32 Ohm    R1= 8 Ohm


## Example no:5.11,Page no:164¶

In [26]:
#Variable declaration
V=2.0      #in volts
R1=30.0    #resisitance in Ohm
R2=60.0   #resistance in Ohm

#Calculation
Rp=(R1*R2)/(R1+R2)   #calculating parallel resistance
I=V/Rp      #Ohm's law

#Result
print"Resisitance = ",Rp,"Ohm"
print"Current  = ",I,"A"

Resisitance =  20.0 Ohm
Current  =  0.1 A


## Example no:5.12,Page no:165¶

In [76]:
#Variable declaration
R1=2.0    #resisitance in Ohm
R2=3.0   #resistance in Ohm
R3=1.0    #resistance in Ohm

#Calculation
Rp=(R1*R2)/(R1+R2)   #calculating parallel resistance
R=Rp+1.0       #1 Ohm in series
Rs=(R1+R2+R3)   #series resistances
Rp=(1.0/R1)+(1.0/R2)+(1.0/R3)   #calculating parallel resistance

#Result
print"(1)Equivalent Resisitance= ",R,"Ohm"
print"(2)All resistances in series = ",Rs,"Ohm"
print"(3)All in Parallel  = ",(1/Rp),"Ohm"

(1)Equivalent Resisitance=  2.2 Ohm
(2)All resistances in series =  6.0 Ohm
(3)All in Parallel  =  0.545454545455 Ohm


## Example no:5.13,Page no:166¶

In [30]:
#Variable declaration
V=20     #voltage in Volts
R1=2.0    #resisitance in Ohm
R2=4.0   #resistance in Ohm
R3=5.0    #resistance in Ohm

#Calculation
Rp=(1/R1)+(1/R2)+(1/R3)   #calculating parallel resistance
R=1/Rp       #Parallel
I1=V/R1   #calculating current through R1
I2=V/R2   #calculating current through R2
I3=V/R3   #calculating current through R3
I=V/R    #calculating total current

#Result
print"(a)Equivalent Resisitance  = ",R,"Ohm"
print"Current through R1  = ",I1,"Ampere"
print"Current through R2 = ",I2,"Ampere"
print"Total current  = ",I,"Ampere"

(a)Equivalent Resisitance  =  1.05263157895 Ohm
Current through R1  =  10.0 Ampere
Current through R2 =  5.0 Ampere
Total current  =  19.0 Ampere


## Example no:5.14,Page no:166¶

In [33]:
#Variable declaration
R=7           #Total resistanc of combination

#Calculation
def f(n):
Rp = 6*(1/n)   #resistance in parallel
return(R-Rp-5)
n=fsolve(f,1)

#Result
print"n=",n[0]

n= 3.0


## Example no:5.15,Page no:173¶

In [36]:
#Variable declaration
R1=2   #resistance in Ohm
R2=6    #resistance in Ohm
R3=3   #resistance in Ohm
V=24    #voltage in volts
R=8     #resistance in Ohm

#Calculation
I=V/R  #Ohm's Law
V1=I*R1   #Ohm's Law
V2=I*R2   #Ohm's Law
V3=I*R3   #Ohm's Law

#Result
print"Current  = ",I,"Ampere"
print"Voltage drop across R1 = ",V1,"Volts"
print"Voltage drop across R2  = ",V2,"Volts"
print"Voltage drop across R3  = ",V3,"Volts"
print"\nNOTE:Wrong answer of R3 in book"

Current  =  3 Ampere
Voltage drop across R1 =  6 Volts
Voltage drop across R2  =  18 Volts
Voltage drop across R3  =  9 Volts

NOTE:Wrong answer of R3 in book


## Example no:5.16,Page no:173¶

In [37]:
#Variable declaration
R=15   #resistance in Ohm
print"KVL: 16I1+15I2=6   (1)"  #KVL equation
I1=-1.66   #from(1)
I2=2.17   #from (1)
#Calculation
V=(I1+I2)*R   #calculating potential difference

#Result
print"Potential difference= ",V,"Volt"

KVL: 16I1+15I2=6   (1)
Potential difference=  7.65 Volt


## Example no:5.17,Page no:174¶

In [77]:
print"3I1-I2-1=0   (1)"    #KVL equation
print"3I1-I2+2I=2  (2)"    #KVL equation
print"3I1-I1+2I=2  (3)"    #KVL equation

#Variable declaration
I1=4/17.0   #from (1)(2)(3)through AB
I2=-2/17.0  #from (1)(2)(3)through BD
I=3*I1+I2   #from (1)(2)(3)through main circuit

#Calculation
Ibc=I1-I2  #calculating current in BC
Iad=I-I1   #calculating current in AD
Idc=I-I1+I2   #calculating current in DC

#Result
print"Current in branch BC = ",Ibc,"Ampere"
print"NOTE:Calculation mistake in book while calculating for BC"
print"Current in branch AD = ",Iad,"Ampere"
print"Current in branch DC = ",Idc,"Ampere"

3I1-I2-1=0   (1)
3I1-I2+2I=2  (2)
3I1-I1+2I=2  (3)
Current in branch BC =  0.352941176471 Ampere
NOTE:Calculation mistake in book while calculating for BC
Current in branch AD =  0.352941176471 Ampere
Current in branch DC =  0.235294117647 Ampere


## Example no:5.18,Page no:176¶

In [78]:
#Variable declaration
P=10   #Ohm
Q=3    #Ohm
R=12   #Ohm
S=6   #Ohm
G=20   #Ohm

#Calculation
print"-12I+22I1+IgG=0  (1)"   #KVL
print"6I-9I1+29Ig=0  (2)"  #KVL
print"13I1-3Ig=2  (3)"   #KVL
#From above equations
import numpy as np
a = np.array([[-12,22,20],[6,-9,29],[0,13,-3]])
b = np.array([[0],[0],[2]])
np.linalg.solve(a,b)

#Result
print"Current through Galvanometer = ",round(Ig*1000,2),"mA"

-12I+22I1+IgG=0  (1)
6I-9I1+29Ig=0  (2)
13I1-3Ig=2  (3)
Current through Galvanometer =  7.8 mA


## Example no:5.19,Page no:179¶

In [79]:
#Variable declaration
P=500   #power in Watts
V=200   #voltage in Volts
V1=160   #voltage in Volts

#Calculation
R=(V**2)/P   #using P=V**2*R
P1=(V1**2)/R   #calculating power
Dp=500-P1   #drop in heat
D=(Dp*100)/500   #percentage drop

#Result
print"Resistance= ",R,"Ohm"
print"% Drop in heat production = ",D,"%"

Resistance=  80 Ohm
% Drop in heat production =  36 %


## Example no:5.20,Page no:180¶

In [80]:
#Variable declaration
P1=100   #power in Watts
P2=500   #power in Watts

#Calculation
P=P2/P1   #ratio

#Result
print "P=",P
print"P>0,I2=5I Therefore I2>I1"

P= 5
P>0,I2=5I Therefore I2>I1


## Example no:5.21,Page no:181¶

In [81]:
#Variable declaration
t=1200   #time in second
P=100   #power in Watts
V=230   #voltage in Volts

#Calculation
R=(V**2)/P   #calculating resistance
V1=115   #supply voltage in Volts
E=((V1**2)*t)/R   #calculating energy

#Result
print"Energy dissipated by bulb = ",E,"J"

Energy dissipated by bulb =  30000 J


## Example no:5.22,Page no:181¶

In [56]:
#Variable declaration
P=10**4   #power in Watts
V=250   #voltage in Volts
R=0.2   #resistance in ohm

#Calculation
Pl=((P/V)*(P/V))*R   #calculating power loss
print P1
E=P/(Pl+P)   #calculating efficiency

#Result
print"Percent Efficiency = ",round(E*100),"%"

100
Percent Efficiency =  97.0 %


## Example no:5.23,Page no:182¶

In [59]:
#Variable declaration
P=100.0   #power in Watts
V=220.0   #voltage in Volts

#Calculation
I=P/V   #Current in Ampere
R=V/I   #resistance

#Result
print"Current  = ",round(I,3),"A"
print"Resistance=",R,"Ohm"

Current  =  0.455 A
Resistance= 484.0 Ohm


## Example no:5.24,Page no:182¶

In [82]:
#Variable declaration
V=50   #voltage in Volts
I=12   #Current in Ampere

#Calculation
P=V*I   #power
Pd=P*0.7   #power dissipated
R=(Pd/(I)**2)

#Result
print"Resistance = ",round(R,2),"Ohm"

Resistance =  2.92 Ohm