import math
#INPUT DATA
# details for the first wire
l1 = 1; #length in m
R1 = 2; #resistance in ohms
x = R1; #say
d = 1; #say
p = 1; #say
d1 = d; #say diameter in m
p1 = p; #say specific resistance of wire
#details for the second wire
l2 = 3; #length in m
d = 1; #say
p = 1; #say
d2 = 2*d; #say diameter in m
p2 = 2*p; #say specific resistance of wire
#CALCULATIONS
R1 = p1*l1/(math.pi*d*d/4); #(R1 = p1*l1/a1), where a1 is cross sectional area of first wire with diameter d as (math.pi*d*d/4)---------------equation 1
R2 = p2*l2/(math.pi*(4*d*d)/4); #(R2 = p2*l2/a2), where a2 is cross sectional area of second wire with diameter 2d as (math.pi*((2*d)*(2*d))/4)-------------equation 2
#dividing equation 1 by equation 2
z = R1/R2;
R2 = x/z;
#OUTPUT
print "Thus the resistance of second wire is %1.0f ohm "%(R2);
import math
#INPUT DATA
l1 = 20; #length in cm for first case
l2 = 0.4; #length in cm for second case
w = 0.1; #width in cm
t = 0.4; #thickness in cm
p = 1.7*10**-6 #resistivity of copper in ohm cm
a1 = 0.1*0.4 #area(w*t) in cm**2 for first case
a2 = 0.1*20 #area(l*t) in cm**2 for second case
#CALCULATIONS
R1 = p*l1/a1; #resistance in ohms for first case
R2 = p*l2/a2; #resistance in ohms for second case
#OUTPUT
print "Thus the resistance in first and second cases are %g ohms and %g ohms"%(R1,R2);
import math
#INPUT DATA
la = 1000; #length of aluminium wire in cm
da = 0.2; #diameter in cm
pa = 2.6*10**-6; #specific resistance of aluminium in ohm cm
pc = 1.6*10**-6; #specific resistance of copper in ohm cm
lc = 600; #length of copper wire in cm
i = 2; #current in A pasmath.sing through combination
ia = 1.25; #current in A pasmath.sing through aluminium wire
#CALCULATIONS
ic = i-ia; #current in A pasmath.sing through copper wire
#resistance of aluminium wire in ohms
Ra = pa*la/(math.pi*(da*da)/4); #(Ra = pa*la/a), where a is cross sectional area of aluminum wire with diameter da
Rc = ia/ic*Ra; #resistance of copper wire
dc = math.sqrt(4*pc*lc/Rc); #diameter of copper wire
#OUTPUT
print "Thus the diameter of copper wire is %1.3f cm "%(dc);
#note:The answer given for diameter in text book is wrong.please check the calculations
#INPUT DATA
l = 10000.; #length drawn from 10cc of copper in cm
p = 1.7*10**-6; #Resistivity of copper in ohm cm
v = 10.; #volume of copper in cc
s1 = 10.; #square sheet side in second case in cm
#CALCULATIONS
a = v/l; #area of cross-section in cm**2 in first case
R1 = p*l/a; #resistance of wire in first case in ohm
a1 = s1*s1; #area of cross-section in cm**2 in second case
l1 = v/a1; #thickness in case 2 in cm
R2 = p*l1/a1; #resistance of wire in second case in ohm
#OUTPUT
print "Thus the resistance in first and second cases are %g ohms and %g ohms"%(R1,R2);
#INPUT DATA
t1 = 40.; #temperature in degree centigrade
t2 = 100.; #temperature in degree centigrade
R1 = 3.146; #resistance of platinum coli at t1
R2 = 3.767; #resistance of platinum coli at t2
#CALCULATIONS
x = R1/R2;
a0 = ((R1-R2)/(R2*t1-R1*t2)); #temperature coefficient at 0 degree centigrade
R0 = R1/(1+(a0*t1)); #resistance at zero degree centigrade
a40 = a0/(1+(a0*t1)); #temperature coefficient at 40 degree centigrade
#OUTPUT
print "Thus the temperature coefficient at 0 degree centigrade, resistance at zero degree centigrade, \
\ntemperature coefficient at 40 degree centigrade are %f /degree centigrade , %f ohms, %f /degree centigrade\
\n respectively "%(a0,R0,a40);
#INPUT DATA
t1 = 12; #temperature in degree centigrade
t2 = 50; #temperature in degree centigrade
R1 = 0.4; #copper coil resistance in ohms
a0 = 0.004; #temperature coefficient of copper at zero degree centigrade
#CALCULATIONS
a12 = 1/((1/a0)+t1); #temperature coefficient at 12 degree centigrade
R2 = R1*(1+(a12*(t2-t1))); #resistance of copper wire in ohm at 52 degree centigrade
#OUTPUT
print "Thus the resistance copper wire at 52 degree centigrade is %1.2f ohm "%(R2);
#INPUT DATA
t1 = 20; #temperature in degree centigrade
R1 = 45; #shunt motor resistance at t1
R2 = 48.5; #new shunt resistance at t2
a0 = 0.004; #temperature coefficient of resistance at 0 degree centigrade
#CALCULATIONS
x = R1/R2;
t2 = ((1+(a0*t1)-x)/(a0*x));
#OUTPUT
print "Thus the temperature for new resistance is %d degree centigrade "%(t2);
#INPUT DATA
V = 180.; #supply voltage in volts
I1 = 4.; #initial current of coil in A
t1 = 20.; #initial temperature
I2 = 3.4; #new decreased current of coil in A at temperature t2
a0 = 0.0043; #temperature coefficient in per degree centigrade
#CALCULATIONS
R1 = V/I1; #initial resistance of coil in ohms
R2 = V/I2; #resistance of coil after some time in ohms
x = R1/R2;
t2 = (1+(a0*t1)-x)/(a0*x);
t = t2-t1; #temperature rise
#OUTPUT
print "Thus the temperature rise is %2.2f degree centigrade "%(t);
#INPUT DATA
t2 = 2750.; #temperature in degree centigrade for tungsten lamp
P = 150.; #power in watts
V = 230.; #voltage in volts
t1 = 16.; #temperature in degree centigrade
a0 = 0.0047; #temperature coefficient of tungsten in per degree centigrade
#CALCULATIONS
R2 = (V*V)/P;
a1 = 1/((1/a0)+t1); #temperature coefficient of resismath.tant at 16 degree centigrade
R2 = (V*V)/P; #resistance of the filament of the lamp under normal working condition
R1 = R2/(1+(a1*(t2-t1))); #resistance of copper wire in ohm at 52 degree centigrade
I2 = V/R2; #normal current taken by lamb
I1 = V/R1; #current taken at the moment of switching on
#OUTPUT
print "Thus the normal current taken by lamb and current taken at the moment of switching\
\n on are %1.4f A and %1.4f A respectively "%(I2,I1);
#INPUT DATA
m1 = 2.; #mass of water in kg
theta1 = 20.; #temperature 20 degree centigrade
theta2 = 100.; #temperature 100 degree centigrade(boiling point of water)
t = 1./10; #time taken to boil water in hr
x = 40.; #math.cost of energy of 1kwh in paise for one unit
y = 12.; #math.cost of energy consumed
S = 1.; #specific heat of water
#CALCULATIONS
H = m1*S*(theta2-theta1); #heat energy required to raise temperature from theta1 to theta2 in kcals
H = H/860; #heat energy in Kwh
E = (12./40); #electrical energy or input energy to kettle in Kwh
n = H/E*100; #efficiency of kettle in percentage;
P = E/t; #power rating of kettle
#OUTPUT
print "Thus the efficiency of kettle in percentage and power rating of kettle is %d and %1.0f Kw"%(n,P);
#INPUT DATA
m = 2.; #mass of water in kg
theta1 = 20.; #temperature 20 degree centigrade
theta2 = 100.; #temperature 100 degree centigrade(boiling point of water)
t = 0.25; #time taken to boil water in hr
V = 240.; #power supply in volts
n = 80.; #efficiency of kettle in percentage
S = 1.; #specific heat of water
#CALCULATIONS
H = m*S*(theta2-theta1); #output energy from the kettle in kcal
H = H/860; #output energy from the kettle in kwh
n = n/100;
E = H/n; #electrical energy or input energy to kettle in Kwh
P = E/t; #power rating of kettle in Kw
P = P*1000; #power rating of kettle in w
R = (V*V)/P; #resistance of heating element in ohms
#OUTPUT
print "Thus the resistance of heating element is %2.2f ohms"%(R);
#INPUT DATA
m = 20.; #mass of aluminium in kg
S = 0.896; #specific heat of aluminium in KJ/Kg degree centigrade
L = 402.; #latent heat of fusion of aluminium in KJ/Kg
theta2 = 657.; #final temperature
theta1 = 20.; #initial temperature(assumed)
P = 25.; #power of furnace in Kw
n = 80.; #efficiency of kettle in percentage
#CALCULATIONS
H = m*S*(theta2-theta1)+(m*L); #heat energy required to melt aluminium or energy output from the furnace in Kj
H = H/4.186; #heat energy required to melt aluminium or energy output from the furnace in Kcal
H = H/860; #heat energy required to melt aluminium or energy output from the furnace in KWh
n = n/100;
E = H/n; #electrical energy or input energy to kettle in Kwh
t = E/P; #time taken to melt the aluminium in hr
t = t*60; # time taken to melt the aluminium in min
#OUTPUT
print "Thus the time taken to melt the aluminium is %2.2f min"%(t);
#INPUT DATA
m = 80000.; #mass of water lifted by pump in Kg/min
g = 9.81; #gravity consmath.tant in m/sec**2
h = 2.; #pump is in operation for two hours a day
d = 30.; #pump is in operation for 30 days
T = h*d; #total time for which pump is in operation in hrs
n = 70.; #efficeincy in percentage
h = 12.; #the height in m to which pump lifts water
C = 50.; #math.cost of energy in paise/Kwh
#CALCULATIONS
P = m*g*h; #potential energy possessed by water per minute or workdone by motor pump/minute measured in joules
P = P/60; #potential energy possessed by water per minute or workdone by motor pump/minute measured in joules/sec or watts.
O = P/1000; #output power of motor in Kw
n = n/100;
E = O/n; #input power of motor in Kw
Et = E*T; #total energy supplied or energy consumption in Kwh
C = C/100; #math.cost of energy in Rs/Kwh
Ct = C*Et; #Total math.cost of energy
#OUTPUT
print "Thus the total math.cost of energy is Rs %4.0f"%(Ct);
#INPUT DATA
P = 100.; #power of power station in MW
g = 9.81; #gravity consmath.tant in m/sec**2
h = 200.; #effective head of power station in m
n = 80.; #efficiency of station in percentage
t = 10.; #operation time of power station
#CALCULATIONS
E1 = P*t; # energy output from the station in 10 hours measured in MWh
n = n/100;
E2 = P*t/n; #energy input to the station in 10 hours measured in MWh
E2 = E2*10**6*60*60; #energy input to the station in 10 hours measured in Wsec or joules
#energy input to the station is equal to potential energy supplied by water to station
m = E2/(g*h); #mass in kg of water used
d = 1000; #density of water in kg/m**3
V = m/d; #volume of water used in 10 hours
#OUTPUT
print "Thus the volume of water used in 10 hours is %e cubic metre"%(V);
#INPUT DATA
I = 20.; #current in A
V = 8.; #supply voltage in V
t = 3600.; #1hr = 3600sec
m = 1000; #mass in kg(1 tonne = 1000 kg)
#kinetic energy = energy dissipated in the resistance----eqn(1)
#CALCULATIONS
E = V*I*t; # energy dissipated in resistance in joules
v = math.sqrt(E/(0.5*m)); #kinetic energy possesed by body(K = 0.5*m*v*v) and umath.sing eqn(1),we found out velocity in m/sec
#OUTPUT
print "Thus the velocity is %2.2f m/sec"%(v);
#INPUT DATA
I = 7.9; #current in A
V = 240.; #supply voltage in V
t = 55.; #temperature in degree centigrade
a0 = 0.00029; #temperature coefficient in ohm/ohm/degree centigrade
l = 15.6; #length of wire in m
a = 12.; #cross-sectional area in mm**2
#CALCULATIONS
R = V/I; #resistance of wire in ohm
p = R*a/l; #resistivity of wire in ohm metre
Rt = R*(1+(a0*t)); #resistance at 55 degree centigrade in ohm
I1 = V/Rt; #current through wire at temperature 55 degree centigrade in A
#OUTPUT
print "Thus the resistivity and current through wire at temperature 55 degree centigrade are %2.2f micro\
\n ohm meter and %2.2f A respectively"%(p,I1);
#INPUT DATA
R1 = 0.031; #resistance of wire in ohm
d1 = 11.7; #diameter of wire in mm in case 1
r1 = d1/2; #radius of wire in mm in case 1
d2 = 5; #diameter of wire in mm in case 2
r2 = d2/2; #radius of wire in mm in case 2
# we know that resistance is inversely proportional to square of area of cross-section
#CALCULATIONS
R2 = R1*(((math.pi*r1*r1)/(math.pi*r2*r2)))**2; #resistance of wire in case 2
#OUTPUT
print "Thus the new resistance of wire is %1.4f ohms"%(R2);
#INPUT DATA
p20 = 1.724*10**-8; #specific resistance of copper in ohm m
a = 0.0043; #temperature coefficient of copper at 0 degree centigrade measured in per degree centigrade
r1 = 8; #inner radius of copper circular ring in cm
r2 = 6; #axial thickness in cm
r3 = 4; #radial thickness in cm
a1 = r2*r3*10**-4; #area of cross-section of ring in m**2
r2 = r2*2;
l = math.pi*((r1+r2)/2)/100; #length of semicircular ring between faces in m
t1 = 20; #temperature 20 degree centigrade
t2 = 50; #temperature 50 degree centigrade
#CALCULATIONS
R20 = p20*(l/a1); #resistance of ring at 20 degree centigrade in ohm
R50 = R20*((1+(a*t2))/(1+(a*t1))); #resistance of ring at 50 degree centigrade in ohm
#OUTPUT
print "Thus the resistance of wire at 50 degree centigrade is %g ohms"%(R50);
#INPUT DATA
l1 = 0.5; #length of copper rod in m
a = 0.00426; #temperature coefficient of copper measured in per degree centigrade
R1 = 4.25*10**-4; #resistance of wire at 15 degree centigrade in ohm
d1 = 5*10**-3; #diameter of copper rod in m in case 1
r1 = 0.5*d1; #radius of copper rod in m in case 1
a1 = math.pi*((r1)**2); #area of cross-section in m**2 in case 1
t1 = 15; #temperature in degree centigrade
t2 = 50; #temperature in degree centigrade
#CALCULATIONS
p = R1*a1/l1; #resistivity in ohm-m
d2 = 1*10**-3; #diameter of copper rod in m in case 2
r2 = d2/2; #radius of copper rod in m in case 2
a2 = math.pi*(r2)**2; #area of cross-section in m**2 in case 2
R15 = (a1/a2)**2*R1; #resistance at 15 degree centigrade
R50 = R15*((1+(a*t2))/(1+(a*t1)));
#OUTPUT
print "Thus the resistance of wire at 50 degree centigrade is %1.4f ohm"%(R50);
#INPUT DATA
l1 = 7.5; #length of aluminium wire in m
d1 = 1*10**-3; #diameter of aluminium wire in m
r1 = 0.5*d1; #radius of aluminium wire in m
a1 = math.pi*((r1)**2); #area of cross-section in m**2 for aluminium wire
p1 = 0.028; #resistivity of aluminium in micro ohm-m
l2 = 6; #length of copper wire in m
p2 = 0.017; #resistivity of copper in micro ohm-m
I = 5; #current through parallel combination in A
I1 = 3; #current through aluminium wire in A
I2 = I-I1; #current through copper wire in A
#CALCULATIONS
R1 = p1*l1/a1; #resistance of aluminium wire in ohm
V1 = I1*R1; #voltage drop across the end of Al wire in V
#math.since the wires are connected in parallel,so V1 = V2
a2 = I2*p2*l2/V1; #area of cross-section in m**2 for copper wire
d2 = math.sqrt(4*a2/math.pi); #diameter of copper wire in m
#OUTPUT
print "Thus the diameter of copper wire is %g m"%(d2);
#INPUT DATA
R20 = 100.; #resistance of coil at 20 degree centigrade in ohms
R45 = 110.; #resistance of coil at 45 degree centigrade in ohms
Rt = 124.; #resistance of coil at t degree centigrade in ohms
t1 = 20.; #temperature in degree centigrade
t2 = 15.; #temperature in degree centigrade
a = R45/R20;
#CALCULATIONS
a0 = (a-1)/(45-(20*a)); #temperature coefficient of coil at 0 degree centigrade
x = (Rt/R20);
t = (x)*(1+(a0*t1));
t = t-1;
t = (t)*(1/a0); # #temperature of coil when Rt = 124 ohms measured in degree centigrade
deltat = t-t2; #mean temperature rise
#OUTPUT
print "Thus the mean temperature rise is %2.0f degree centigrade"%(deltat);
#INPUT DATA
R20 = 18.; #resistance of coil at 20 degree centigrade in ohms
R50 = 20.; #resistance of coil at 50 degree centigrade in ohms
Rt = 21.; #resistance of coil at t degree centigrade in ohms
t1 = 20.; #temperature in degree centigrade
t2 = 50.; #temperature in degree centigrade
t3 = 15.; #temperature in degree centigrade
a = R50/R20;
#CALCULATIONS
a0 = (a-1)/(50-(20*a)); #temperature coefficient of coil at 0 degree centigrade
x = (Rt/R50);
t = (x)*(1+(a0*t2));
t = t-1;
t = (t)*(1/a0); # #temperature of coil when Rt = 21 ohms measured in degree centigrade
deltat = t-t3; #mean temperature rise
#OUTPUT
print "Thus the mean temperature rise is %2.0f degree centigrade"%(deltat);
#INPUT DATA
R1 = 4.; #resistance in ohms
R2 = 6.; # #resistance in ohms
I = 30.; #current through parallel combination in A
#CALCULATIONS
I1 = I*(R2/(R1+R2)); #current through resistor1 in A
I2 = I-I1; #current through resistor2 in A
#OUTPUT
print "Thus the current through resistor1 and resistor2 are %d A and %d A respectively"%(I1,I2);
#INPUT DATA
R1 = 2.; #resistance1 in ohms
R2 = 3.; #resistance2 in ohms
R3 = 4.; #resistance3 in ohms
R4 = 5.; #resistance4 in ohms
P = 100.; #total power absorbed in watts
#CALCULATIONS
RT = ((R2*R3*R4)+(R1*R3*R4)+(R1*R2*R4)+(R1*R2*R3))/(R1*R2*R3*R4);
RT = 1/RT; #equivalent resistance of parallel combination of R1,R2,R3,R4 Resistors
V = math.sqrt(P*RT); #voltage in volts that has to be applied to absorb 100w of power
#OUTPUT
print "Thus the voltage in volts that has to be applied to absorb 100w of power is %1.3f V "%(V);
#INPUT DATA
V = 230; #supply voltage in volts
I1 = 12.; #initial current in A
I2 = 16; #final current in A
#CALCULATIONS
I = I2-I1; #current through the resistance placed in parallel in A
R = V/I; #resistance in ohms by ohm's law
#OUTPUT
print "Thus the resistance placed in parallel is %2.1f ohm "%(R);
#INPUT DATA
I = 12.1; #current in A entering the parallel combination of resistors
I1 = 7.2; #current in A in resistor 1
R1 = 50.; #resistance1 in ohm
R2 = 100.; #resistance2 in ohm
#CALCULATIONS
V = I1*R1; #supply voltage in volts by ohms law(V = I*R)
I2 = V/R2; #current through R2 in A by ohms law
I3 = I-I1-I2; #current through resistance3 R3 in A by ohms law
R3 = V/I3; #resistance in ohm
#OUTPUT
print "Thus the value of third resistance placed is %3.2f ohm "%(R3);
#INPUT DATA
R1 = 3.6; #resistance in ohm
R2 = 4.56; #resistance in ohm
RT = 6.; #resistance in ohm
#CALCULATIONS
X = RT-(R2);
R3 = (X*R1)/(R1-X);
#OUTPUT
print "Thus the value of third resistance placed is %1.1f ohm "%(R3);
#INPUT DATA
P = 70.; #total power dissipated in circuit in watts
V = 22.; #applied voltage in volts
I = P/V; #total current through the circuit in Amps
R1 = 12.; #resistance 1 of parallel combination in ohms
R2 = 8.; #resistance 2 of parallel combination in ohms
#CALCULATIONS
RP = (R1*R2)/(R1+R2); #equivalent resistance of parallel combination in ohms
VP = I*RP; #voltage across parallel combination in volts
VR = V-VP; #voltage across the resistance R # in volts
R3 = VR/I; #by ohm's law
#OUTPUT
print "Thus the value of third resistance placed is %1.2f ohms "%(R3);
#INPUT DATA
P = 70.; #total power dissipated in circuit in watts
V1 = 6.; #math.since applied voltage E is 6V,as per the characteristics of parallel circuit P.D across R1 is
V2 = 6.; #V1 = V2,in volts
R1 = 12.; #resistance1 in parallel combination in ohms
R2 = 6.; #resistance2 in parallel combination in ohms
R3 = 6.25 #resistance3 in series with parallel combination in ohms
I1 = V1/R1; # current through the resistance R1 in Amps
I2 = V2/R2; #current through the resistance R2 in Amps
r = 0.25; #internal resistance in ohm
#CALCULATIONS
I = I1+I2; #total current through parallel combination
E = (I*r)+(I*R3)+V2; #emf of battery in Volts
#OUTPUT
print "Thus the value of emf of battery in Volts is %2.2f volts "%(E);
#INPUT DATA
E = 12.; #emf of battery in volts
R1 = 3.; #resistance1 in parallel combination in ohms
R2 = 4.; #resistance2 in parallel combination in ohms
R3 = 6.; #resistance3 in parallel combination in ohms
R4 = 4.; #resistance4 in series with parallel combination in ohms
r = 6.; #internal resistance in ohm
#CALCULATIONS
RP = ((R2*R3)+(R3*R1)+(R1*R2))/(R1*R2*R3);
RP = 1/RP; #equivalent resistance of parallel combination in ohms
RT = RP+R4+r; #total circuit resistance in ohms
I = E/RT; #total circuit current in A
V = E-(I*r); #terminal voltage of battery in volts
#OUTPUT
print "Thus the terminal voltage of battery is %1.3f volts "%(V);
#INPUT DATA
V = 24; #supply voltage of battery in volts
Rab = 13.; #resistance between A and B points in ohms
Rbc = 11.; #resistance between B and C points in ohms
Rbe = 18.; #resistance between B and E points in ohms
Rce = 14.; #resistance between C and E points in ohms
Red = 9.; #resistance between E and D points in ohms
Rcd = 5.; #resistance between C and D points in ohms
Rae = 22; #resistance between A and E points in ohm
Rx = Rae;
Ry = Rbe;
Raf = 1; #resistance between A and F points in ohms
#CALCULATIONS
Rce = ((Rcd+Red)*(Rce))/(Rcd+Red+Rce); #equivalent resistance of Rce in ohms
Rbe = ((Rbc+Rce)*(Rbe))/(Rbc+Rce+Rbe); #equivalent resistance of Rbe in ohms
Rae = ((Rab+Rbe)*(Rae))/(Rab+Rbe+Rae); #equivalent resistance of Rae in ohms
RT = Rae+Raf; #total equivalent circuit resistance in ohms
Iaf = V/RT; #current through resistance Raf in A
Vae = V-(Iaf*Raf); #P.D across AE in volts
Iae = Vae/Rx; #current in AE in A
Iab = Iaf-Iae; #current in AB in A
Vab = Rab*Iab; #P.D across AB in volts
Vbe = Vae-Vab; #Voltage across branch BE in volts
Pbe = ((Vbe)**2)/(Ry); #power absorbed in branch Be in watts
Ibe = Vbe/Ry; #current in BE in A
Ibc = Iab-Ibe; #current in BC in A
Icde = (Ibc)/(2); #current in CDE in A
Vcd = Icde*(Rcd); #P.D across CD
#OUTPUT
print "Current in branch AF is %d A \
\nPower absorbed in BE is %1.1f watts \
\nP.D across CD is %1.2f volts "%(Iaf,Pbe,Vcd);
from numpy.linalg import solve
#INPUT DATA
V1 = 25.; #supply voltage1 of battery in volts
V2 = 45.; #supply voltage2 of battery in volts
R1 = 6.; #resistance1 in ohms
R3 = 4.; #resistance2 in ohms
R2 = 3.; #resistance3 in ohms
#let I1 be the current in loop1 and I2 current be in loop2
#CALCULATIONS
#V1 = ((R1+R3)*(I1)-(R3*I2)); #applying KVL in loop1 -------------eqn(1)
#V2 = ((R3)*(I1)-(R2+R3)*(I2)); #applying KVL in loop2 -------------eqn(2)
#solving both eqn(1) and eqn(2)
a = [[(R1+R3),-R3],[(R3),-(R2+R3)]]
b = [[V1],[-V2]]
c = solve(a,b)#solve(a,b) #ax = b
c1 = c[0]; #c1 is current in branch FABC measured in A
c2 = c[1]; #c2 is current in branch CDEF measured in A
c3 = c1-c2; #current in branch CF in A
#OUTPUT
print "Current in R1 is %1.4f A \
\ncurrent in R2 is %2.3f A \
\ncurrent in R3 is %1.3f A "%(c1,c2,c3);
import math
from numpy.linalg import solve
#INPUT DATA
V = 4.5; #supply voltage of battery in volts
RAB = 1000.; #resistance between A and B points in ohms
RBC = 100.; #resistance between B and C points in ohms
RAD = 5000.; #resistance between A and D points in ohms
RCD = 450.; #resistance between C and D points in ohms
Rg = 500.; #resistance of galvanometer in ohms
#let I1 be the current across RAB and I1-Ig across RBC and I2 across RAD and I2+Ig across RCD and I be the total current
#where I = I1+I2
#CALCULATIONS
#(-(RAB*I1)-(Rg*Ig)+(RAD*I2)) = 0; #applying KVL to loop ABDA -------------eqn(1)
#(-(RBC*I1)+((Rg+RCD+RBC)*(Ig))+(RCD*I2)) = 0; #applying KVL to loop BCDB -------------eqn(2)
#((RAD+RCD)*I2)+(RCD*Ig)) = V; #applying KVL to loop EADCFE-------------eqn(3)
#solving eqn(1),eqn(2) and eqn(3)
a = [[-RAB,-Rg,RAD],[-RBC,(Rg+RCD+RBC),RCD],[0,RCD,(RAD+RCD)]];
b = [[0],[0],[V]];
c = solve(a,b) #solve(a,b) #ax = b
I1 = c[0]; #c1 is current in branch FABC measured in A
Ig = c[1]; #c2 is current in branch CDEF measured in A
I2 = c[2]; #current in branch CF in A
#OUTPUT
print "Current through galvanometer is %g A since the answer is positive our assumed direction is correct "%(Ig);
import math
from numpy.linalg import solve
#INPUT DATA
V1 = 8.; #supply voltage of battery in loop1 in volts
V2 = 4.; #supply voltage of battery in loop2 in volts
RED = 200.; #resistance between E and D points in ohms
RAD = 20.; #resistance between A and D points in ohms
RCD = 50.; #resistance between C and D points in ohms
#let I1 be the current across path AFED and I2 across AD and I1-I2 across path DCBA
#CALCULATIONS
#((RCD*I1)-((RAD+RCD)*I2)) = 4; #applying KVL to loop ADCBA -------------eqn(1)
#((RED*I1)+(RAD*I2)) = 8; #applying KVL to loop AFEDA -------------eqn(2)
#solving eqn(1)and eqn(2)
a = [[RCD,-(RAD+RCD)],[RED,RAD]]
b = [[4],[8]];
c = solve(a,b) #ax = b
I1 = c[0]; #c1 is current across path AFED in A
I2 = c[1]; #c2 is current across AD in A
#OUTPUT
print "Current in 20 ohm resistor is %f A math.since the answer is negative,the current actually flows from A to D "%(I2);
import math
#INPUT DATA
Rs = 25.; #total resistance when two resistances are connected in series in ohms
Rp = 6.; #total resistance when two resistances are connected in parallel in ohms
#let individual resistances be R1 and R2 ohms
#CALCULATIONS
#Rs = (R1+R2)---eqn(1)
#Rp = ((R1*R2)/(R1+R2))---eqn(2)
#let (R1*R2) = x
#let(R1-R2) = y
#solving eqn(1)and eqn(2)
x = Rs*Rp; #in ohms
y = math.sqrt((Rs)**2-(4*x)); #eqn---(3)
#solving eqn(1) and eqn(3)
z = Rs+y;
R1 = z/2; #resistance1 in ohms
R2 = Rs-R1; #resistance2 in ohms
#OUTPUT
print "Thus the individual resistances are R1 = %d ohms and R2 = %d ohms "%(R1,R2);
import math
#INPUT DATA
P = 16.; #total power dissipated in circuit in Watts
R1 = 4.; #resistance R1 in Ohms
R2 = 2.; #resistance R2 in Ohms
R3 = 8.; #resistance R3 in Ohms
V = 8.; #supply voltage in volts
#let resistance parallel to R1 is R ohms
#CALCULATIONS
Reff = (((V)**2)/P); #total effective resistance of circuit in ohms
x = ((R2*R3)/(R2+R3)); #effective resistance of 2nd parallel circuit in ohms
z = (Reff-x); #effective resistance of 1st parallel circuit where z = ((R1*R)/(R1+R)) in ohms------eqn(1)
#solving for R in eqn(1)
R = (R1*z)/(R1-z);
Reff = ((R1*R)/(R1+R))+(x); #in ohms
I = V/Reff; #total current in A
print "Thus the total current is I = %d A "%(I);
import math
#INPUT DATA
R1 = 2.; #resistance R1 in Ohms
R2 = 12.; #resistance R2 in parallel circuit measured in ohms
R3 = 20.; #resistance R3 in parallel circuit measured in ohms
R4 = 30.; #resistance R4 in parallel circuit measured in ohms
R5 = 2.; #resistance R5 in ohms
V = 100.; #supply voltage in volts
#CALCULATIONS
Reff = (R1)+((1)/((1/R2)+(1/R3)+(1/R4)))+(R5); #total effective resistance of circuit in ohms
I = V/Reff; #total current in A
# let individual currents in 3 parallel resistance network be I1,I2,I3 respectively
#Then I1+I2+I3 = I---eqn(1)
#where I2 = (I1*R1/R2) and I3 = (I1*R1/R3)
#solving for I1 in eqn(1)
I1 = I/2; #in A
I2 = (I1*R2/R3); #in A
I3 = (I1*R2/R4); #in A
# Results
print "I1 = %d A I2 = %1.0f A I3 = %1.0f A"%(I1,I2,I3);
#INPUT DATA
V = 100.; #supply voltage in volts
I = 10.; #total current in A
P1 = 600.; #power dissipated in coil in Watts
#CALCULATIONS
#Reff = ((R1*R2)/(R1+R2)) is total effective resistance of circuit in ohms----eqn(1)
Reff = V/I; #total effective resistance of circuit in ohms
R1 = ((V)**2)/(P1); #in ohms----eqn(2)
#solving for R2 in eqn(1)
R2 = ((Reff*R1)/(R1-Reff)); #in ohms
# Results
print "R1 = %2.2f Ohms R2 = %1.0f Ohms "%(R1,R2);
import math
#INPUT DATA
R1 = 5.; #resistance in ohms
P = 20.; #power dissipated in R1 in Watts
R2 = 10.; #resistance parallel to R1
#CALCULATIONS
I1 = math.sqrt(P/R1); #current through R1 in A
I = ((R1+R2)/(R2))*(I1); #total supply current in A
# Results
print "I = %d A"%(I);
import math
#INPUT DATA
I1 = 2.; #current through R1 in A
I3 = 1.5; #current through R3 in A
I5 = 0.5; #current through R5 in A
P2 = 75.; #power dissipated in R2 in W
P4 = 30.; #power dissipated in R4 in W
V = 200; #supply voltage in volts
#let the current through R2 and R4 be I2 and I4 respectively
#CALCULATIONS
I2 = I1-I3; #current through R2 in A
I4 = I3-I5; #current through R4 in A
R2 = P2/(I2)**2; #resistance R2 in Ohms
R4 = P4/(I4)**2; #resistance R4 in Ohms
R5 = (R4*I4)/(I5); #resistance R5 in Ohms
#(R1*I1)+(R2*I2) = 200
#(R3*I3)+(R4*I4) = (R2*I2)
R1 = ((V-(R2*I2))/I1); #resistance R1 in Ohms
R3 = ((R2*I2)-(R4*I4))/(I3); #resistance R3 in Ohms
#OUTPUT
print "R1 = %d ohms R2 = %d ohms R3 = %d ohms R4 = %d ohms R5 = %d ohms "%(R1,R2,R3,R4,R5);
import math
#INPUT DATA
VA = 0.2; #voltage across ammeter A in Volts
VB = 0.3; #voltage across ammeter B in volts
I = 20.; #total current in A
#CALCULATIONS
RA = VA/I; #resistance through ammeter A in ohms
RB = VB/I; #resistance through ammeter B in ohms
IA = ((RB*I)/(RA+RB)); #current through ammeter A in amps
IB = I-IA; #current through ammeter B in amps
#OUTPUT
print "IA = %1.0f Amps IB = %d Amps "%(IA,IB);
import math
#Chapter-1, Example 1.43, Page 51
#INPUT DATA
R1 = 10.; #resistance R1 in ohms
R2 = 20.; #resistance R2 in ohms
R3 = 40.; #resistance R3 in ohms
#after certain manipulations the Resultant network can be evaluated as parallel combinaton of R1,R2,R3
#CALCULATIONS
RAD = 1/((1/R1)+(1/R2)+(1/R3)); #Resultant resistance in Ohms
#OUTPUT
print "Resultant resistance RAD is %1.3f ohms"%(RAD);
import math
#Chapter-1, Example 1.44, Page 51
#INPUT DATA
V = 200.; #supply voltage in volts
I = 25.; #total current in A
P1 = 1500.; #power dissipated in watts
#CALCULATIONS
R1 = (V)**2/(P1); #resistance R1 in Ohms
Reff = (V)/(I); #total effective resistance of R1 and R2 in parallel in Ohms
R2 = (Reff*R1)/(R1-Reff); #resistance R2 in Ohms
#OUTPUT
print "R1 = %2.3f ohms R2 = %2.3f ohms"%(R1,R2);
import math
#Chapter-1, Example 1.45, Page 52
#INPUT DATA
V = 15.; #supply voltage in volts
VAB = 5.; #voltage across AB in volts
R1 = 5.; #resistance in ohms
R2 = 10.; #resistance in ohms
R3 = 10.; #resistance in ohms
#CALCULATIONS
VAC = ((R1)/(R1+R3))*V; #Volatge across AC terminals in Volts
#VBC = (((R)/(R+2))*V)--------------eqn(1) by ohm's law
#VAB = (VAC-((VBC)*(R2-(((R1+R2)*R)/(R+2)))---------------eqn(2) by ohm's law
#solving equation 2 with Vab = 5V
R = 10./10; #resistance R in ohms
#OUTPUT
print "R = %d ohms"%(R);
import math
#Chapter-1, Example 1.46, Page 52
#INPUT DATA
Ra = 4.; #resistance in ohms
Rb = 9.; #resistance in ohms
Rc = 18.; #resistance in ohms
Rd = 2.; #resistance in ohms
Re = 7.; #resistance in ohms
Rf = 15.; #resistance in ohms
V = 125.; #voltage in volts
#CALCULATIONS
R1 = ((Ra)+((Rb*Rc)/(Rc+Rb))); #resistance in branch1 in ohms
R2 = ((Rd)+(Re)); #resistance in branch2 in ohms
Reff = ((R1*R2)/(R1+R2))+Rf; #effective resistance in ohms
I = V/Reff; #current in Rf resistor in Amps
I1 = (I)*(Rb)/(Rb+R1); #current in resistor Ra in Amps
Ix = (I1)*(Rb/(Rb+Rc)) ; #current in resistor Rc in Amps
V2 = (Ix)*(Rc); #voltage across Rc in volts
I2 = I-I1; #current across Re in Amps
P4 = (I2)**2*Re; #power dissipated across Re in W
#OUTPUT
print "current across 15 ohm resistor is %1.2f amps \
\nvoltage across 18 ohm resistor is %dV \
\npower dissipated in 7 ohm resistor is %2.1f Watts "%(I,V2,P4);
import math
from numpy.linalg import solve
#INPUT DATA
R1 = 20.; #resistance in ohms
R2 = 50.; #resistance in ohms
R3 = 30.; #resistance in ohms
R4 = 15.; #resistance in ohms
V = 100.; # supply voltage in volts
#applying KVL to meshes I and II
#R1*(I1)+(R3)*(I1-I2) = V;-------eqn(1)
#(R2+R4)*(I2)+(R3)*(I2-I1) = 0;---------eqn(2)
#solving eqn(1) and eqn(2)
#CALCULATIONS
a = [[R2,-R3],[-R3,(R3+R4+R2)]];
b = [[V],[0]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
#OUTPUT
print "current across 15 ohm resistor is %1.4f amps"%(I2);
import math
from numpy.linalg import solve
#INPUT DATA
RAB = 1.; #resistance across AB in ohms
ROB = 4.; #resistance across OB in ohms
RBC = 2.; #resistance across BC in ohms
RAC = 1.5; #resistance across AC in ohms
V = 10.; # supply voltage in volts
#let ROC is R ohms
#applying KVL to meshes I,II and III
#RAB*(I1)+0+ROB*(I1-I3) = 0-------eqn(1)
#RAC*(I2)+ROC*(I2-I3) = 0---------eqn(2)
#ROB*(I3-I1)+R*(I3-I2)+RBC*I3 = 10------eqn(3)
#solving eqn(1) we get it as (I2 = I1) and applying it in eqn(2) we get R as 6 ohms
R = 6; #resistance ROC
#solving eqn(1),(2)and (3)
#CALCULATIONS
a = [[RAB+ROB,0,-ROB],[0,(RAC+R),-R],[-ROB,-R,(RBC+R+ROB)]];
b = [[0],[0],[10]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
I3 = c[2]; #current in mesh3 in A
I = (I3-I2); #current flowing through R
#OUTPUT
print "current across resistor R is %1.1f amps"%(I);
import math
from numpy.linalg import solve
#INPUT DATA
R1 = 5.; #resistance in ohms
R2 = 15.; #resistance in ohms
R3 = 10.; #resistance in ohms
R4 = 8.; #resistance in ohms
R5 = 12.; #resistance in ohms
V1 = 4.; # supply voltage in volts
V2 = 6.; #supply voltage in volts
#let currents in mesh I,II and III is I1,I2,I3 respectively
#applying KVL to meshes I,II and III
#(R1+R2)*(I1)-R2*(I2) = V1-------eqn(1)
#R2*(I1)-(R2+R3+R4)*(I2)+(R4)*(I3) = 0---------eqn(2)
#R4*(I2)-(R4+R5) = V2------eqn(3)
#solving eqn(1) we get it as (I2 = I1) and applying it in eqn(2) we get R as 6 ohms
R = 6; #resistance ROC
#solving eqn(1),(2)and (3)
#CALCULATIONS
a = [[R1+R2,-R2,0],[R2,-(R2+R3+R4),R4],[0,R4,-(R4+R5)]];
b = [[V1],[0],[V2]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
I3 = c[2]; #current in mesh3 in A
I = (I2-I3); #current flowing through R4 in Amps
#OUTPUT
print "current across 8 ohm resistor is %1.3f amps"%(I);
import math
from numpy.linalg import solve
#INPUT DATA
RAB = 25.; #resistance in ohms
RBC = 10.; #resistance in ohms
RAD = 20.; #resistance in ohms
RCD = 15.; #resistance in ohms
RG = 50.; #resistance of galvanometer in ohms
REF = 2.; #internal resistance in ohms
V = 25.; # supply voltage in volts
#let currents in mesh I,II and III is I1,I2,I3 respectively
#applying KVL to meshes I,II and III
#(RAB+RG+RAD)*(I1)-(RG)*(I2)-(RAD)*(I3) = 0-------eqn(1)
#-(RG)*(I1)-(RG+RCD+RBC)*(I2)-(RCD)*(I3) = 0---------eqn(2)
#-(RAD)*(I1)-(RCD)*(I2)+(RAD+RCD+REF) = -V---eqn(3)
#solving eqn(1),(2)and (3)
#CALCULATIONS
a = [[RAB+RG+RAD,-RG,-RAD],[-RG,(RG+RCD+RBC),-RCD],[-RAD,-RCD,(RAD+RCD+REF)]];
b = [[0],[0],[-V]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
I3 = c[2]; #current in mesh3 in A
I = (I1-I2); #currentthrough galvanometer in Amps
#OUTPUT
print "current across galavanometer is %1.5f amps"%(I);
import math
from numpy.linalg import solve
#INPUT DATA
V1 = 100; #source1 voltage in volts
V2 = 50.; #source2 voltage in volts
R1 = 10.; #resistance in ohms
R2 = 20.; #resistance in ohms
R3 = 30.; #resistance in ohms
R4 = 40.; #resistance in ohms
#let currents in mesh I,II is I1,I2 respectively
#applying KVL to meshes I,II
#(R1+R3+R4)*(I1)-(R3)*(I2) = V1-------eqn(1)
#(R3)*(I1)-(R2+R3)*(I2) = -V2---------eqn(2)
#solving eqn(1),(2)
#CALCULATIONS
a = [[(R1+R3+R4),-R3],[R3,-(R2+R3)]];
b = [[V1],[-V2]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
I = (I2-I1); #current through R3 in Amps
#OUTPUT
print "current across 30 ohm resistor is %1.3f amps"%(I);
import math
from numpy.linalg import solve
#INPUT DATA
V1 = 10; #source1 voltage in volts
V2 = 5; #source2 voltage in volts
V3 = 5; #source3 voltage in volts
RAH = 2; #resistance in ohms
RAB = 3; #resistance in ohms
RBE = 5; #resistance in ohms
REG = 5; #resistance in ohms
RED = 5; #resistance in ohms
RBC = 7; #resistance in ohms
RCD = 3; #resistance in ohms
RDF = 5; #resistance in ohms
RHG = 5; #resistance in ohms
#let currents in mesh I,II,III is I1,I2,I3 respectively
#applying KVL to meshes I,II
#(RAH+RHG+RAB+RBE+REG)*(I1)-(RBE)*(I2)-(REG)*(I3) = V1-------eqn(1)
#-(RBE)*(I1)+(RBC+RCD+RBE+RED)*(I2)-(RDF)*(I3) = -V2---------eqn(2)
#-(REG)*(I1)-(RED)*(I2)+(REG+RED+RDF)*(I3) = -V3--------eqn(3)
#solving eqn(1),(2) and (3)
#CALCULATIONS
a = [[(RAH+RHG+RAB+RBE+REG),-RBE,-REG],[-REG,(RBC+RCD+RBE+RED),-(RDF)],[-REG,-RED,(REG+RED+RDF)]];
b = [[V1],[-V2],[-V3]];
c = solve(a,b);
I1 = c[0]; #current in mesh1 in A
I2 = c[1]; #current in mesh2 in A
I3 = c[2]; #current in mesh3 in A
P1 = V1*I1; #power output from V1 in W
P2 = V2*I2; #power output from V2 in W
P3 = V3*I3; #power output from V3 in W
#OUTPUT
print "power output from 10V is %1.1f W from 5V is %1.2fW from 5V is %1.2fW "%(P1,-P2,-P3);
import math
#INPUT DATA
RAC = 10.; #resistance in ohms
RCD = 10.; #resistance in ohms
RCF = 50.; #resistance in ohms
RDH = 50.; #resistance in ohms
RDF = 30.; #resistance in ohms
RHF = 10.; #resistance in ohms
#umath.sing star to delta conversion,the star point D is eliminated
#CALCULATIONS
RCF1 = ((RCD*RDF)+(RDF*RDH)+(RDH*RCD))/(RDH); #by umath.sing star to delta conversion technique
RFH = ((RCD*RDF)+(RDF*RDH)+(RDH*RCD))/(RCD); #by umath.sing star to delta conversion technique
RHC = ((RCD*RDF)+(RDF*RDH)+(RDH*RCD))/(RDF); #by umath.sing star to delta conversion technique
RCF2 = (RCF*RCF1)/(RCF+RCF1);
RCF = RCF2; #equivalent resistance of RCF in ohms
RHF1 = (RHF*RFH)/(RHF+RFH);
RHF = RHF1; #equivalent resistance of RHF in ohms
RAB = (RAC)+(RHC*(RCF+RHF))/(RHC+RCF+RHF); #equivalent resistance of AB in ohms
#OUTPUT
print "Thus equivalent resistance of AB is %f ohms"%(RAB);
#note:given final answer is wrong in textbook.Please check the calculations
import math
#INPUT DATA
RAB = 1.; #resistance in ohms
RBE = 2.; #resistance in ohms
RED = 3.; #resistance in ohms
REF = 3.; #resistance in ohms
RDF = 3.; #resistance in ohms
RAD = 2.; #resistance in ohms
RAC = 1.; #resistance in ohms
RBC = 1.; #resistance in ohms
RFC = 2.; #resistance in ohms
#CALCULATIONS
#Delta DEF is converted into equivalent star where RDN = REN = RFN = 1 ohm
#series branches of inner star network are added
#Star ABCN is converted to equivalent delta
RDN = 1;
REN = RDN;
RFN = REN;
RAN = RAD+RDN;RBN = RBE+REN;RCN = RFC+RFN
RAB1 = ((RAN*RBN)+(RBN*RCN)+(RCN*RAN))/(RCN); #by umath.sing star to delta conversion technique
RBC1 = ((RAN*RBN)+(RBN*RCN)+(RCN*RAN))/(RAN); #by umath.sing star to delta conversion technique
RCA1 = ((RAN*RBN)+(RBN*RCN)+(RCN*RAN))/(RBN); #by umath.sing star to delta conversion technique
#parallel resistances in each branch are converted to math.single resistance
RAB2 = (RAB*RAB1)/(RAB+RAB1);
RAB = RAB2; #equivalent resistance of RAB in ohms
RBC2 = (RBC*RBC1)/(RBC+RBC1);
RBC = RBC2; #equivalent resistance of RBC in ohms
RCA2 = (RAC*RCA1)/(RAC+RCA1);
RCA3 = ((RCA2)*(RAB+RBC))/(RBC+RAB+RCA2);
RCA = RCA3;
#OUTPUT
print "Thus equivalent resistance of CA is %1.1f ohms"%(RCA);
#TO FIND EQUIVALENT RESISTANCE BETWEEN DF
#node A is eliminated umath.sing star to delta conversion
RBC = (RAB*RAD)+(RAD*RAC)+(RAC*RAB)/(RAD); #by umath.sing star to delta conversion technique
RCD = (RAB*RAD)+(RAD*RAC)+(RAC*RAB)/(RAB); #by umath.sing star to delta conversion technique
#node C is eliminated umath.sing star to delta conversion
RDB = (0.72*5)+(5*2)+(2*0.72)/2;
RBF1 = (0.72*5)+(5*2)+(2*0.72)/5;
RFD = (0.72*5)+(5*2)+(2*0.72)/0.72;
#parallel branches between nodes B and D and nodes D and F are reduced as
RBD = (RDB*5)/(RDB+5);
RDF = (RFD*3)/(RFD+3);
#node E is eliminated umath.sing star to delta conversion technique
RBF = ((2*3)+(3*3)+(3*2))/3.;
RFD = ((2*3)+(3*3)+(3*2))/2.;
RDB = ((2*3)+(3*3)+(3*2))/3.;
RDF1 = 4.2; #(R' = RDB+RDF)
RDF = ((RDF1)*(RDF1/2))/(RDF1+(RDF1/2));
#OUTPUT
print " Thus equivalent resistance of DF is %1.1f ohms"%(RDF);
import math
#INPUT DATA
RAB = 6.; #resistance in ohms
RBC = 3.; #resistance in ohms
RBD = 4.; #resistance in ohms
V1 = 25.; #source voltage in volts
V2 = 45.; #source voltage in volts
#CALCULATIONS
#applying kirchoff's current law at node B
#-I1-I2+I3 = 0
#I1 = (V1-VB)/RAB
#I2 = (V3-VB)/RBC
#I3 = VB/RBD
VB = ((V1/RAB)+(V2/RBC))/((1/RAB)+(1/RBC)+(1/RBD));
I1 = (V1-VB)/(RAB); #current across AB
I2 = (V2-VB)/(RBC); #current across BC
I3 = (VB)/(RBD); #current across BD
#OUTPUT
print "Thus currents I1, I2 ,I3 are %1.1f A %1.2f A %1.1f A"%(I1,I2,I3);
import math
from numpy.linalg import solve
#INPUT DATA
I1 = 25.; #current source in A
I2 = 6.; #current source in A
I3 = 5.; #current source in A
RAB = 5.; #resistance in ohms
RAC = 10.; #resistance in ohms
RBC = 2.; #resistance in ohms
#let currents across AC and BC and AB are Ix,Iy and Iz respectively
#applying kirchoff's current law at node A
#-I1+Ix+I3+Iz = 0------eqn(1)
#applying kirchoff's current law at node B
#-Iz-I3+Iy+I2 = 0------eqn(2)
#CALCULATIONS
a = [[((1/RAC)+(1/RAB)),(-1/RAB)],[(-1/RAB),((1/RAB)+(1/RBC))]];
b = [[20],[-1]];
c = solve(a,b)
VA = c[0]; #voltage at node A
VB = c[1]; #voltage at node B
#OUTPUT
print "Thus voltages at node A and B are %2.1f V and %2.1f V"%(-VA,VB);
#INPUT DATA
RAB = 1.; #resistance in ohms
RAD = 1; #resistance in ohms
RDC = 2; #resistance in ohms
RCB = 1; #resistance in ohms
RAC = 1; #resistance in ohms
#delta DAC has been converted to star DAC where RDN = 0.5 ohms,RNA = 0.25 ohms,RNC = 0.5 ohms
#CALCULATIONS
RDN = 0.5;
RNA = 0.25;
RNC = 0.5
RBD = ((RDN)+(((RNA+RAB)*(RNC+RCB))/(RNA+RAB+RNC+RCB))); #equivalent resistance across BD
#OUTPUT
print "Thus equivalent resistance across BD is %1.2f ohms"%(RBD);
#INPUT DATA
RAB = 9.; #resistance in ohms
RBC = 1.; #resistance in ohms
RCA = 1.5; #resistance in ohms
RAD = 6.; #resistance in ohms
RBD = 4.; #resistance in ohms
RCD = 3.; #resistance in ohms
#star ABC has been converted to delta AnBnCn where RABn = 18 ohms,RBCn = 9 ohms,RCAn = 13.5 ohms
#CALCULATIONS
RABn = 18.;
RBCn = 9.;
RCAn = 13.5;
RAB1 = ((RAB*RABn)/(RAB+RABn)); #equivalent resistance across AB
RBC1 = ((RBC*RBCn)/(RBC+RBCn)); #equivalent resistance across BC
RAC1 = ((RCA*RCAn)/(RCA+RCAn)); #equivalent resistance across AC
#there are two parallel paths across points A and B.
#(a)one directly from A to B having a resistance of 6 ohms and
#(b)The other via C having a total resistance
RBA = ((RBC1+RAC1)*(RAB1))/(RBC1+RAC1+RAB1); #final equivalent resistance across AB
RCB = ((RAC1+RAB1)*(RBC1))/(RAC1+RAB1+RBC1); #final equivalent resistance across BC
RCA = ((RAB1+RBC1)*(RAC1))/(RAB1+RBC1+RAC1); #final equivalent resistance across AC
#OUTPUT
print "Thus final equivalent resistance across AB, BC and CA are %1.2f ohms, %1.2f ohms, %1.2f ohms"%(RBA,RCB,RCA);
#note:answer given for RCA is wrong.Please check the calculations