In [1]:

```
#Question:
"""Calculating the resistance of a wire."""
#Variable Declaration:
""" R=(rho*L)/A
R=Resistance of conductor;
L=Length of conductor;
d=diameter of conductor;
A=Area of Cross Section of conductor=(pi*d*d)/4; """
R1=5 #Resistance of conductor(in Ohms)
""" L2=4L1;
d2=0.5d1;
A1=(pi*d1*d1)/4;
A2=(pi*d2*d2)/4=(pi*d1*d1)/16 ;
rho1=rho2=rho(As both the conductors are made of the same material);
R1=(rho*L1)/A1;
R2=(rho*L2)/L2;
R2/R1=(rho*(L2/A2)/(rho*(L1/A1)) """
#Calculations:
R2=R1*(4/1)*(2/1)*(2/1)
#Result:
print "The required value of resistance is: %d Ohms." % (R2)
```

In [2]:

```
#Question:
"""Finding resistance of Copper wire."""
#Variable Declaration:
""" R=(rho*L)/A
R=Resistance of conductor;
L=Length of conductor;
d=diameter of conductor;
A=Area of Cross Section of conductor=(pi*d*d)/4; """
R1=10 #Resistance of Copper Wire(in Ohms)
""" L2=3L1;
d2=0.5d1;
A2=A1/3;(If the length of the wire is made three times by drawing it,its area of cross section must
decrease three times as the volume of the wire remains same in the drawing process.)
rho1=rho2=rho(As both the conductors are made of the same material);
R1=(rho*L1)/A1;
R2=(rho*L2)/L2;
R2/R1=(rho*(L2/A2)/(rho*(L1/A1))
R2=R1*(L2/L1)*(A1/A2) """
#Calculations:
R2=R1*(3/1)*(3/1)
#Result:
print "The required value of resistance is: %d Ohms." % (R2)
```

In [3]:

```
#Question:
"""Finding the voltage across the four resistors."""
#Variable Declaration:
""" Req=(4+4)||(8+4) """
Req=(8.0*12)/(8+12) #Equivalent Resistance of the circuit(in Ohms)
I=5 #Current in the circuit(in Amperes)
#Calculations:
V=I*Req
V1=(4.0*V)/(4+4)
V2=(4.0*V)/(4+4)
V3=(8.0*V)/(8+4)
V4=(4.0*V)/(8+4)
#Result:
print "The voltage across resistor 1 is: %d V." % (V1)
print "The voltage across resistor 2 is: %d V." % (V2)
print "The voltage across resistor 3 is: %d V." % (V3)
print "The voltage across resistor 4 is: %d V." % (V4)
```

In [2]:

```
#Question:
"""Finding the currents through and voltage across the resistors."""
#Variable Declaration:
I=2.0 #Current in Circuit(in Amperes)
R1=2.0 #Resistance of resistor 1(in Ohms)
R2=4.0 #Resistance of resistor 2(in Ohms)
R3=6.0 #Resistance of resistor 3(in Ohms)
#Calculations:
Rp=1/((1/R2)+(1/R3))
Req=R1+Rp
Vs=I*Req
v1=Vs*(R1/(R1+Rp))
v2=Vs*(Rp/(R1+Rp))
v3=v2
i1=I
i2=v2/R2
i3=v3/R3
#Result:
print "The current i1= %.2f A.\nThe current i2= %.2f A.\nThe current i3= %.2f A." %(i1,i2,i3)
print "The voltage v1= %.2f V.\nThe voltage v2= %.2f V.\nThe voltage v3= %.2f V.\n" %(v1,v2,v3)
```

In [15]:

```
#Question:
"""Finding the effective resistance."""
from sympy import *;
#Calculations:
Rp=1.0/((1.0/20)+(1.0/10)+(1.0/20))
R_AB_1=15+Rp
R = symbols('R')
R1=1.0/((1.0/2.0)+1.0)+ 1.0
R2=R1
R_AB_2= 1.0/((1/R1)+(1/R2)+(1))
R_AB_b=round(R_AB_2,4)*R
R3=1.0/((1.0/3)+(1.0/6)) + 18
R_AB_3= 1.0/((1.0/20)+(1/R3)) + 5
#Result:
print "(a)The effective resistance between points A and B for the combination of resistances is R_AB = %.2f Ohms." %(R_AB_1)
print "(b)The effective resistance between points A and B for the combination of resistances is R_AB = %s Ohms." %(R_AB_b)
print "(c)The effective resistance between points A and B for the combination of resistances is R_AB = %.2f Ohms." %(R_AB_3)
```

In [3]:

```
#Question:
"""Finding currents in parallel branches."""
#Variable Declaration:
V=100 #Voltage of the DC source(in Volts)
#Calculations:
Reff= 2+ (1.0/((1.0/12)+(1.0/20)+(1.0/30)))+2
I=V/Reff
""" Applying Ohm's Law, we have 12*I1=20*I2=30*I3;
I2=0.6*I1; I3=0.4*I1 """
""" I=I1+I2+I3; """
I1=I/(0.6+0.4+1)
I2=0.6*I1
I3=0.4*I1
#Result:
print "The current I1= %.2f A.\nThe current I2= %.2f A.\nThe current I3= %.2f A." %(I1,I2,I3)
```

In [4]:

```
#Question:
"""Finding the supply current I."""
from math import sqrt
#Variable Declaration:
P=20.0 #Power dissipated by resistor(in Watts)
RL=5.0 #Resistance of the load resistor(in Ohms)
R=10.0 #Resistance of resistor(in Ohms)
#Calculations:
I1=sqrt(P/RL)
I=(I1*(R+RL))/R
#Result:
print "The supply current( I ) is %d A."%(I)
```

In [5]:

```
#Question:
"""Finding voltage and the total power dissipated."""
#Variable Declaration:
V=120.0 #Voltage of the power line(in Volts)
P_bulb=60.0 #Power rating of the bulb(in Watts)
V_bulb=120.0 #Voltage rating of the bulb(in Volts)
#Calculations:
R=(V_bulb*V_bulb)/P_bulb
R_A=R
R_B=R
R_C=R
R_BC=1.0/((1.0/R)+(1.0/R))
V_B=V*(R_BC/(R_BC+R_A))
V_C=V*(R_BC/(R_BC+R_A))
V_A=V-V_B
P_A=(V_A*V_A)/R_A
P_B=(V_B*V_B)/R_B
P_C=(V_C*V_C)/R_C
P=P_A+P_B+P_C
#Result:
print "The voltage across bulb A is %.2f V. \nThe voltage across bulb B is %.2f V. \nThe voltage across bulb C is %.2f V." %(V_A,V_B,V_C)
print "The total power dissipated in the three bulbs is %.2f W." %(P)
```

In [6]:

```
#Question:
"""Designing a variable resistor."""
#Variable Declaration:
R1=30.0 #Resistance of the resistor(in Ohms)
#Calculations:
R2=75-R1
Req=(30+75)/2.0
Rp=Req-R1
R=1/((1/Rp)-(1/R2))
#Result:
print "(a)Minimum value of Req is obtained when R=0(i.e.,a short circuit,because the parallel combination of R2 and R is reduced to 0)."
print " Maximum value of Req is obtained when R is an open ciruit.\n Hence, R1 = %.2f Ohms and R2 = %.2f Ohms. \n " %(R1,R2)
print "(b)The resistance R to give Req=(30+75)/2 ohm is R = %.2f Ohms." %(R)
```

In [7]:

```
#Question:
"""Finding the equivalent resistance for the infinite ladder network."""
from math import sqrt
#Variable Declaration:
""" If we remove the first two resistances(i.e. the first rung of the ladder), the remaining circuit across the terminals C and D
has an equivalent resistance ,which must be double of the original ladder. If R_AB=Rx, then R_CD=2*Rx; """
""" Rx=R + (R || (2*Rx)) ; (2*Rx*Rx)-(3*Rx*R)-(R*R);"""
""" The roots of the above quadratic equation is solved using Shreedharacharya's Formula"""
""" We ignore the negative root as Resistance cannot be negative"""
a=2.0 #Coefficient of squared term in a quadratic equation
b=-3.0 #Coefficient of first degree term in a quadratic equation
c=-1.0 #Constant term in a quadratic equation
#Calculations:
Rx=((-b)+sqrt((b*b)-(4*a*c)))/(2*a)
#Result:
print "The equivalent resistance between terminals A and B in terms of resistance R,for the infinite ladder network is %.2fR Ohms." %(Rx)
```

In [8]:

```
#Question:
"""Converting the pi-section into equivalent T-section."""
#Variable Declaration:
R1=3.0 #First resistance of pi-section(in Ohms)
R2=9.0 #Second resistance of pi-section(in Ohms)
R3=6.0 #Third resistance of pi-section(in Ohms)
#Calculations:
Ra=(R2*R3)/(R1+R2+R3)
Rb=(R1*R3)/(R1+R2+R3)
Rc=(R1*R2)/(R1+R2+R3)
#Result:
print "The resistance Ra is %.2f Ohms." %(Ra)
print "The resistance Rb is %.2f Ohm." %(Rb)
print "The resistance Rc is %.2f Ohms." %(Rc)
```

In [9]:

```
#Question:
"""Finding the resistance of the coil."""
#Variable Declaration:
""" Reff is the effective resistance of the two coils. """
V=100.0 #Voltage of the dc supply(in Volts)
I=10.0 #Current drawn from the supply(in Amperes)
P=600.0 #Power dissipated in one coil(in Watts)
#Calculations:
Reff=V/I
R1=(V*V)/P
R2=(Reff*R1)/(R1-Reff)
#Result:
print "The resistance of first coil is: %.2f Ohms." %(R1)
print "The resistance of second coil is: %.2f Ohms." %(R2)
```

In [10]:

```
#Question:
"""Finding the cost of the boiler operation."""
#Variable Declaration:
I=12.0 #Current drawn by the electric boiler(in Amperes)
V=115.0 #Operating voltage of the electric boiler(in Volts)
t=6.0 #Time of operation of the electric boiler(in hours)
#Calculations:
W=(V*I*t)/1000
Rate=2.50
cost=W*Rate
#Result:
print "The cost of boiler operation is Rs. %.2f." %(cost)
```

In [11]:

```
#Question:
"""To find the effect of supply on the rating of toaster."""
#Variable Declaration:
V_rated=240.0 #Voltage rating of the toaster(in Volts)
P_rated=1000.0 #Power rating of the toaster(in Watts)
V=220.0 #Voltage of the supply(in Volts)
#Calculations:
R_toaster=(V_rated*V_rated)/P_rated
I_rated=P_rated/V_rated
I=V/R_toaster
P_consumed=V*I
#Result:
print "The rated current is %.2f A." %(I_rated)
print "The power rating is %.2f W." %(P_rated)
print "The current drawn is %.2f A." %(I)
if (I>I_rated): print("The toaster will be damaged as the current is greater than the rated current. \n")
elif(I<I_rated): print("The toaster will not be damaged as the current is lesser than the rated current. \n")
else: print("The toaster will not be damaged as the current is equal to the rated current. \n")
print "The power consumed is %.2f W." %(P_consumed)
if (P_consumed>P_rated): print("The rating will be affected as the power consumed is greater than the power rating. \n")
elif(P_consumed<P_rated): print("The rating will not be affected as the power consumed is lesser than the power rating. \n")
else: print("The rating will not be affected as the power consumed is equal to the power rating. \n")
```

In [12]:

```
#Question:
"""To find the range of resistance of a colour coded resistor."""
#Variable Declaration:
Yellow=4.0 #Mutilplier corresponding to yellow band
Violet=7.0 #Mutilplier corresponding to violet band
Orange=1.0e03 #Mutilplier corresponding to orange band
Gold=5.0/100 #Mutilplier corresponding to gold band
#Calculations:
R=((Yellow*10)+Violet)*Orange
Rmin=R-(Gold*R)
Rmax=R+(Gold*R)
#Result:
print "The resistance should be between %.2f kilo Ohms and %.2f kilo Ohms." %(Rmin/1000,Rmax/1000)
```

In [13]:

```
#Question:
"""To find the range of resistance of a colour coded resistor."""
#Variable Declaration:
Gray=8.0 #Mutilplier corresponding to gray band
Blue=6.0 #Mutilplier corresponding to blue band
Gold_3=1.0e-01 #Mutilplier corresponding to first gold band
Gold_4=5.0/100 #Mutilplier corresponding to second gold band
#Calculations:
R=((Gray*10.0)+Blue)*Gold_3
Rmin=R-(Gold_4*R)
Rmax=R+(Gold_4*R)
#Result:
print "The resistance should be between %.2f Ohms and %.2f Ohms." %(Rmin,Rmax)
```

In [14]:

```
#Question:
"""Finding the resistance at a given temperature."""
#Variable Declaration:
R1=126 #Resistance of transmission at 20 degrees Celsius(in Ohms)
T1=20 #Initial temperature(in degrees Celsius)
T2=-35 #Final temperature(in degrees Celsius)
temp_coeff=0.00426 #Temperature coefficient of the material of transmission(in Ohm per degree per Ohm)
#Calculations:
R2=(1+(temp_coeff*T2))*(R1/(1+(temp_coeff*T1)))
#Result:
print "The resistance of the line at -35 degree Celsius is %.2f Ohms." %(R2)
```

In [15]:

```
#Question:
"""Finding the temperature rise for change in resistance value."""
#Variable Declaration:
R1=3.42 #Resistance of Copper winding at room temperature(in Ohms)
T1=20 #Room temperature(in degrees Celsius)
R2=4.22 #Resistance of Copper winding after an extended operation of motor(in Ohms)
temp_coeff=0.00426 #Temperature coefficient of Copper(in Ohm per degree per Ohm)
#Calculations:
T2=(((R2*(1+(temp_coeff*T1)))/R1)-1)/temp_coeff
temp_rise=T2-T1
#Result:
print "The temperature rise is %.2f degree Celsius." %(temp_rise)
```

In [16]:

```
#Question:
"""Finding the ratio of resistances and lengths of two wires."""
#Variable Declaration:
k=1.0 #Resistance per metre of the metallic wire(in Ohms)
#Calculations:
""" x is the length of the wire 'P'.
R_P=k*x;
R_Q=k*(1-x);
R_R=4*R_P;(because length of 'R' is two times length of 'P',the area of cross-section reduces to half.Resistance is directly
proportional to length and inversely proportional to area of cross-section.) """
x=1.0/(1+4)
R_P=k*x
R_Q=(1.0-x)*k
R_R=R_Q
ratio_res=R_P/R_R
ratio_len=x/(1-x)
#Result:
print "(a)The ratio of resistances of P and R is %.2f:1. " %(ratio_res)
print "(b)The ratio of lengths of P and Q is %.2f:1. " %(ratio_len)
```

In [17]:

```
#Question:
"""Finding the equivalent resistance."""
#Variable Declaration:
#Calculations:
R1=1.0/((1.0/5)+(1.0/6))
R2=1.0/((1.0/4)+(1.0/3))
R_AB_1=R1+R2
R3=6+(1.0/((1.0/6)+(1.0/12)))
R4=1.0/((1.0/R3)+(1.0/10))
R_AB_2=2+R4+3
#Result:
print "(a)The resistance between terminals A and B is %.2f Ohms." %(R_AB_1)
print "(b)The resistance between terminals A and B is %.2f Ohms." %(R_AB_2)
```

In [18]:

```
#Question:
"""Finding the pd between two corners."""
#Variable Declaration:
I=20e-03 #Current entering the cube(in Amperes)
#Calculations:
Rp1=12/3
Rp2=12/6
Rp3=Rp1
R_AG=Rp1+Rp2+Rp3
V_AG=R_AG*I
#Result:
print "The potential difference across the corners A and G is %.2f V." %(V_AG)
```

In [19]:

```
#Question:
"""Finding equivalent resistance between points E and F."""
#Calculations:
#The delta connection between points A,B and C is first converted into its equivalent star connection by creating a new node 'O'.
R_AO=(4.0*6.0)/(2.0+4.0+6.0)
R_BO=(2.0*6.0)/(2.0+4.0+6.0)
R_CO=(2.0*4.0)/(2.0+4.0+6.0)
R_EF=(8.0*(8+(32.0/3)))/(8.0+(8.0+(32.0/3)))
#Result:
print "The equivalent resistance between points E and F is %.2f Ohms." %(R_EF)
```

In [20]:

```
#Question:
"""Find the current drawn from the 5-V supply."""
#Variable Declaration:
V=5 #Voltage from the battery(in Volts)
#Calculations:
""" The star connection between A,C and D can be converted into its equivalent delta connection. """
R1=((2*3)+(3*2)+(2*2))/3.0
R2=((2*3)+(3*2)+(2*2))/2.0
R3=((2*3)+(3*2)+(2*2))/2.0
"""It is important to note that point B is lost during the process of star-to-delts transformation. """
R4=((16.0/3)*(32.0/9))/((16.0/3)+(32.0/9))
R5=R4+3
I=V/R5
#Result:
print "The current I drawn from the battery is %.4f A." %(I)
```

In [21]:

```
#Question:
"""Finding the current and the pd between A and B."""
from math import sqrt
#Variable Declaration:
P=488.0 #Total power dissipated(in Watts)
#Calculations:
R_CD=1.0/((1.0/5)+(1.0/20)+(1.0/2.5))
R_AB=R_CD+10
V=sqrt(P*R_AB)
I=V/R_AB
V_CD=V-(10*I)
I1=V_CD/5.0
I2=V_CD/20.0
I3=V_CD/2.5
#Result:
print " The current I1= %.2f A." %(I1)
print " The current I2= %.2f A." %(I2)
print " The current I3= %.2f A." %(I3)
print " The pd between A and B is %.2f V." %(V)
```

In [23]:

```
#Question:
"""Finding the resistance R."""
#Variable Declaration:
V_AB=5 #Voltage between points A and B(in Volts)
#Calculations:
V_AC=15*(10.0/(10+5))
V_BA=-V_AB
V_BC=V_BA+V_AC
""" V_BC=15.0*(R/(2+R));
10+(5*R)=(15*R); """
R=10/10
#Result:
print "The value of resistance R is %.2f Ohm." %(R)
```

In [24]:

```
#Question:
"""Finding current supplied by the source."""
#Variable Declaration:
V=100 #Voltage of the supply(in Volts)
#Calculations:
R1=1.0/((1.0/6)+(1.0/3))
R2=5+3+R1
R_BC=1.0/((1.0/10)+(1/R2))
R3=5+R_BC
R_AD=1.0/((1.0/R3)+(1.0/10))
R_total=R_AD+5
I=V/R_total
"""The concept of current divider is used to find current I1 through the 6 Ohm resistance.At A,the 10 A current divides into
two parts: I_AD and I_AB.The current I_AB depends on the total resistance on the right of point A(which is 10 Ohms).Thus the two
currents will be equal.
I_AB= I_AD= 5 A.
I_AB divides equally into I_BC and I_BE.
I_BC= I_BE= 2.5 A. I_BE divides into I1 and I2. """
I_AB=I/2.0
I_AD=I_AB
I_BC=I_AB/2.0
I_BE=I_BC
I1=I_BE*(3.0/(3.0+6.0))
V_6=I1*6
#Result:
print "(a)The current supplied by the 100-V source is %.2f A." %(I)
print "(b)The voltage across the 6-Ohms resistance is %.2f V." %(V_6)
```

In [25]:

```
#Question:
"""Finding the resistance R."""
#Variable Declaration:
P=80 #Power dissipated(in Watts)
V=20 #Applied voltage(in Volts)
#Calculations:
Rp=1.0/((1.0/8)+(1.0/12)+(1.0/24))
""" R_total=R+Rp """
R_total=(V*V)/P
R=R_total-Rp
#Result:
print "The resistance R is %.2f Ohm." %(R)
```

In [26]:

```
#Question:
"""Finding the resistance R2."""
#Variable Declaration:
V=100.0 #Voltage of the supply(in Volts)
I=10.0 #Current drawn from the mains(in Amperes)
P=600.0 #Power dissipated in the resistor R1(in Watts)
#Calculations:
R1=(V*V)/P
I1=V/R1
I2=I-I1
R2=V/I2
#Result:
print "The resistance R2 is %.2f Ohms." %(R2)
```

In [27]:

```
#Question:
"""Finding the electrical energy generated per tonne of the fuel."""
#Variable Declaration:
P_out=50 #Output power(in kilo-Watts)
effi=0.35 #Efficiency of the diesel generating set
cal=12500 #Calorific value of the fuel(in kcal/kg)
#Calculations:
P_in=P_out/effi
Heat_per_hour=P_in*860
Fuel=Heat_per_hour/cal
ener=(P_out/Fuel)*1000
#Result:
print "(a)The quantity of oil needed per hour is %.2f kg." %(Fuel)
print "(b)The electrical energy generated per tonne of the fuel is %.2f kWh." %(ener)
```

In [28]:

```
#Question:
"""Finding the resistance of the heater and quantity of heat generated."""
from math import sqrt
#Variable Declaration:
R_A=10.0 #Resistance of heater A(in Ohms)
t_A=20 #Time of operation of heater-A(in minutes)
t_B=10 #Time of operation of heater-B(in minutes)
H_A=500 #Heat produced by heater-A in time t_A(in kcal)
H_B=1000 #Heat produced by heater-B in time t_B(in kcal)
#Calculations:
V=sqrt((H_A*4.2*1000*R_A)/(t_A*60))
R_B=(V*V*t_B*60)/(H_B*4.2*1000)
R=R_A+R_B
t=5*60
H=(((V*V)*t)/R)/(4.2*1000)
#Result:
print "(a)The resistance of heater-B is %.2f Ohms." %(R_B)
print "(b)The heat produced in 5 minutes when the two heaters are connected in series across the same supply voltage is %.2f kcal." %(H)
```

In [29]:

```
#Question:
"""Finding total current taken from the supply and energy consumed in a day."""
#Variable Declaration:
lamps=8 #Number of lamps
P_lamp=100 #Power rating of the lamp(in Watts)
fans=3 #Number of fans
P_fan=80 #Power rating of the fan(in Watts)
P_fridge=0.5 #Power rating of the fridge(in HP)
P_heater=1000 #Power rating of the Heater(in Watts)
V=230 #Voltage of the supply(in Volts)
#Calculations:
total_load=(lamps*P_lamp)+(fans*P_fan)+(P_fridge*746)+P_heater
I=total_load/V
ener=(total_load*(1.0/4)*24)/1000
#Result:
print "(a)The total current taken from the supply is %.2f A." %(I)
print "(b)The energy consumed in a day, if on an average only a quarter of the above load persists all the time is %.4f kWh." %(ener)
```