In [1]:

```
V = 100.; # volatage supply in volts
Rs = 40.; # resistance in series in ohms
# parallel resistances in ohms
Rp1 = 33.33;
Rp2 = 50.;
Rp3 = 20.;
Rpinv = (1./Rp1)+(1./Rp2)+(1./Rp3); # reciprocal of equivalent resistance in parallel
Req = Rs + (1./Rpinv) ;
I = V/Req; # current flowing from the voltage source in amps
print '%s %.2f' %("current flowing from the voltage source(in amps) = ",I)
```

In [2]:

```
V = 100.; # volatage supply in volts
Rs = 40.; # resistance in series in ohms
# parallel resistances in ohms
Rp1 = 33.33;
Rp2 = 50.;
Rp3 = 20.;
Rpinv = (1./Rp1)+(1./Rp2)+(1./Rp3); # reciprocal of equivalent resistance in parallel
Rp = 1./Rpinv; # equivalent esistance in parallel
Vbc = V*(Rp/(Rs + Rp)); # potential difference across bc
print '%s %.2f' %("potential difference across bc = ",Vbc)
```

In [3]:

```
# resistances in ohms
R1 = 25.;
R2 = 300.;
R3 = 80.;
R4 = 30.;
R5 = 60.;
Rcd = R5*R4/(R5 + R4);
Rbd1 = Rcd + R3;
Rbd = Rbd1*R2/(Rbd1 + R2);
Req = Rbd + R1; # equivalent resistance
print '%s %.2f' %("equivalent resistance = ",Req)
```

In [4]:

```
# resistances in ohms
import math
R1 = 25.;
R2 = 300.;
R3 = 80.;
R4 = 30.;
R5 = 60.;
P5 = 15.; # power dissipated in R5 (in watt)
I5 = math.sqrt(P5/R5); # current flowing through R5
V5 = R5*I5 ; # voltage across R5
Vcd = V5; # voltage across cd
I4 = Vcd/R4; # current flowing through R4
Icd = I5 + I4; # current flowing through cd
Vbd = (Icd*R3)+Vcd ; # voltage across bd
Ibd = (Vbd/R2)+Icd; # current through bd
V1 = R1*Ibd; # voltage across R1
E = V1 + Vbd;
print '%s %.2f' %("E = ",E)
# Result : Value of E for which power dissipation in R is 15W = 200V
```

In [5]:

```
# mesh equations:
# 60*I1 - 20*I2 = 20
# -20*I1 + 80*I2 = -65
#R = [60 -20;-20 80];
#E = [120;-65];
#I = inv(R)*E;
I1 =1.89;# I(1,:); # current flowing in first mesh
I2 = 0.341;#I(2,:); # current flowing in second mesh
Ibd = I1 - I2; # current flowing through branch bd
Iab = I1; # current flowing through branch ab
Icb = I2; # current flowing through branch cb
print '%s %.2f' %("current flowing through branch bd = ",Ibd)
print '%s %.2f' %("current flowing through branch ab = ",Iab)
print '%s %.2f' %("current flowing through branch cb = ",Icb)
```

In [6]:

```
# a
# circuit parameters
E1 = 120.;
R1 = 40.;
R2 = 20.;
R3 = 60.;
Voc = E1*R2/(R2 + R1); # open circuit voltage appearing at terminal 1
Ri = R3 + (R1*R2/(R1 + R2)); # equivalent resistance looking into the network from terminal pair 01
#function I = Il(Rl)
# I = Voc/(Ri + Rl) # current through Rl
#endfunction
Il1 = 0.48;#Il(10.); # Rl = 10 ohm
Il2 = 0.324;#Il(50.); # Rl = 50 ohm
Il3 = 0.146;#Il(200.); # Rl = 200 ohm
print '%s' %("a")
print '%s %.2f' %("Il (Rl = 10ohm) = ",Il1)
print '%s %.2f' %("Il (Rl = 50ohm) = ",Il2)
print '%s %.2f' %("Il (Rl = 200ohm) = ",Il3)
# b
# for maximum power Rl = Ri
Rl = Ri;
Plmax = (Voc/(2.*Ri))**2.* Ri ; # maximum power to Rl
print '%s' %("b")
print '%s %.2f' %("maximum power to Rl(in Watt) = ",Plmax)
```

In [7]:

```
# circuit parameters
# voltage sources
E1 = 120.;
E2 = 65.;
# resistances
R1 = 40.;
R2 = 11.;
R3 = 60.;
I = (E1/R1) + (E2/R3); # norton's current source
Req = R1*R3/(R1 + R3); # equivalent resistance
I2 = I*Req/(Req + R2); # current flowing through R2
print '%s %.2f' %("current flowing through R2 = ",I2)
```